Expand metric instrument name allowed characters to support Windows performance counter names#5092
Conversation
|
Even many language runtimes do not have good support for supplementary planes, does this mean the SDKs targeting these runtimes are not compliant with the spec? |
dashpole
left a comment
There was a problem hiding this comment.
was originally chosen for Prometheus compatibility
This doesn't seem correct to me. The character set we chose for our SDKs wasn't compatible with Prometheus. OTel has always allow UTF-8 at the protocol level, which is why Prometheus expanded to UTF-8. Prometheus didn't particularly want to expand their character set, and still strongly recommends using the simpler character set.
I would rather we expand the character set to include characters as needed. But I would probably not want to have whitespace in names from SDKs.
Good point. Adopted the same convention as the |
|
You were right and my memory was probably wrong — I couldn't find any such discussion (Prometheus-compat or otherwise) in the original PR (#1557). On expanding incrementally: we've been doing this for years (#3422 added |
|
@dashpole @ywwg — you were right. Revalidated against current Prometheus (v3.11.3 with |
:, \) and allow non-alphabetic first character
|
Thanks @dashpole @reyang — taking the pivot. Reverted the broader UTF-8 / first-char relaxation. The PR is now scoped to exactly the specific characters that have come back in open issues ( |
|
@reyang following up on your "very strong opinion about ... spaces/separators" comment — would you elaborate specifically on space? Windows performance counter names rely heavily on space (e.g. I left |
I think at least we should be very clear that we don't want something like |
Got it. Yes I want to make sure Windows Perf Counters can be supported. It is a valid scenario. Give a thumbs up here if you agree, and then I'll rework the PR to adjust to it. (Yes agree with the idea of not opening the door without concrete scenario) |
|
Moving to draft while waiting to see if we are okay to relax restrictions to support Windows Perf Counters. |
…#48359) Follow-up to #48345. Removes the `strings.Repeat("a", 300)` case from the relaxed-instrument-name OTTL tests added in #48345. The 300-character test was scoped to demonstrate length tolerance, but the [forthcoming spec change](open-telemetry/opentelemetry-specification#5092) only relaxes the character set — the 255-character maximum is unchanged. The test was misleading about the scope of the spec change. Other relaxed-name cases (`:`, `\`, leading `-` / `.`, emoji, empty string) are kept. Test-only change.
Updated and ready for review now. Based on feedback from David and Reiley, we are not relaxing to support full UTF, but just enough where there is concrete demand (via previous issues, in particular about Windows Perf Counter names) Draft PRs in .NET and Rust implementing this proposed spec relaxation, to be un-drafted if this PR merges here: |
:, \) and allow non-alphabetic first character|
cc @jsuereth @jack-berg @jmacd — would appreciate your eyes on this. |
|
@cijothomas can you help me understand the intended use-case here? Are we adding official instrumentation and defining semantic conventions with names including these characters? Are we bridging these metrics from other systems? If we are bridging from other systems, the metric producer interface is probably the right way for these to be bridged, and has no naming restrictions. If we are planning to add these to semantic conventions, that doesn't seem like the right thing to do to me. I think there is a lot of value in keeping the character set of metric names used in instrumentation tighter, unless we have a very good reason to expand it. We did expand the list in the past to support migrating from OpenCensus. That made sense to me since providing a migration path from OpenCensus was part of our founding charter. I'm not as convinced that this case meets the bar. |
No plan of adding any instrumentation library, and not proposing any semantic-convention changes. Semantic conventions already have their own naming rules and (to my knowledge) none of them use any of The motivation is much narrower: we have users who want to migrate existing instrumentation to OTel, and the current OTel naming restriction is the only thing blocking them. Their existing names come from third-party Is there a specific aspect of the proposal that you find concerning? I want to make sure I'm understanding the worry correctly so I can address it? |
|
Wearing my Googler hat, Google would not be able to support the proposed character set today (it supports Wearing my OTel hat again, I don't think
The goal is for metrics from OTel instrumentation is generally to be compatible with all backends. When i've had similar naming discussions with internal teams at Google, my advice has been to migrate the instrumentation to use names that adhere to semantic convention guidelines, and use Views (which have no naming restrictions) to keep whatever existing names they need to use for backwards-compatibility. |
Using View to bypass instrument name restrictions is a new learning for me. The spec is not very explicit about that. In OTel .NET and Rust implementations, the new metric name one provides via View is subject to the same restriction as the instrument name. But Go and Java do not do it that way. Seems like the spec should clarify this to avoid such a big drift between language implementations. Should we first clarify the spec's intended behavior? I opened a PR to clarify spec: #5094 If that merges, then this PR can be closed.- we can fix .NET and Rust implementations, and then recommend users to bypass name restrictions by using views. |
…open-telemetry#48359) Follow-up to open-telemetry#48345. Removes the `strings.Repeat("a", 300)` case from the relaxed-instrument-name OTTL tests added in open-telemetry#48345. The 300-character test was scoped to demonstrate length tolerance, but the [forthcoming spec change](open-telemetry/opentelemetry-specification#5092) only relaxes the character set — the 255-character maximum is unchanged. The test was misleading about the scope of the spec change. Other relaxed-name cases (`:`, `\`, leading `-` / `.`, emoji, empty string) are kept. Test-only change.
Description
Expands the metric instrument name allowed character set to include
:,\,(,),%,*, and space, and drops the requirement that the first character be alphabetic. This enables Windows performance counter style names (e.g.\Processor(_Total)\% Processor Time). Closes #4736 (:), #4371 (leading non-alphabetic characters), and (alongside the spec change) makes open-telemetry/opentelemetry-rust#2527's experimental feature flag obsolete. Backwards-compatible: all currently valid names remain valid.Everything else stays as-is: ASCII-only, case-insensitive, maximum length 255 characters.
Motivation
Linked issues:
:.\Processor(_Total)\% Processor Time). The current spec forces SDKs to either reject these names or ship workarounds; OTel Rust shipped an unofficial Cargo feature flag (experimental_metrics_disable_name_validation) to bypass validation entirely. With this PR, the spec accepts the full Windows perf-counter name shape so the workaround can be retired.This PR addresses the specific characters that have been requested in open issues, rather than opening the door to arbitrary UTF-8. Per the SIG discussion on the earlier broader proposal (see comments in this PR), maintainers prefer expanding the allowlist over accepting any UTF-8.
Verifying impact on the OpenTelemetry Collector / OTTL
open-telemetry/opentelemetry-collector-contrib#48345 (merged) added unit tests confirming OTTL accepts arbitrary characters in
metric.name— so this PR's allowlist expansion has no impact on OTTL.