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

Expose and collect Boskos HTTP metrics #15990

Merged
merged 1 commit into from
Jan 23, 2020

Conversation

ixdy
Copy link
Member

@ixdy ixdy commented Jan 23, 2020

The main Boskos service exposes useful Prometheus metrics about its HTTP API:

httpRequestDuration = metrics.HttpRequestDuration("boskos", 0.005, 360)
httpResponseSize = metrics.HttpResponseSize("boskos", 128, 65536)
traceHandler = metrics.TraceHandler(simplifier, httpRequestDuration, httpResponseSize)

We should collect these.

We'll need to create a new static IP to bind to the load balancer. Assuming we think this is a good idea, I'll do that and then update this PR.

I'm still figuring how to update the various grafana configurations to graph this data, but we may as well start by collecting it.

/area boskos
/area monitoring
/hold

/assign @cjwagner @stevekuznetsov
cc @Katharine as FYI

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 23, 2020
@k8s-ci-robot
Copy link
Contributor

@ixdy: The label(s) area/monitoring cannot be applied, because the repository doesn't have them

In response to this:

The main Boskos service exposes useful Prometheus metrics about its HTTP API:

httpRequestDuration = metrics.HttpRequestDuration("boskos", 0.005, 360)
httpResponseSize = metrics.HttpResponseSize("boskos", 128, 65536)
traceHandler = metrics.TraceHandler(simplifier, httpRequestDuration, httpResponseSize)

We should collect these.

We'll need to create a new static IP to bind to the load balancer. Assuming we think this is a good idea, I'll do that and then update this PR.

I'm still figuring how to update the various grafana configurations to graph this data, but we may as well start by collecting it.

/area boskos
/area monitoring
/hold

/assign @cjwagner @stevekuznetsov
cc @Katharine as FYI

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added area/boskos Issues or PRs related to code in /boskos cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jan 23, 2020
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. area/prow Issues or PRs related to prow area/prow/bump Updates to the k8s prow cluster sig/testing Categorizes an issue or PR as relevant to SIG Testing. labels Jan 23, 2020
port: 80
protocol: TCP
targetPort: 8080
Copy link
Member Author

Choose a reason for hiding this comment

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

This is intentional: the boskos-metrics service proxies the main /metric API on port 8080, and this was masked in #15356. Configuring the scraper to look at port 9090 (also included here) is a better fix.

Copy link
Member

Choose a reason for hiding this comment

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

Does port 8080 really need to be externally exposed? I don't know what that endpoint is for or what uses it so I'll leave that to your discretion.

Copy link
Member Author

Choose a reason for hiding this comment

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

It used to be exposed, prior to #15356. it basically just proxies the /metric API:

// handleMetric: Handler for /
// Method: GET
func handleMetric(boskos *client.Client) http.HandlerFunc {
return func(res http.ResponseWriter, req *http.Request) {
log := logrus.WithField("handler", "handleMetric")
log.Infof("From %v", req.RemoteAddr)
if req.Method != "GET" {
log.Warningf("[BadRequest]method %v, expect GET", req.Method)
http.Error(res, "only accepts GET request", http.StatusMethodNotAllowed)
return
}
rtype := req.URL.Query().Get("type")
if rtype == "" {
msg := "type must be set in the request."
log.Warning(msg)
http.Error(res, msg, http.StatusBadRequest)
return
}
log.Infof("Request for metric %v", rtype)
metric, err := boskos.Metric(rtype)
if err != nil {
log.WithError(err).Errorf("Fail to get metic for %v", rtype)
http.Error(res, err.Error(), http.StatusNotFound)
return
}
metricJSON, err := json.Marshal(metric)
if err != nil {
log.WithError(err).Errorf("json.Marshal failed: %v", metricJSON)
http.Error(res, err.Error(), http.StatusInternalServerError)
return
}
log.Infof("Metric query for %v: %v", rtype, string(metricJSON))
fmt.Fprint(res, string(metricJSON))
}
}

Nobody has complained that this is missing, so maybe we don't need it.

Copy link
Member Author

Choose a reason for hiding this comment

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

(removed)

@ixdy
Copy link
Member Author

ixdy commented Jan 23, 2020

(related to #15557 - it'd be good to know how the k8s boskos is doing in comparison.)

Copy link
Member

@cjwagner cjwagner left a comment

Choose a reason for hiding this comment

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

/hold

port: 80
protocol: TCP
targetPort: 8080
Copy link
Member

Choose a reason for hiding this comment

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

Does port 8080 really need to be externally exposed? I don't know what that endpoint is for or what uses it so I'll leave that to your discretion.

port: 9090
protocol: TCP
targetPort: 9090
loadBalancerIP: [fill this in]
Copy link
Member

Choose a reason for hiding this comment

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

Will this dummy value cause problems? (i.e. do we need to emit the field entirely until we have a valid value?)

Copy link
Member Author

Choose a reason for hiding this comment

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

right, I don't intend to submit this until we've reserved an IP address. I can do that, assuming there's consensus that this is a good idea.

@@ -9,7 +9,8 @@ stringData:
metrics_path: /metrics
static_configs:
- targets:
- "104.197.27.114"
- "104.197.27.114:9090" # boskos resource metrics
- "fillmein-boskos-http-metrics:9090" # boskos http metrics
Copy link
Member

Choose a reason for hiding this comment

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

We should probably wait to add this until we have a valid value to avoid failing scrapes.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 23, 2020
@ixdy ixdy force-pushed the boskos-http-metrics branch from 29dedc1 to 4aa98b4 Compare January 23, 2020 20:29
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 23, 2020
Copy link
Member

@cjwagner cjwagner left a comment

Choose a reason for hiding this comment

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

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 23, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cjwagner, ixdy

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ixdy
Copy link
Member Author

ixdy commented Jan 23, 2020

/hold cancel
👀

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 23, 2020
@k8s-ci-robot k8s-ci-robot merged commit 07c989f into kubernetes:master Jan 23, 2020
@k8s-ci-robot k8s-ci-robot added this to the v1.18 milestone Jan 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/boskos Issues or PRs related to code in /boskos area/prow/bump Updates to the k8s prow cluster area/prow Issues or PRs related to prow cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants