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 DD_VERSION environment variable #982

Merged
merged 8 commits into from
Mar 23, 2020
Merged

Conversation

delner
Copy link
Contributor

@delner delner commented Mar 20, 2020

To make it easier to tag traces with the application version, this pull request defines DD_VERSION which users can set, which will automatically:

  • Be set as a tag on all traces
  • Be set as a tag on all metrics
  • Be added as an attribute to Datadog::Correlation for logs correlation

This pull request also:

  • Adds conversion of OpenTelemetry's service.version tag to version accordingly
  • Fixes a bug where correlations for spans without context would not tag the environment.

@delner delner added core Involves Datadog core libraries feature Involves a product feature labels Mar 20, 2020
@delner delner added this to the 0.34.0 milestone Mar 20, 2020
@delner delner requested review from marcotc, brettlangdon and a team March 20, 2020 19:54
@delner delner self-assigned this Mar 20, 2020
@delner delner added this to In review in Active work Mar 20, 2020
str
end
end.freeze

NULL_IDENTIFIER = Identifier.new.freeze
Copy link
Contributor Author

@delner delner Mar 20, 2020

Choose a reason for hiding this comment

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

Because the env property of Identifier was being resolved at initialization time, this constant would resolve its env property to nil at load time (if DD_ENV wasn't set) and retain this value. Later, if users configured a different env within the Ruby application, this instance would not use the updated value as expected, but the original value.

marcotc
marcotc previously approved these changes Mar 23, 2020
Copy link
Member

@marcotc marcotc left a comment

Choose a reason for hiding this comment

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

Great work, looks clean and it was very easy to review. :shipit:

# or buffered by a whitespace character to delimit it.
def have_attribute(attribute)
match(/.*(?<=\A|\s)#{Regexp.escape(attribute)}(?=\z|\s).*/)
end
Copy link
Member

Choose a reason for hiding this comment

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

💯

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. Just realized I accidentally left in that greedy capture .* while experimenting with Regexp... needed to remove this.

@delner delner merged commit 21026d6 into master Mar 23, 2020
Active work automation moved this from In review to Merged & awaiting release Mar 23, 2020
@delner delner deleted the feature/add_version_env_var branch March 23, 2020 20:09
Copy link
Member

@brettlangdon brettlangdon left a comment

Choose a reason for hiding this comment

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

lgtm

@delner delner moved this from Merged & awaiting release to Released in Active work Mar 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Involves Datadog core libraries feature Involves a product feature
Projects
Active work
  
Released
Development

Successfully merging this pull request may close these issues.

None yet

3 participants