Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User specified parameters for container info. #79

Merged
merged 17 commits into from
Jul 10, 2014

Conversation

monnand
Copy link
Collaborator

@monnand monnand commented Jul 8, 2014

In this PR, we allow api users to specify how many stats/samples they want to retrieve and also let them to specify which percentile of CPU/Memory usage they want to retrieve.

@monnand monnand changed the title Query parameter User specified parameters for container info. Jul 8, 2014
@vmarmol
Copy link
Contributor

vmarmol commented Jul 9, 2014

nit: can you squash your commits :)

NumStats int `json:"num_stats,omitempty"`
NumSamples int `json:"num_samples,omitempty"`

CpuUsagePercentages []int `json:"cpu_usage_percentages,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think both of these are percentiles

@monnand
Copy link
Collaborator Author

monnand commented Jul 9, 2014

All comments addressed. PTAL.

err := decoder.Decode(&query)
if err != nil && err != io.EOF {
fmt.Fprintf(w, "unable to decode the json value: ", err)
return err
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just return fmt.Errorf() of what you Fprintf'd now

@monnand
Copy link
Collaborator Author

monnand commented Jul 9, 2014

PTAL.

decoder := json.NewDecoder(r.Body)
err := decoder.Decode(expectedPostObjEmpty)
if err != nil {
t.Errorf("Recived invalid object: %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: type in Received here and below

@monnand
Copy link
Collaborator Author

monnand commented Jul 9, 2014

PTAL.

@@ -280,6 +376,23 @@ func NewSample(prev, current *ContainerStats) (*ContainerStatsSample, error) {
return sample, nil
}

func NewSamplesFromStats(stats ...*ContainerStats) ([]*ContainerStatsSample, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only used by test code. Move there?

@@ -162,7 +162,7 @@ func ServerContainersPage(m manager.Manager, w http.ResponseWriter, u *url.URL)
containerName := u.Path[len(ContainersPage)-1:]

// Get the container.
cont, err := m.GetContainerInfo(containerName)
cont, err := m.GetContainerInfo(containerName, nil)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The UI today expects at max 60 data points so we should make a ContainerInfoRequest with that.

@vmarmol
Copy link
Contributor

vmarmol commented Jul 10, 2014

Ping @monnand?

@monnand
Copy link
Collaborator Author

monnand commented Jul 10, 2014

@vmarmol Sorry, There's a conference for interns yesterday and today.

@monnand
Copy link
Collaborator Author

monnand commented Jul 10, 2014

@vmarmol All comments addressed except the createManagerAndAddContainers() one. PTAL

@@ -280,6 +376,25 @@ func NewSample(prev, current *ContainerStats) (*ContainerStatsSample, error) {
return sample, nil
}

/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this commented out code and we can merge :)

Thanks @monnand! No rush, I think I'll just tag 0.1.2 without this.

@monnand
Copy link
Collaborator Author

monnand commented Jul 10, 2014

@vmarmol Done. Thank you!

@vmarmol
Copy link
Contributor

vmarmol commented Jul 10, 2014

Thanks @monnand! Merging when CI finishes.

vmarmol added a commit that referenced this pull request Jul 10, 2014
User specified parameters for container info.
@vmarmol vmarmol merged commit 069cff8 into google:master Jul 10, 2014
@monnand monnand deleted the query-parameter branch July 10, 2014 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants