-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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 metadata fetching when metrics differ by trimmable suffixes #6932
Conversation
f29797f
to
32a4474
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @dashpole for finding and fixing this!
For python_gc_objects_collected_total
, when adding some debug lines I still see the mc.Metadata(metricName)
lookup fail unless it's only looking for python_gc_objects_collected
, even though the #TYPE
and #HELP
hints include _total
:
https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/32a4474c8031da873b8d48ef793c5bb93cf0a878/receiver/prometheusreceiver/internal/metricfamily.go#L48 I am still not sure why it behaves like that for the default python counters...
However the metric is still sent with these changes since it then follows this code path: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/32a4474c8031da873b8d48ef793c5bb93cf0a878/receiver/prometheusreceiver/internal/metricfamily.go#L57-L61
I think it'll be considered a gauge though instead of a counter because of: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/32a4474c8031da873b8d48ef793c5bb93cf0a878/receiver/prometheusreceiver/internal/metricsbuilder.go#L252-L253
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this is an improvement, but it would be good to address @gracewehner's point before merging.
Figured out what the discrepancy was from. I think the prometheus server (and thus, the otel collector) add openmetrics headers by default: https://github.com/prometheus/prometheus/blob/27343277fa47465e54799e2a0a5356febe697c29/scrape/scrape.go#L761. If I curl my python client with:
I'll make sure we can handle that case properly |
ocaMetricType := convToOCAMetricType(metadata.Type) | ||
|
||
// If a counter has a _total suffix but metadata is stored without it, keep _total suffix as the name otherwise | ||
// the metric sent won't have the suffix | ||
if ocaMetricType == metricspb.MetricDescriptor_CUMULATIVE_DOUBLE && strings.HasSuffix(metricName, metricSuffixTotal) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now i'm trying to figure out what to do with this... If metric metadata is sent without a type suffix, it would seem strange to add it here, but that is what the previous behavior was.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm keeping the current behavior for now, even though it seems strange to me.
@dashpole, once this is ready for another review, please notify @gracewehner as well. |
@gracewehner I think i've resolved your concern above. It now correctly handles the openmetrics case above |
* add elasticsearchexporter to the components exporter list * update elastic version * [exporter/kafka] Allow configuring the acknowledgement behaviour (open-telemetry#6301) * feat(exporter/kafka): allow configuring the acknowledgement behaviour * doc(exporter/kafka): add additional context to the RequiredAcks parameter * chore(exporter/kafka): validate RequiredAcks option * chore(container.image.name): add changelog entry * [mdatagen] Clarify some comments in metadata.yaml schema (open-telemetry#6976) * [receiver/k8scluster] Remove included tags (open-telemetry#6436) * feat(container.image.name): remove tags included in the name and introduce helper package * fix(container.image.name): use `` instead "" for regex * docs(Changelog): add changes * chore(container.image.name): rename function to ParseImageName * chore(container.image.name): add logging for parse failures * feat(container.image.name): use struct to encapsulate return value * feat(container.image): add sha256 field * chore(container.image.name): implement change requests * [internal/components] Add all extensions to lifecycle tests (open-telemetry#6934) * Adding all extensions to the lifecycle test * Updating test to use correct methods * [internal/components] Add all receivers to lifecycle tests (open-telemetry#6974) * Adding in existing receivers into the test suite * Making the receivers testable * Disabling windows test * Fixing windows tests * [receiver/influxdb] Update success write response code (open-telemetry#6530) * update influx success write response as 204 Signed-off-by: Jeeva Kandasamy <[email protected]> * update influx receiver readme Signed-off-by: Jeeva Kandasamy <[email protected]> * Update receiver/influxdbreceiver/README.md Co-authored-by: Juraci Paixão Kröhling <[email protected]> Co-authored-by: Juraci Paixão Kröhling <[email protected]> * [processor/routing] Fix wrong array config in example (open-telemetry#6984) ref: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/processor/routingprocessor/config.go#L29 * [exporter/skywalking] Add skywalking metrics exporter (open-telemetry#6528) * incorperate new elasticsearch version * [processor/deltatorate] Add int counter support (open-telemetry#6982) * processor/deltatorateprocessor: add int counter support (open-telemetry#6981) Signed-off-by: Jimmie Han <[email protected]> * simplify switch case Signed-off-by: Jimmie Han <[email protected]> * add changelog Signed-off-by: Jimmie Han <[email protected]> * switch case default return error Signed-off-by: Jimmie Han <[email protected]> * Update prometheus exec receiver build comments (open-telemetry#6911) * [exporter/loki] Log the first part of the http body on failed pushes to loki (open-telemetry#6946) * Log the first part of the http body on failed pushes to loki The body includes important information about the reason for the error. This is based on the promtail implementation https://github.com/grafana/loki/blob/bd1fef08a8ea99e73a30c4739cfeb931353700e6/clients/pkg/promtail/client/client.go#L390 * Add CHANGELOG entry * [receiver/windowsperfcounters] Change counters to perfcounters in documentation (open-telemetry#7001) * dependabot updates Tue Jan 4 08:08:07 PST 2022 (open-telemetry#7004) Bump github.com/shirou/gopsutil/v3 from 3.21.11 to 3.21.12 in /testbed Bump actions/setup-go from 2.1.4 to 2.1.5 Bump github.com/open-telemetry/opentelemetry-log-collection from 0.23.0 to 0.24.0 in /receiver/tcplogreceiver Bump github.com/shirou/gopsutil/v3 from 3.21.11 to 3.21.12 in /exporter/signalfxexporter Bump github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common from 1.0.316 to 1.0.323 in /exporter/tencentcloudlogserviceexporter Bump github.com/aws/aws-sdk-go from 1.42.23 to 1.42.25 in /receiver/awscontainerinsightreceiver Bump github.com/shirou/gopsutil/v3 from 3.21.11 to 3.21.12 in /extension/fluentbitextension Bump github.com/aws/aws-sdk-go from 1.42.23 to 1.42.25 in /exporter/datadogexporter Bump github.com/shirou/gopsutil/v3 from 3.21.11 to 3.21.12 in /extension/observer/hostobserver Bump github.com/open-telemetry/opentelemetry-log-collection from 0.23.0 to 0.24.0 in /receiver/journaldreceiver Bump github.com/open-telemetry/opentelemetry-log-collection from 0.23.0 to 0.24.0 in /receiver/syslogreceiver Bump github.com/open-telemetry/opentelemetry-log-collection from 0.23.0 to 0.24.0 in /receiver/filelogreceiver Bump github.com/open-telemetry/opentelemetry-log-collection from 0.23.0 to 0.24.0 in /internal/stanza Bump github.com/aws/aws-sdk-go from 1.42.23 to 1.42.25 in /processor/resourcedetectionprocessor Bump github.com/aws/aws-sdk-go from 1.42.23 to 1.42.25 in /exporter/awskinesisexporter Bump github.com/aws/aws-sdk-go from 1.42.23 to 1.42.25 in /exporter/awsemfexporter Bump github.com/aws/aws-sdk-go from 1.42.23 to 1.42.25 in /exporter/awsxrayexporter Bump github.com/aws/aws-sdk-go from 1.42.23 to 1.42.25 in /receiver/awsxrayreceiver Bump github.com/aws/aws-sdk-go from 1.42.23 to 1.42.25 in /internal/aws/awsutil Bump github.com/aws/aws-sdk-go from 1.42.23 to 1.42.25 in /internal/aws/xray Bump github.com/DataDog/agent-payload/v5 from 5.0.7 to 5.0.8 in /exporter/datadogexporter Bump github.com/DataDog/datadog-agent/pkg/quantile from 0.32.3 to 0.32.4 in /exporter/datadogexporter Bump github.com/getsentry/sentry-go from 0.11.0 to 0.12.0 in /exporter/sentryexporter Bump github.com/aws/aws-sdk-go from 1.42.23 to 1.42.25 in /internal/aws/xray/testdata/sampleapp * Add djaglowski as code owner on extention/storage/filestorage (open-telemetry#7018) * Bump actions/setup-go from 2.1.4 to 2.1.5 (open-telemetry#6953) Bumps [actions/setup-go](https://github.com/actions/setup-go) from 2.1.4 to 2.1.5. - [Release notes](https://github.com/actions/setup-go/releases) - [Commits](actions/setup-go@v2.1.4...v2.1.5) --- updated-dependencies: - dependency-name: actions/setup-go dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Add documentation for default values. (open-telemetry#7022) * Fix issue where zookeeper receiver could panic during shutdown. (open-telemetry#7020) When the zookeeper receiver is started, and then stopped before the scrape function is ever called, it does not yet have a cancel function to call. There was previously an expectation that this cancel function existed by the time shutdown was called. This change protects against the scenario where it does not yet exist. * dependabot updates Tue Jan 4 15:24:53 PST 2022 (open-telemetry#7024) Bump github.com/fluent/fluent-logger-golang from 1.8.0 to 1.9.0 in /testbed Bump github.com/aws/aws-sdk-go from 1.42.25 to 1.42.26 in /receiver/awscontainerinsightreceiver Bump github.com/aws/aws-sdk-go from 1.42.25 to 1.42.26 in /exporter/awsprometheusremotewriteexporter Bump github.com/aws/aws-sdk-go from 1.42.25 to 1.42.26 in /exporter/awskinesisexporter Bump github.com/aws/aws-sdk-go from 1.42.25 to 1.42.26 in /exporter/datadogexporter Bump github.com/aws/aws-sdk-go from 1.42.25 to 1.42.26 in /exporter/awsemfexporter Bump github.com/aws/aws-sdk-go from 1.42.25 to 1.42.26 in /exporter/awsxrayexporter Bump github.com/aws/aws-sdk-go from 1.42.25 to 1.42.26 in /receiver/awsxrayreceiver Bump github.com/aws/aws-sdk-go from 1.42.25 to 1.42.26 in /extension/observer/ecsobserver Bump github.com/aws/aws-sdk-go from 1.42.25 to 1.42.26 in /internal/aws/awsutil Bump github.com/aws/aws-sdk-go from 1.42.25 to 1.42.26 in /internal/aws/xray Bump github.com/aws/aws-sdk-go from 1.42.25 to 1.42.26 in /internal/aws/xray/testdata/sampleapp * fix: drop a metric if it has a staleness flag (open-telemetry#6977) * [receiver/redis] Set start timestamp uniformly for gauge and sum metrics (open-telemetry#6941) Currently start time of gauge metrics is set to 0. According to the specification https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/datamodel.md#gauge, start time should be set the timestamp when a metric collection system started. The time when redis server started is already being used for Sum metrics. There is no reason to keep it inconsistent. This change applies the same timestamp value to both Gauge and Sum metrics uniformly. * [receiver/couchdb] Implement client (open-telemetry#6880) * establish couchdb codebase * add in pr feedback * add couchdb client * clean up names/format * fix linting ci * add couchdbreceiver to verisons * update with pr feedback * establish couchdb codebase * add in pr feedback * clean up names/format * fix linting ci * add couchdbreceiver to verisons * remove host validation * fix nit * Update receiver/couchdbreceiver/README.md Co-authored-by: Daniel Jaglowski <[email protected]> * add check for default endpoint on CreateDefaultConfig * add missing receivers in versions * change Nodes struct to nodes * update client pr feedback * update changelog * update client tests w/ default config Co-authored-by: Daniel Jaglowski <[email protected]> * dependabot updates Wed Jan 5 09:37:36 PST 2022 (open-telemetry#7052) Bump go.uber.org/zap from 1.19.1 to 1.20.0 in /exporter/kafkaexporter Bump go.uber.org/zap from 1.19.1 to 1.20.0 in /exporter/awscloudwatchlogsexporter Bump go.uber.org/zap from 1.19.1 to 1.20.0 in /internal/aws/proxy Bump go.uber.org/zap from 1.19.1 to 1.20.0 in /internal/aws/k8s Bump github.com/aws/aws-sdk-go from 1.42.25 to 1.42.27 in /processor/resourcedetectionprocessor Bump github.com/aws/aws-sdk-go from 1.42.26 to 1.42.27 in /exporter/awskinesisexporter Bump github.com/aws/aws-sdk-go from 1.42.26 to 1.42.27 in /receiver/awscontainerinsightreceiver Bump github.com/aws/aws-sdk-go from 1.42.26 to 1.42.27 in /exporter/awsprometheusremotewriteexporter Bump github.com/aws/aws-sdk-go from 1.42.26 to 1.42.27 in /exporter/datadogexporter Bump github.com/aws/aws-sdk-go from 1.42.26 to 1.42.27 in /exporter/kafkaexporter Bump github.com/aws/aws-sdk-go from 1.42.26 to 1.42.27 in /exporter/awsemfexporter Bump github.com/aws/aws-sdk-go from 1.42.26 to 1.42.27 in /internal/aws/proxy Bump github.com/aws/aws-sdk-go from 1.42.26 to 1.42.27 in /extension/observer/ecsobserver Bump github.com/aws/aws-sdk-go from 1.42.26 to 1.42.27 in /exporter/awsxrayexporter Bump github.com/aws/aws-sdk-go from 1.42.26 to 1.42.27 in /exporter/awscloudwatchlogsexporter Bump github.com/aws/aws-sdk-go from 1.42.26 to 1.42.27 in /receiver/awsxrayreceiver Bump github.com/aws/aws-sdk-go from 1.42.26 to 1.42.27 in /internal/aws/k8s Bump github.com/aws/aws-sdk-go from 1.42.26 to 1.42.27 in /internal/aws/awsutil Bump github.com/aws/aws-sdk-go from 1.42.26 to 1.42.27 in /internal/aws/xray Bump github.com/aws/aws-sdk-go from 1.42.26 to 1.42.27 in /internal/aws/xray/testdata/sampleapp * fix metadata fetching when metrics have suffixes (open-telemetry#6932) * [receiver/prometheusexec] Remove keitwb as codeowner (open-telemetry#7003) * [receiver/prometheusexec] Remove keitwb as codeowner Signed-off-by: Juraci Paixão Kröhling <[email protected]> * Remove keitwb as codeowner of statsd Signed-off-by: Juraci Paixão Kröhling <[email protected]> * Add dmitryax to prom exec receiver and statsd Signed-off-by: Juraci Paixão Kröhling <[email protected]> * Bump github.com/go-playground/validator/v10 in /cmd/mdatagen (open-telemetry#7054) Bumps [github.com/go-playground/validator/v10](https://github.com/go-playground/validator) from 10.9.0 to 10.10.0. - [Release notes](https://github.com/go-playground/validator/releases) - [Commits](go-playground/validator@v10.9.0...v10.10.0) --- updated-dependencies: - dependency-name: github.com/go-playground/validator/v10 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * address logging issues (open-telemetry#7021) * address logging issues Adding a package to support sanitizing data consistently across components. The first method is `sanitize.URL` to address issues around logging URLs directly. * fix lint * fix impi * rename variable * disable docker_stats lifecycle for receivers test (open-telemetry#7056) * Update core to latest in preparation for this week release (open-telemetry#7057) Signed-off-by: Bogdan Drutu <[email protected]> * [receiver/prometheus] set pdata stale marker (open-telemetry#7043) * receiver/prometheus: set no-data-present flag when stale NaN found Signed-off-by: Anthony J Mirabella <[email protected]> * [exporter/signalfx] Don't use `syscall` to avoid compilation errors (open-telemetry#7062) syscall is deprecated and doesn't guarantee compatibility with all platforms. This change replaces usages of syscall with sys/unix package to avoid compilation errors on some specific platforms. * Organize replace directives in root and cmd/configschema go.mod's (open-telemetry#7067) This change is intended to have no effect, other than improving developer experience. * Fix prometheus job cache exiration by using the longest scrape interval (open-telemetry#7053) Co-authored-by: Bogdan Drutu <[email protected]> * Remove Owais Lone from the approvers' list (open-telemetry#7066) Owais is currently not able to allocate much time to the Collector. Thank you for your contributions, Owais. I hope to see you back when you have more time! * [receiver/elasticsearch] Implement Client (open-telemetry#7019) * implement Elasticsearch client * Add status to cluster health struct * add jvm uptime to nodestats * remove unused sample payload (for now) * Allow client to specify nodes to get stats from * add empty nodes check, add test for nil/empty nodes * go mod tidy * minor wording tweaks * add in max heap mem to nodestats model * changelog * fix lint errors * addlicense * re-order imports in client.go * make porto * add newline to sample health payload * fix disjoint client error handling * take in config struct for client creation * omitempty on IOStats * add header to request 7.x compatible response * take ownership of Prometheus exporters (open-telemetry#7068) Signed-off-by: Anthony J Mirabella <[email protected]> * [receiver/redis] Apply new mdatagen metrics builder (open-telemetry#6938) This change migrates redis receiver to use new mdatagen metrics builder. There is no functional change on the metrics output except for reordering. * Upgrade containerd to fix high severity security issue (open-telemetry#7069) Signed-off-by: Bogdan Drutu <[email protected]> * Update core deps to prepare for release (open-telemetry#7073) Signed-off-by: Anthony J Mirabella <[email protected]> * Prepare v0.42.0 release (open-telemetry#7074) * Update module version for v0.42.0 release * Update internal dependency versions Signed-off-by: Anthony J Mirabella <[email protected]> * [Datadog] Span naming option to use OTel semantic convention (open-telemetry#6611) * open-telemetry#1909 Added an option to use span name as datadog resource name. * open-telemetry#1909 - Added if statement to change the resource name in Datadog exporter. - Fixed tests * Added test case to the new option in datadog exporter. * open-telemetry#1909 Added readme description of the option. * open-telemetry#1909 Change configuration place. * open-telemetry#1909 Added option to config example. * Removed boolean option from function. Added test to cover option use. * Linted test code. * Added entry to changelog. * Update exporter/datadogexporter/example/config.yaml Co-authored-by: Alex Boten <[email protected]> * [processor/transform] Add skeleton for query language transform processor (open-telemetry#7047) * Query language transform processor * Tweak README * Fix imports * Setup PR1 * More details about span transformation * lint * Rename keep -> keep_keys * Traces conig * english * [cicd] stop publishing artifacts in this repo (open-telemetry#7083) The artifacts for collector contrib are now published in the releases repo: https://github.com/open-telemetry/opentelemetry-collector-releases. * Propose @dashpole as approver (open-telemetry#7088) Signed-off-by: Bogdan Drutu <[email protected]> * [receiver/couchdb] Define metrics (open-telemetry#6878) * establish couchdb codebase establish couchdb metadata metrics add metadata metrics update units establish couchdb codebase clean up names/format add couchdbreceiver to verisons remove host validation fix nit add check for default endpoint on CreateDefaultConfig add missing receivers in versions update versions end space update metadata pr feedback remove enum for http.method/status_code add code gen experimental tag, failed, bug issue made update metadata to include enable * update changelog * update metrics to value_type int * update nit changes * update metadata names * add view attribute * [receiver/fluentforward] Convert attributes with nil value to AttributeValueTypeEmpty (open-telemetry#6630) * [fluentforwardreceiver] Handle attributes with nil value Attributes with a nil value are currently being converted to the string "<nil>" Instead, they should be converted to AttributeValueTypeEmpty * Add CHANGELOG entry * dependabot updates Fri Jan 7 13:55:57 PST 2022 (open-telemetry#7111) Bump github.com/honeycombio/libhoney-go from 1.15.6 to 1.15.8 in /exporter/honeycombexporter Bump cloud.google.com/go from 0.99.0 to 0.100.2 in /processor/resourcedetectionprocessor Bump google.golang.org/api from 0.63.0 to 0.64.0 in /exporter/googlecloudexporter Bump google.golang.org/api from 0.63.0 to 0.64.0 in /exporter/f5cloudexporter Bump google.golang.org/api from 0.63.0 to 0.64.0 in /receiver/googlecloudspannerreceiver Bump github.com/aws/aws-sdk-go from 1.42.27 to 1.42.30 in /receiver/awscontainerinsightreceiver Bump github.com/aws/aws-sdk-go from 1.42.27 to 1.42.30 in /processor/resourcedetectionprocessor Bump github.com/aws/aws-sdk-go from 1.42.27 to 1.42.30 in /exporter/kafkaexporter Bump github.com/aws/aws-sdk-go from 1.42.27 to 1.42.30 in /exporter/awskinesisexporter Bump github.com/aws/aws-sdk-go from 1.42.27 to 1.42.30 in /exporter/awsprometheusremotewriteexporter Bump github.com/aws/aws-sdk-go from 1.42.27 to 1.42.30 in /receiver/awsxrayreceiver Bump github.com/aws/aws-sdk-go from 1.42.27 to 1.42.30 in /exporter/datadogexporter Bump github.com/aws/aws-sdk-go from 1.42.27 to 1.42.30 in /exporter/awscloudwatchlogsexporter Bump cloud.google.com/go/spanner from 1.28.0 to 1.29.0 in /receiver/googlecloudspannerreceiver Bump github.com/aws/aws-sdk-go from 1.42.27 to 1.42.30 in /exporter/awsemfexporter Bump github.com/aws/aws-sdk-go from 1.42.27 to 1.42.30 in /extension/observer/ecsobserver Bump github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common from 1.0.323 to 1.0.326 in /exporter/tencentcloudlogserviceexporter Bump github.com/aws/aws-sdk-go from 1.42.27 to 1.42.30 in /internal/aws/proxy Bump github.com/aws/aws-sdk-go from 1.42.27 to 1.42.30 in /exporter/awsxrayexporter Bump github.com/aws/aws-sdk-go from 1.42.27 to 1.42.30 in /internal/aws/k8s Bump github.com/aws/aws-sdk-go from 1.42.27 to 1.42.30 in /internal/aws/xray Bump github.com/aws/aws-sdk-go from 1.42.27 to 1.42.30 in /internal/aws/awsutil Bump github.com/aws/aws-sdk-go from 1.42.27 to 1.42.30 in /internal/aws/xray/testdata/sampleapp Co-authored-by: Sebastian Poxhofer <[email protected]> Co-authored-by: Dmitrii Anoshin <[email protected]> Co-authored-by: Sean Marciniak <[email protected]> Co-authored-by: Jeeva Kandasamy <[email protected]> Co-authored-by: Juraci Paixão Kröhling <[email protected]> Co-authored-by: Jared Tan <[email protected]> Co-authored-by: liqiangz <[email protected]> Co-authored-by: Jimmie Han <[email protected]> Co-authored-by: Mrod1598 <[email protected]> Co-authored-by: gregoryfranklin <[email protected]> Co-authored-by: Tamir Michaeli <[email protected]> Co-authored-by: Alex Boten <[email protected]> Co-authored-by: Daniel Jaglowski <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Hyunuk Lim <[email protected]> Co-authored-by: Jon <[email protected]> Co-authored-by: Daniel Jaglowski <[email protected]> Co-authored-by: David Ashpole <[email protected]> Co-authored-by: Juraci Paixão Kröhling <[email protected]> Co-authored-by: Ryan Fitzpatrick <[email protected]> Co-authored-by: Bogdan Drutu <[email protected]> Co-authored-by: Anthony Mirabella <[email protected]> Co-authored-by: Tigran Najaryan <[email protected]> Co-authored-by: Brandon Johnson <[email protected]> Co-authored-by: gfonseca-tc <[email protected]> Co-authored-by: Alex Boten <[email protected]> Co-authored-by: Anuraag Agrawal <[email protected]>
Description:
Fix incorrect merging of metric metadata when metrics differ by trimmable suffixes. Additionally, remove unnecessary interfaces, and simplify the implementation of metadata fetching to make it more readable.
To fix the bug, first always check for metadata using the original metricName first. We need to do this both when looking up the metric family (in metricsbuilder.go), and when looking up metadata when constructing the initial metric family. Second, add the
includesMetric()
function to metricFamily, which ensures that we only merge metrics under types that include multiple series. For example, if there is an existing familymy_metric
, which is a gauge, it does not include metricsmy_metric
+ suffix.To make the newMetricFamily function more readable, split out a
metadataForMetric
function, which is shared between pdata/opencensus implementations. This allows us to return early once we have found metadata for the metric, and reduces the number ofelse
statements (and nesting) needed to handle all cases correctly. Also, use a map to store internal metric metadata to avoid needing to recreate the same MetricMetadata frequently for internal metrics.Link to tracking Issue:
Fixes #6931
Testing:
As described in #6931, the comment prior to
python_gc_collections_total
isn't correct, so I added metadata forcounter_test_total
in the metadata table.I added metadata for
poor_name
to the testing metadata cash. Prior to the fixes in this PR, this would cause tests to fail by makingpoor_name_count
be incorrectly renamed topoor_name
and come out as a gauge.@Aneurysm9 @gracewehner