Skip to content

Queue Prometheous Exporter - #2358

Merged
josephburnett merged 38 commits into
knative:masterfrom
mrmcmuffinz:queue-prom-exp-2202
Nov 28, 2018
Merged

josephburnett merged 38 commits into
knative:masterfrom
mrmcmuffinz:queue-prom-exp-2202

Conversation

@mrmcmuffinz

@mrmcmuffinz mrmcmuffinz commented Oct 31, 2018 •

Copy link
Copy Markdown
Contributor

Fixes #2202.

Proposed Changes:

Adding prometheus metrics exporter.

curl -i -XGET 172.30.6.243:9090/metrics
HTTP/1.1 200 OK
Content-Length: 817
Content-Type: text/plain; version=0.0.4
Date: Tue, 20 Nov 2018 02:12:03 GMT

# HELP queue_average_concurrent_requests Number of requests currently being handled by this pod
# TYPE queue_average_concurrent_requests gauge
queue_average_concurrent_requests{destination_configuration="helloworld-go",destination_namespace="default",destination_revision="helloworld-go-00001"} 0
# HELP queue_lame_duck Indicates this Pod has received a shutdown signal with 1 else 0
# TYPE queue_lame_duck gauge
queue_lame_duck{destination_configuration="helloworld-go",destination_namespace="default",destination_revision="helloworld-go-00001"} 0
# HELP queue_operations_per_second Number of requests received since last Stat
# TYPE queue_operations_per_second gauge
queue_operations_per_second{destination_configuration="helloworld-go",destination_namespace="default",destination_revision="helloworld-go-00001"} 0

@knative-prow-robot knative-prow-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 31, 2018
@googlebot

Copy link
Copy Markdown

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

@knative-prow-robot knative-prow-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Oct 31, 2018

@knative-prow-robot knative-prow-robot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@mrmcmuffinz: 1 warning.

Details

In response to this:

Fixes #2202, this code is dependent on PR #2337.

Proposed Changes:

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.

Comment thread pkg/metrics/config.go Resolved
@knative-prow-robot knative-prow-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Oct 31, 2018
@knative-prow-robot knative-prow-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Oct 31, 2018
@mrmcmuffinz mrmcmuffinz reopened this Oct 31, 2018
@knative-prow-robot knative-prow-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Oct 31, 2018
@googlebot

Copy link
Copy Markdown

CLAs look good, thanks!

@knative-prow-robot knative-prow-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 1, 2018
Comment thread pkg/queue/stats_reporter.go Resolved

@markusthoemmes markusthoemmes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey great! 👍 All the TODOs are gone and it looks quite clean now 🎉 ! Left a few comments to maybe clean up some edges. Definitely getting there :)

Comment thread cmd/queue/main.go Resolved
Comment thread cmd/queue/main.go Resolved
Comment thread pkg/queue/stats_reporter.go Resolved
@mrmcmuffinz mrmcmuffinz changed the title Queue Prometheous Exporter [WIP] Queue Prometheous Exporter Nov 20, 2018
@knative-prow-robot knative-prow-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 20, 2018

@josephburnett josephburnett left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

/lgtm

This is looking good! Holding approval until unit tests are added.

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 20, 2018
@knative-prow-robot knative-prow-robot removed the lgtm Indicates that a PR is ready to be merged. label Nov 21, 2018
@mrmcmuffinz mrmcmuffinz changed the title [WIP] Queue Prometheous Exporter Queue Prometheous Exporter Nov 28, 2018
@knative-prow-robot knative-prow-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 28, 2018

@markusthoemmes markusthoemmes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think the remainder of my comments are pure code hygiene. Great job with the tests 🎉

Comment thread pkg/queue/stats_reporter_test.go Resolved
Comment thread pkg/queue/stats_reporter_test.go Resolved
"",
config,
revision,
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do you mind adding the keys for the values to the test-instances? Gives more inline context when scrolling through.

Comment thread cmd/queue/main.go Resolved
Comment thread cmd/queue/main.go

// TODO(mattmoor): Move this key to be in terms of the KPA.
servingRevisionKey = autoscaler.NewKpaKey(servingNamespace, servingRevision)
health = &healthServer{alive: true}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Any reason to move this here? Seems leftover from refactoring?

@mrmcmuffinz mrmcmuffinz Nov 28, 2018 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It did not make sense to keep it where it was based on the flow of the code. With the exception of the global channels a lot of the globals were initialized in initEnv...

Comment thread cmd/queue/main.go
if err != nil {
logger.Fatal("Failed to create stats reporter", zap.Error(err))
}
reporter = _reporter

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should this be moved down into main, closer to the initialization of the exporter endpoint, to have it all packed in one place?

I think the initEnv function is supposed to read environment values into globals.

@mrmcmuffinz mrmcmuffinz Nov 28, 2018 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It needs to be initialized before the healthServer exporter is used due to the dependency it has on reporting now. And I see no indication on what initEnv should be used for by this I mean I can initialization happening in there that is not related to environment values...

Comment thread cmd/queue/main.go Resolved
@knative-metrics-robot

Copy link
Copy Markdown

The following is the coverage report on pkg/.
Say /test pull-knative-serving-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/queue/stats_reporter.go Do not exist 87.8%

@markusthoemmes

Copy link
Copy Markdown
Contributor

Given the rest of my comments come down to taste of where to put things.

/lgtm

I'll leave to @josephburnett to approve since he wanted to take a look earlier. Thanks for all your work @mrmcmuffinz

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 28, 2018

@josephburnett josephburnett left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

/lgtm
/approve

Nice work!

@knative-prow-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: josephburnett, mrmcmuffinz

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

The pull request process is described here

Details 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

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 28, 2018
@josephburnett
josephburnett merged commit 9ac07d3 into knative:master Nov 28, 2018
vagababov pushed a commit to vagababov/serving that referenced this pull request Nov 30, 2018
* chg: dev: added initial prometheus exporter code.

Signed-off-by: [email protected] <[email protected]>

* new: dev: added status reporter file for queue reporting of prometheus metrics and relocated some code from queue main to here.

Signed-off-by: [email protected] <[email protected]>

* chd: dev: relocated some code out of queue main and added a few todos.

Signed-off-by: [email protected] <[email protected]>

* chg: dev: added report function for promethus reporter and hooked it up into the NewStats function.

Signed-off-by: [email protected] <[email protected]>

* new: dev: moved healthServer to its own file.

Signed-off-by: [email protected] <[email protected]>

* chg: dev: relocated healthServer.

Signed-off-by: [email protected] <[email protected]>

* chg: dev: added in other stat reporters.

Signed-off-by: [email protected] <[email protected]>

* chg: dev: fixed function calls to use exported names.

Signed-off-by: [email protected] <[email protected]>

* chg: dev: bug fixes.

Signed-off-by: [email protected] <[email protected]>

* chg: test: fixes for queue tests.

Signed-off-by: [email protected] <[email protected]>

* chg: doc: updated some comments.

Signed-off-by: [email protected] <[email protected]>

* chg: dev: added back the context tags for the prometheus exporter and moved the initialization out of the Report function.

* chg: dev: removed some debugging code.

Signed-off-by: [email protected] <[email protected]>

* chg: dev: fixed a few bugs in tests, propagated the tags down to the Reporter and did some cleanup of code.

Signed-off-by: [email protected] <[email protected]>

* chg: dev: addressing reviewing comments.

Signed-off-by: [email protected] <[email protected]>

* chg: dev: added todo per @josephburnett.

Signed-off-by: [email protected] <[email protected]>

* chg: dev: reverting refactor.

Signed-off-by: [email protected] <[email protected]>

* chg: dev: reverting some changes.

Signed-off-by: [email protected] <[email protected]>

* chg: dev: bug fixes after merging.

Signed-off-by: [email protected] <[email protected]>

* chg: dev: removed some stale todo comments.

Signed-off-by: [email protected] <[email protected]>

* chg: dev: moved reporter responsible logic into reporter method.

Signed-off-by: [email protected] <[email protected]>

* chg: dev: fixed typo.

Signed-off-by: [email protected] <[email protected]>

* chg: dev: relocated reporter from healthServer to global variable.

Signed-off-by: [email protected] <[email protected]>

* chg: dev: added defensive code and unregister functionality for views.

Signed-off-by: [email protected] <[email protected]>

* new: test: initial take on stats_reporter.go tests.

Signed-off-by: [email protected] <[email protected]>

* chg: test: expanded testing coverage.

Signed-off-by: [email protected] <[email protected]>

* chg: dev: removed reporter from healthServer.

Signed-off-by: [email protected] <[email protected]>

* chg: dev: comment typo fix.

Signed-off-by: [email protected] <[email protected]>
markusthoemmes added a commit to markusthoemmes/knative-serving that referenced this pull request Nov 30, 2018
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. lgtm Indicates that a PR is ready to be merged. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants