-
Notifications
You must be signed in to change notification settings - Fork 92
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
ref(spans): List metric tags explicitly #2834
Merged
Merged
Conversation
This file contains 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
jjbayer
commented
Dec 12, 2023
Comment on lines
+338
to
+401
/// Builder for [`TagSpec`]. | ||
pub struct Tag { | ||
key: String, | ||
} | ||
|
||
impl Tag { | ||
/// Prepares a tag with a given tag name. | ||
pub fn with_key(key: impl Into<String>) -> Self { | ||
Self { key: key.into() } | ||
} | ||
|
||
/// Defines the field from which the tag value gets its data. | ||
pub fn from_field(self, field_name: impl Into<String>) -> TagWithSource { | ||
let Self { key } = self; | ||
TagWithSource { | ||
key, | ||
field: Some(field_name.into()), | ||
value: None, | ||
} | ||
} | ||
|
||
/// Defines what value to set for a tag. | ||
pub fn with_value(self, value: impl Into<String>) -> TagWithSource { | ||
let Self { key } = self; | ||
TagWithSource { | ||
key, | ||
field: None, | ||
value: Some(value.into()), | ||
} | ||
} | ||
} | ||
|
||
/// Intermediate result of the tag spec builder. | ||
/// | ||
/// Can be transformed into `[TagSpec]`. | ||
pub struct TagWithSource { | ||
key: String, | ||
field: Option<String>, | ||
value: Option<String>, | ||
} | ||
|
||
impl TagWithSource { | ||
/// Defines a tag that is extracted unconditionally. | ||
pub fn always(self) -> TagSpec { | ||
let Self { key, field, value } = self; | ||
TagSpec { | ||
key, | ||
field, | ||
value, | ||
condition: None, | ||
} | ||
} | ||
|
||
/// Defines a tag that is extracted under the given condition. | ||
pub fn when(self, condition: RuleCondition) -> TagSpec { | ||
let Self { key, field, value } = self; | ||
TagSpec { | ||
key, | ||
field, | ||
value, | ||
condition: Some(condition), | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are just helpers to build a TagSpec
in code.
olksdr
approved these changes
Dec 12, 2023
jan-auer
added a commit
that referenced
this pull request
Dec 19, 2023
* master: (35 commits) fix(spans): Parse quotes in MySQL (#2846) ref(cardinality): Use a Lua script and in-memory cache for the cardinality limiter (#2849) fix(spans): Detect hex with fallback scrubber (#2868) release: 23.12.0 Revert "ci: Update upload-artifact and download-artifact actions" (#2866) Revert "build: Update axum and http" (#2863) feat(spans): Allow resource.img spans (#2855) build: Update axum and http (#2844) fix(build): Add additional dependencies to the release build (#2858) ci: Update upload-artifact and download-artifact actions (#2861) feat(spans): Parse timestamps from strings (#2857) fix(spans): Scrub integer file extensions (#2856) feat(spans): Remove unused transaction tag from resource metrics (#2853) ref(cardinality): Recover buckets on cardinality limiter failure (#2852) feat(server): Org rate limit per metric bucket (#2836) ref(spans): List metric tags explicitly (#2834) feat(spans): Resource response sizes as measurements (#2845) feat(crons): Add thresholds to monitor config payload (#2842) feat(spans): Allow ingestion of metrics summary on spans (#2823) ref(crons): Add documentation to CheckInMessageType (#2840) ...
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.
List every tag for every metric explicitly. This nonfunctional change is the first step towards more selective tagging (tag only when you need it, and only on the metrics that actually need it).
ref: https://github.com/getsentry/team-ingest/issues/252
#skip-changelog