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

feat(metrics): Add option to send environment with every metric #517

Merged
merged 4 commits into from
Aug 18, 2021

Conversation

loewenheim
Copy link
Contributor

Analogous to #513.

Symbolicator obtains the environment from its Sentry client, which in turn determines it based on the SENTRY_ENVIRONMENT variable or the build config if that's not set.

This addresses https://getsentry.atlassian.net/browse/NATIVE-165.

@loewenheim loewenheim requested a review from a team August 6, 2021 11:31
Comment on lines 9 to 13
// Type aliases to make the definition of [`MetricsClient`] more readable.
type Hostname = String;
type HostnameTag = String;
type Environment = String;
type EnvironmentTag = String;
Copy link
Contributor

Choose a reason for hiding this comment

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

apologies if this ends up sounding being pretty pedantic.

from a readability standpoint, i get why this exists but i'm a little torn about it, because i'm left wondering a few things as a result of this:

  • can any string be one of these four types? are there any restrictions on the contents of these strings at all?
  • should you be able to use a Hostname as an Environment or HostnameTag or EnvironmentTag? you're not using a newtype here, but one of the nice perks of wrapping strings in newtypes is that it's hard to mix up different strings that represent or mean different things, ie you can't accidentally use an Environment as a Hostname.

i'm hesitant about the way we're softly baking these into the type system if it doesn't take advantage of the checking that the system provides.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've replaced the two dedicated tag/value pairs on MetricsClient with a BTreeMap. I believe that makes the everything both clearer and more robust.

@loewenheim loewenheim merged commit ca11a3a into master Aug 18, 2021
@loewenheim loewenheim deleted the feat/metrics-environment branch August 18, 2021 08:47
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.

3 participants