Allow additional (custom) tags in HTTP events#259
Open
aj-foster wants to merge 2 commits intoakoutmos:masterfrom
Open
Allow additional (custom) tags in HTTP events#259aj-foster wants to merge 2 commits intoakoutmos:masterfrom
aj-foster wants to merge 2 commits intoakoutmos:masterfrom
Conversation
This obviates the need for a helper function to set additional tag data on a connection struct.
|
Ayo, @akoutmos is there anything we can do to help move this forward? :) |
Owner
|
Hey there! Sorry I have been unresponsive as of late. Currently in the middle of a cross country move. I may be able to get to this next week when I have a functional office once again. |
|
@akoutmos if there's anyone who can't say anything about OSS maintainers being unresponsive then that's me as you well know 😅 😬 Have a good move and if you manage to take a look I'd appreciate it, but no worries whatsoever! I imagine such a move being quite involved and stressful - take care! 💚 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Change description
This PR allows users of the library to define
additional_tagsthat should be included in HTTP metrics from the Phoenix plugin.What problem does this solve?
Folks may wish to tag HTTP events with information other than the default tags (status, route, etc.). For example, someone might want to tag events with
authenticated="true"based on the authentication status of the request. While this kind of custom tagging can be abused, when used well, it can greatly improve one's ability to query the collected data.Example usage
First, configure the Phoenix plugin to look for additional tags:
Then, set data in the connection struct's private data using a matching prefixed key:
Additional details and screenshots
I initially implemented this PR in a way that required additional tags to be stored in a nested
:prom_exmap in the private connection data (you can see the first commit for that version). This made it difficult to store metadata, however, because callers would have to check for the existence of the:prom_exmap and either create it or merge data into it as appropriate. Using top-level interpolated keys solves this issue while still preventing naming collisions with other private data.Checklist