Skip to content

Add @BaggageKeyValue annotation for baggage scope management#1400

Open
stuartkemp-e wants to merge 2 commits into
micrometer-metrics:mainfrom
stuartkemp-e:baggage-annotation-feature
Open

Add @BaggageKeyValue annotation for baggage scope management#1400
stuartkemp-e wants to merge 2 commits into
micrometer-metrics:mainfrom
stuartkemp-e:baggage-annotation-feature

Conversation

@stuartkemp-e

Copy link
Copy Markdown

Addresses #1270.

Introduce @BaggageKeyValue parameter annotation that puts method argument values into baggage scope for the duration of the method execution. Baggage scopes are automatically closed on method completion, including on exception.

The annotation supports three resolution strategies with the following precedence: ValueResolver, expression, and toString() fallback. The 'value' and 'key' attributes control the baggage entry name.

Add BaggageKeyValueAnnotationHandler to process annotations and manage baggage scope lifecycle. Add a 5-arg ImperativeMethodInvocationProcessor constructor that accepts resolver and expression resolver providers, allowing both @SpanTag and @BaggageKeyValue to share the same providers.

Addresses micrometer-metrics#1270.

Introduce @BaggageKeyValue parameter annotation that puts method
argument values into baggage scope for the duration of the method
execution. Baggage scopes are automatically closed on method completion,
including on exception.

The annotation supports three resolution strategies with the following
precedence: ValueResolver, expression, and toString() fallback. The
'value' and 'key' attributes control the baggage entry name.

Add BaggageKeyValueAnnotationHandler to process annotations and manage
baggage scope lifecycle. Add a 5-arg ImperativeMethodInvocationProcessor
constructor that accepts resolver and expression resolver providers,
allowing both @SpanTag and @BaggageKeyValue to share the same providers.

Signed-off-by: Stuart Kemp <stuart.kemp@esure.com>
Signed-off-by: Stuart Kemp <stuart.kemp@esure.com>
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.

1 participant