-
Notifications
You must be signed in to change notification settings - Fork 134
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 support for DD_ENV, DD_SERVICE, and DD_VERSION environment variables #137
Add support for DD_ENV, DD_SERVICE, and DD_VERSION environment variables #137
Conversation
statsd/statsd.go
Outdated
parts := strings.Split(tag, ":") | ||
if len(parts) == 1 { | ||
c.Tags = append(c.Tags, parts[0]) | ||
} | ||
if len(parts) == 2 { | ||
c.Tags = append(c.Tags, fmt.Sprintf("%s:%s", parts[0], parts[1])) | ||
} |
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.
Why split ? What is the value of a tag contains :
?
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.
Good call, we do support :
in tag values.
I've updated the logic and test cases accordingly.
… for env, service, and version
88e94f5
to
9d27212
Compare
statsd/statsd.go
Outdated
// Client-side entity ID injection for container tagging | ||
/* | ||
Client-side entity ID injection for container tagging. | ||
*/ |
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.
No need to change the comment
statsd/statsd.go
Outdated
const ( | ||
entityIDEnvName = "DD_ENTITY_ID" | ||
entityIDTagName = "dd.internal.entity_id" | ||
) |
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.
I don't think we need to keep those variables around, we could hardcode them in the ddEnvTagsMapping
like the other ones.
This PR adds support for:
DD_ENV
DD_SERVICE
DD_VERSION
to be used by the statsd client at initialization. The first three are added as global tags for
{env, service, version}
, if they are set.