Skip to content

Conversation

@joaopaulovieira
Copy link
Member

Changes

1. Request Struct Enhancements

  • Added a new field: additionalAttrs map[string]string to the Request struct.
  • Added the method SetMetricsAttrs(attrs map[string]string) *Request to allow setting custom metric attributes for a request.

2. Metrics Propagation Logic

  • In the Execute method of Request, the attributes set via SetMetricsAttrs are now propagated to the metrics logic.
  • The registerMetrics function signature was updated to accept additionalAttrs as a parameter.
  • The attributes are now correctly passed to IncrCounterWithAttrs, ensuring custom attributes are included in metrics.

Motivation

  • These changes improve the flexibility of metrics collection by allowing custom attributes to be attached to each request and ensuring they are included in all relevant metrics operations.

How to Test

  • Run the test suite (go test ./...).
  • Ensure that TestSetMetricsAttrs_PropagatesToMetrics passes and that metrics attributes are correctly propagated.

@joaopaulovieira joaopaulovieira force-pushed the additional-attrs-counter-metrics branch from e512bb7 to e9263e2 Compare January 30, 2026 18:40
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