Skip to content

client: add support for iterating client metadata keys #12804

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

Closed
axw opened this issue Apr 7, 2025 · 0 comments · Fixed by #12805
Closed

client: add support for iterating client metadata keys #12804

axw opened this issue Apr 7, 2025 · 0 comments · Fixed by #12805

Comments

@axw
Copy link
Contributor

axw commented Apr 7, 2025

Component(s)

No response

Describe the issue you're reporting

The https://pkg.go.dev/go.opentelemetry.io/collector/client#Metadata type provides no means of iterating over the metadata keys -- you can only call Get with a known key. Being able to iterate the keys would be necessary to implement open-telemetry/opentelemetry-collector-contrib#39157, i.e. in order to obtain request.metadata, the full map of client metadata.

I propose adding a func (Metadata) Keys() iter.Seq[string] method that iterates over the metadata keys. See #12805.

axw added a commit to axw/opentelemetry-collector that referenced this issue Apr 7, 2025
Add support for discovering the client metadata keys.
At the moment it is only possible to get the values for a known key.

Closes open-telemetry#12804
github-merge-queue bot pushed a commit that referenced this issue Apr 10, 2025
#### Description

Add support for iterating over the client metadata keys.

At the moment it is only possible to get the values for a known key,
which makes it impossible to inspect metadata keys without prior
knowledge of all possible keys, e.g. as described in
open-telemetry/opentelemetry-collector-contrib#39157.

#### Link to tracking issue

Closes
#12804

#### Testing

Trivial addition, added unit tests.

#### Documentation

N/A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant