Skip to content
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

Response with request tags #1436

Closed
sergio-margale opened this issue May 9, 2022 · 3 comments · Fixed by #2401
Closed

Response with request tags #1436

sergio-margale opened this issue May 9, 2022 · 3 comments · Fixed by #2401

Comments

@sergio-margale
Copy link

In order to differentiate sttp prometheus metrics by external service I used to tag the request with the name of the external service, so then when creating the PrometheusBackend I could get the tag from the request and add it to the metric as a label.

my_service_sttp_requests_success_count_total{service="my_service", service_name="external-service-1"}
my_service_sttp_requests_success_count_total{service="my_service", service_name="external-service-2"}
...

Since 3.5.0 that's no longer possible for all metrics, as now responseToSuccessCounterMapper and responseToErrorCounterMapper are based on the Response.

Is there any plan to maybe add tags to the ResponseMetadata? Or is there maybe another way to achieve this?

@adamw
Copy link
Member

adamw commented May 9, 2022

Adding tags to Response would be tricky, but maybe we can extend RequestMetadata with tags so that Response.request would make it possible to read that. Maybe you'd like to attempt creating a PR?

@sergio-margale
Copy link
Author

Tbh, I'm not sure if I can do it anytime soon

@sergio-margale
Copy link
Author

I found 5 mins to at least do the first step :) softwaremill/sttp-model#189

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.

2 participants