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

include a flag to disable metric prefixes #2198

Closed
wants to merge 1 commit into from

Conversation

dprotaso
Copy link
Member

@dprotaso dprotaso commented Jul 22, 2021

the default continues to include the prefix

Part of: #2174

the default continues to include the prefix
@google-cla google-cla bot added the cla: yes Indicates the PR's author has signed the CLA. label Jul 22, 2021
@knative-prow-robot knative-prow-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jul 22, 2021
@dprotaso dprotaso changed the title include a flag to disable metric prefixes the default continues to include the prefix include a flag to disable metric prefixes Jul 22, 2021
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dprotaso

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-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 22, 2021
@codecov
Copy link

codecov bot commented Jul 22, 2021

Codecov Report

Merging #2198 (ad7ef27) into main (d9b7180) will increase coverage by 0.01%.
The diff coverage is 88.23%.

@@            Coverage Diff             @@
##             main    #2198      +/-   ##
==========================================
+ Coverage   65.98%   65.99%   +0.01%     
==========================================
  Files         220      220              
  Lines        9204     9213       +9     
==========================================
+ Hits         6073     6080       +7     
- Misses       2859     2860       +1     
- Partials      272      273       +1     
Impacted Files Coverage Δ
metrics/config.go 76.69% <50.00%> (-1.08%) ⬇️
metrics/config_observability.go 92.59% <100.00%> (+0.59%) ⬆️
metrics/opencensus_exporter.go 65.90% <100.00%> (ø)
metrics/prometheus_exporter.go 90.32% <100.00%> (+1.03%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d9b7180...ad7ef27. Read the comment docs.

@dprotaso
Copy link
Member Author

/assign @skonto @evankanderson @upodroid

@dprotaso
Copy link
Member Author

I'm going to get rid of that downstream serving test that tests logic that exists in knative.dev/pkg

@dprotaso
Copy link
Member Author

/hold

@knative-prow-robot knative-prow-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 22, 2021
@dprotaso
Copy link
Member Author

/hold cancel
ok done: knative/serving#11711

@knative-prow-robot knative-prow-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 22, 2021
// When enabled:
// - OpenCensus exporter prefixes the domain and component
// - Prometheus exporter prefixes the component name (as a prom namespace)
EnableDeprecatedMetricPrefix bool
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this is a breaking change and I see there is a plan here for mirgation, next question would be if there is a plan for removing this flag or users should just keep this flag on.

Copy link
Member Author

Choose a reason for hiding this comment

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

Probably worth surfacing this topic on the thread.

e, err := prom.NewExporter(prom.Options{Namespace: config.component})
opts := prom.Options{}
if config.enableDeprecatedMetricPrefix {
opts.Namespace = config.component
Copy link
Contributor

@skonto skonto Jul 26, 2021

Choose a reason for hiding this comment

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

Why we set the Namespace to be equal to a component name here (just curious)?

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 the legacy behaviour - which I want to preserve with this flag

@dprotaso
Copy link
Member Author

bump @skonto @evankanderson

@evankanderson
Copy link
Member

/assign @MontyCarter

I think Monty already said that this wouldn't mess up Google, so I'm all in favor.

@skonto
Copy link
Contributor

skonto commented Sep 2, 2021

@dprotaso I am fine with this as long as there is an option to define the component name etc.
Right now for metrics like source_name_event_count ambiguity/conflict will be created when all metrics will be gathered at the Prometheus side if we completely remove the prefix. So the flag/prefix combination is useful otherwise we will have to find some other way to distinguish metrics eg. add a label or something.

/lgtm

hold for @MontyCarter

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 2, 2021
@skonto
Copy link
Contributor

skonto commented Sep 2, 2021

/hold

@knative-prow-robot knative-prow-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 2, 2021
@dprotaso
Copy link
Member Author

dprotaso commented Sep 2, 2021

Yeah the component name would have to move to a label. I'm just introducing this flag so folks can set it explicitly to true prior to us changing the default in the future

@MontyCarter
Copy link
Contributor

MontyCarter commented Sep 7, 2021

Thanks for confirming with us.

Sorry for the delay here. I've switched teams; you should probably update your contact on metrics to @ZhiminXiang.

With the ability to keep the legacy behavior in this PR:
/lgtm

Looking forward, Google has already switched to a collector based setup; metric name/label rewrites are no problem.

With regards to the component name, as long as this is available as a label, we can rewrite things in the collector config.

With regards to domain portion of MetricPrefix, our domain value changes with component. It really would be nice to retain the ability to read domain into the config and pipe that through to a label if we get rid of support for MetricPrefix.

Acceptable paths forward for us would include:

  • Keeping MetricsPrefix behavior as it is in this PR.
  • Retaining MetricsPrefix legacy behavior, but make the enableDeprecatedMetricPrefix default false (we must opt in).
  • Continuing to read domain and component into config, but passing these as labels instead.

@knative-prow-robot
Copy link
Contributor

@dprotaso: PR needs rebase.

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.

@knative-prow-robot knative-prow-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 23, 2021
@skonto
Copy link
Contributor

skonto commented Jan 28, 2022

@dprotaso gentle ping, been a while, planning to continue this?

@github-actions
Copy link
Contributor

This Pull Request is stale because it has been open for 90 days with
no activity. It will automatically close after 30 more days of
inactivity. Reopen with /reopen. Mark as fresh by adding the
comment /remove-lifecycle stale.

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 18, 2022
@github-actions github-actions bot closed this Aug 17, 2022
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. cla: yes Indicates the PR's author has signed the CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm Indicates that a PR is ready to be merged. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. 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.

6 participants