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

ref(spans): List metric tags explicitly #2834

Merged
merged 7 commits into from
Dec 13, 2023
Merged

Conversation

jjbayer
Copy link
Member

@jjbayer jjbayer commented Dec 10, 2023

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

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),
}
}
}
Copy link
Member Author

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.

@jjbayer jjbayer marked this pull request as ready for review December 12, 2023 15:45
@jjbayer jjbayer requested a review from a team as a code owner December 12, 2023 15:45
@jjbayer jjbayer merged commit b3bfcbf into master Dec 13, 2023
22 checks passed
@jjbayer jjbayer deleted the ref/spans-metrics-flat branch December 13, 2023 10:38
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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants