Skip to content

Conversation

@axw
Copy link
Contributor

@axw axw commented Jul 31, 2025

Description

Deprecate the feature gate now that metric views can be configured.

Link to tracking issue

Fixes #13537

Testing

Verified that the flag is deprecated with otelcorecol featuregate and otelcorecol --feature-gates telemetry.disableHighCardinalityMetrics (the latter leads to an error, as expected for deprecated feature gates.)

Documentation

Added changelog

@axw axw requested a review from a team as a code owner July 31, 2025 09:48
@axw axw requested a review from jade-guiton-dd July 31, 2025 09:48
@codecov
Copy link

codecov bot commented Jul 31, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.04%. Comparing base (b4a7f4f) to head (e7223b3).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13538      +/-   ##
==========================================
+ Coverage   92.00%   92.04%   +0.03%     
==========================================
  Files         529      529              
  Lines       31454    31419      -35     
==========================================
- Hits        28939    28919      -20     
+ Misses       1987     1969      -18     
- Partials      528      531       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@axw axw changed the title Deprecate telemetry.disableHighCardinalityMetrics [service] Deprecate telemetry.disableHighCardinalityMetrics Jul 31, 2025
# Use pipe (|) for multiline entries.
subtext: |
The feature gate is now deprecated since metric views can be configured.
The gate will be removed in v1.40.0.
Copy link
Contributor

@jade-guiton-dd jade-guiton-dd Jul 31, 2025

Choose a reason for hiding this comment

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

So I'm having second thoughts about whether it's a good idea to deprecate this now. Yes, users can now configure metric views that do the same thing as the gate (and at the very least, we'll want to document how).

But because metric views are incompatible with level != detailed, users that were previously using the gate will also have to reproduce all the default level-based views set up in service.go. There was a proposal at one point for a Collector subcommand that lists the metric views for a given level to make this easier, but it hasn't been implemented. So that's a bit of a painful migration path, especially since I suspect users of the feature gate can't easily do without it (it would increase the cardinality of their metrics by a lot).

@jade-guiton-dd
Copy link
Contributor

jade-guiton-dd commented Jul 31, 2025

Looking into it, it might not actually have much of an impact to deprecate this feature flag without an easy migration path, because I think it might have broken a long time ago, and yet nobody complained...

Specifically, it remove the following attributes for gRPC instrumentation metrics:

  • net.sock.peer.addr
  • net.sock.peer.port
  • net.sock.peer.name

And the following from HTTP instrumentation metrics:

  • net.host.name
  • net.host.port

But:

  • this PR renamed those 3 gRPC attributes to follow a newer semantic convention
  • this PR made is so the old HTTP attributes are no longer emitted by default
  • this PR removes support for emitting the old attributes altogether (done by setting OTEL_SEMCONV_STABILITY_OPT_IN to http/dup)

The first two changes in the Collector have been since v0.128.0, and the third should be in the next go-contrib release.

(Unrelated note: we may want to ask for an authoritative list of metrics and attributes emitted by these instrumentations, having to dig through the code and the Git history every time is exhausting)

Now that the feature gate is deprecated it cannot be enabled,
so we can remove all references. Moreover, the view that was
excluding high cardinality attributes from otelhttp and otelgrpc
was broken, as the attributes were renamed in the instrumentation.
@axw
Copy link
Contributor Author

axw commented Aug 1, 2025

@jade-guiton-dd thanks for looking into that. I've confirmed through testing with the OTLP receiver that these attributes are not present in any metrics.

I went ahead and removed all references to the feature gate in the code, since deprecating means it cannot be enabled. The view for excluding those attributes is entirely removed, along with references to the attributes in tests.

@axw axw requested a review from jade-guiton-dd August 4, 2025 08:43
# Use pipe (|) for multiline entries.
subtext: |
The feature gate is now deprecated since metric views can be configured.
The gate will be removed in v0.134.0.
Copy link
Contributor

@jade-guiton-dd jade-guiton-dd Aug 4, 2025

Choose a reason for hiding this comment

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

So after discussing this in the maintainers call, I think the best way to handle this would be to say something to the effect of:

The metrics attributes removed by this feature gate are no longer emitted by the Collector by default, but if needed, you can achieve the same functionality by configuring the following metric views:

service:
  telemetry:
    metrics:
      views:
        - selector:
            meter_name: "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
          stream:
            attribute_keys:
              excluded: ["net.sock.peer.addr", "net.sock.peer.port", "net.sock.peer.name"]
        - selector:
            meter_name: "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
          stream:
            attribute_keys:
              excluded: ["net.host.name", "net.host.port"]

Note that this requires setting level: detailed. If you have a strong use case for using views in combination with a different level, please show your interest in this Collector issue.

This gives users who may still be relying on the feature gate something to work with, while allowing us to keep kicking #10769 down the road.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good, thanks - updated.

@axw axw requested a review from jade-guiton-dd August 5, 2025 00:55
Copy link
Contributor

@jade-guiton-dd jade-guiton-dd left a comment

Choose a reason for hiding this comment

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

LGTM

@jade-guiton-dd jade-guiton-dd added the ready-to-merge Code review completed; ready to merge by maintainers label Aug 5, 2025
@mx-psi mx-psi enabled auto-merge August 5, 2025 12:35
@mx-psi mx-psi added this pull request to the merge queue Aug 5, 2025
auto-merge was automatically disabled August 5, 2025 13:12

Pull Request is not mergeable

Merged via the queue into open-telemetry:main with commit 777be10 Aug 5, 2025
57 checks passed
@axw axw deleted the service-deprecate-featuregate branch August 6, 2025 01:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Code review completed; ready to merge by maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deprecate the telemetry.disableHighCardinalityMetrics feature gate

3 participants