Skip to content

Conversation

@lwc
Copy link

@lwc lwc commented Jan 20, 2026

Recreating this from a branch so I can update the module path on my fork.

This allows folks to customise the operation name attribute sent on metrics.

The signature is the same as the SpanNameFormatter, so the same function could be used for both, which is probably generally desirable.

Potentially so desirable, that we could avoid the second config option and always do this, but this has better BC.

@lwc lwc requested a review from XSAM as a code owner January 20, 2026 11:11
Copy link
Owner

@XSAM XSAM left a comment

Choose a reason for hiding this comment

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

@lwc, thanks for the PR. Please update CHANGELOG.md to reflect this feature.

type InstrumentErrorAttributesGetter func(err error) []attribute.KeyValue

// OperationNameSetter allows controlling the operation name provided to metric instruments.
type OperationNameSetter func(ctx context.Context, method Method, query string) string
Copy link
Owner

Choose a reason for hiding this comment

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

Could we use OperationNameFormatter to align with the naming of SpanNameFormatter?

I also think this method can be used for spans.

@XSAM XSAM added this to the v0.42.0 milestone Jan 22, 2026
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 this pull request may close these issues.

2 participants