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

Add HTTP response to HttpServerMetricsTagsContributor.Context #45744

Merged
merged 2 commits into from
Jan 21, 2025

Conversation

geoand
Copy link
Contributor

@geoand geoand commented Jan 21, 2025

This is useful for creating tags based on HTTP response headers for example

Copy link

quarkus-bot bot commented Jan 21, 2025

/cc @brunobat (micrometer), @ebullient (micrometer)

Copy link
Member

@gsmet gsmet left a comment

Choose a reason for hiding this comment

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

It looks small enough to be a cool 3.18 addition given it was user-requested. I added the backport label, let's see how CI goes.

@geoand
Copy link
Contributor Author

geoand commented Jan 21, 2025

🙏🏽

Copy link
Contributor

@brunobat brunobat left a comment

Choose a reason for hiding this comment

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

I'm not sure about the feature and we need to document how to properly use it.

@@ -20,5 +21,7 @@ public interface HttpServerMetricsTagsContributor {

interface Context {
HttpServerRequest request();

HttpResponse response();
Copy link
Contributor

Choose a reason for hiding this comment

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

I have serious doubts about this. I think we are giving users a way to shoot their feet.
This can explode the cardinality and it should be accompanied by a documentation warning.
What do you think @ebullient ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How would they shoot theirselves in the foot more than what we already give them?

Choose a reason for hiding this comment

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

Data from the request can also explode the cardinality, yet it is included. I've already seen how improper usage of request headers explode the cardinality.

People need to be careful how they use the data from the request and response, so I think a warning in the documention would be a good idea 🙂.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

so I think a warning in the documention would be a good idea 🙂.

Definitely +1 for this.

Copy link
Contributor

Choose a reason for hiding this comment

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

We need to think in a broad case.
Server side will not have control over the response nor the different amount of values they are getting.
To be used safely, users should not just grab a field from the response but map it to a finite amount of values they control, otherwise there will be a cardinality explosion and in some cases OoM.
This is, most likely for debugging purposes and is the type of thing that should be placed on the request's trace, not metrics.

Copy link
Contributor

Choose a reason for hiding this comment

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

But if we document it, I'm fine.

Copy link
Member

Choose a reason for hiding this comment

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

Server side will not have control over the response

Could you clarify that? I would think you have more control on the response than on the request so I might be missing something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

PR updated

Copy link
Contributor

Choose a reason for hiding this comment

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

Server side will not have control over the response

Could you clarify that? I would think you have more control on the response than on the request so I might be missing something?

From the metrics system perspective there is not much control.

This comment has been minimized.

Copy link
Contributor

@brunobat brunobat left a comment

Choose a reason for hiding this comment

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

Thanks @geoand

@geoand
Copy link
Contributor Author

geoand commented Jan 21, 2025

🙏🏽

Copy link

github-actions bot commented Jan 21, 2025

🙈 The PR is closed and the preview is expired.

Copy link

quarkus-bot bot commented Jan 21, 2025

Status for workflow Quarkus Documentation CI

This is the status report for running Quarkus Documentation CI on commit bd0b5e1.

✅ The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.

Warning

There are other workflow runs running, you probably need to wait for their status before merging.

Copy link

quarkus-bot bot commented Jan 21, 2025

Status for workflow Quarkus CI

This is the status report for running Quarkus CI on commit bd0b5e1.

✅ The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.

You can consult the Develocity build scans.

@geoand geoand merged commit 77a710b into quarkusio:main Jan 21, 2025
32 checks passed
@quarkus-bot quarkus-bot bot added this to the 3.19 - main milestone Jan 21, 2025
@geoand geoand deleted the #45717 branch January 21, 2025 12:32
@quarkus-bot quarkus-bot bot added the kind/enhancement New feature or request label Jan 21, 2025
@gsmet gsmet modified the milestones: 3.19 - main, 3.18.0 Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add response to HttpServerMetricsTagsContributor.Context
4 participants