Skip to content

Commit

Permalink
Make container mapping public (#315)
Browse files Browse the repository at this point in the history
* Make container mapping public

* update issue nu

* update change type
  • Loading branch information
dineshg13 authored Apr 9, 2024
1 parent ba4072f commit 520c074
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
12 changes: 12 additions & 0 deletions .chloggen/dinesh.gurumurthy_make-container-mapping-public.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement
# The name of the component (e.g. pkg/quantile)
component: pkg/otlp/attributes
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Make container mapping public
# The PR related to this change
issues: [315]
# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:
8 changes: 4 additions & 4 deletions pkg/otlp/attributes/attributes.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ var (
conventions.AttributeServiceVersion: "version",
}

// containerMappings defines the mapping between OpenTelemetry semantic conventions
// ContainerMappings defines the mapping between OpenTelemetry semantic conventions
// and Datadog Agent conventions for containers.
containerMappings = map[string]string{
ContainerMappings = map[string]string{
// Containers
conventions.AttributeContainerID: "container_id",
conventions.AttributeContainerName: "container_name",
Expand Down Expand Up @@ -172,7 +172,7 @@ func ContainerTagsFromResourceAttributes(attrs pcommon.Map) map[string]string {
ddtags := make(map[string]string)
attrs.Range(func(key string, value pcommon.Value) bool {
// Semantic Conventions
if datadogKey, found := containerMappings[key]; found && value.Str() != "" {
if datadogKey, found := ContainerMappings[key]; found && value.Str() != "" {
ddtags[datadogKey] = value.Str()
}
// Custom (datadog.container.tag namespace)
Expand All @@ -196,7 +196,7 @@ func ContainerTagsFromResourceAttributes(attrs pcommon.Map) map[string]string {
func ContainerTagFromAttributes(attr map[string]string) map[string]string {
ddtags := make(map[string]string)
for key, val := range attr {
datadogKey, found := containerMappings[key]
datadogKey, found := ContainerMappings[key]
if !found {
continue
}
Expand Down

0 comments on commit 520c074

Please sign in to comment.