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

Fix metrics reporting period #14019

Merged
merged 2 commits into from
May 30, 2023
Merged

Fix metrics reporting period #14019

merged 2 commits into from
May 30, 2023

Conversation

skonto
Copy link
Contributor

@skonto skonto commented May 26, 2023

Fixes #12069

Proposed Changes

Release Note

Queue proxy metrics reporting period is now supported for both prometheus and opencensus.
This allows fine-grained control of how often metrics are exported via a new config map attribute.

@knative-prow knative-prow bot added area/API API objects and controllers area/autoscale area/networking size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 26, 2023
@knative-prow knative-prow bot requested review from jsanin-vmw and krsna-m May 26, 2023 16:25
@knative-prow knative-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 26, 2023
@skonto
Copy link
Contributor Author

skonto commented May 26, 2023

/assign @dprotaso

metrics.BackendDestinationKey: backend,
"metrics.opencensus-address": collectorAddress,
metrics.BackendDestinationKey: backend,
"metrics.opencensus-address": collectorAddress,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need to make constants public at the knative/pkg repo to avoid hardcoding values. Will fix in another PR.

metrics.request-metrics-reporting-period-seconds: "10"

# metrics.opencensus-address specifies the metrics collector address. Metrics are shiped using the opencensus format.
metrics.opencensus-address: "otel-collector.default.svc:55678"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This leaks the implementation detail (opencensus). It is better to have it as a reminder to change the name later on than hiding this option from the end user.

Copy link
Contributor Author

@skonto skonto May 26, 2023

Choose a reason for hiding this comment

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

Will add it in another PR, removing it for now.

@codecov
Copy link

codecov bot commented May 26, 2023

Codecov Report

Patch coverage: 37.50% and no project coverage change.

Comparison is base (35cfd8f) 86.21% compared to head (60c057a) 86.21%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #14019   +/-   ##
=======================================
  Coverage   86.21%   86.21%           
=======================================
  Files         199      199           
  Lines       14759    14763    +4     
=======================================
+ Hits        12724    12728    +4     
- Misses       1733     1734    +1     
+ Partials      302      301    -1     
Impacted Files Coverage Δ
pkg/queue/sharedmain/main.go 0.86% <0.00%> (-0.01%) ⬇️
pkg/reconciler/revision/resources/queue.go 98.23% <100.00%> (+0.01%) ⬆️

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@skonto skonto changed the title Fix reporting period Fix metrics reporting period May 26, 2023
@@ -144,6 +144,9 @@ var (
}, {
Name: "SERVING_REQUEST_METRICS_BACKEND",
Value: "",
}, {
Name: "SERVING_REQUEST_METRICS_REPORTING_PERIOD_SECONDS",
Value: "0",
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't this be a default value?

Copy link
Contributor Author

@skonto skonto May 29, 2023

Choose a reason for hiding this comment

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

Zero or negative value is translated by Opencensus to the default value which is 10s (imho it is implicit, implementation specific and it is better to have an explicit value per case). Here we have the default of 5sec for Prometheus and 60sec for Opencensus (this is taken from knative/pkg constants). They can be changed in the future if we feel that some other values work better in practice.

@dprotaso
Copy link
Member

/lgtm
/approve

@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label May 29, 2023
@knative-prow
Copy link

knative-prow bot commented May 29, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dprotaso, skonto

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

@knative-prow knative-prow bot merged commit c91f8c4 into knative:main May 30, 2023
skonto added a commit to skonto/serving that referenced this pull request Oct 5, 2023
* fix reporting period

* fixes
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/API API objects and controllers area/autoscale area/networking lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

queue-proxy does not appear to flush metrics on shutdown
2 participants