Skip to content

[pkg/otlp/model] Backport translator changes#9789

Merged
mx-psi merged 2 commits intomainfrom
mx-psi/backport-otlp-changes
Nov 8, 2021
Merged

[pkg/otlp/model] Backport translator changes#9789
mx-psi merged 2 commits intomainfrom
mx-psi/backport-otlp-changes

Conversation

@mx-psi
Copy link
Copy Markdown
Member

@mx-psi mx-psi commented Nov 8, 2021

What does this PR do?

This PR backports two recent changes on the OpenTelemetry Collector Datadog exporter version of this module:

Motivation

Keep the two versions in sync until we can drop the code from the Datadog exporter side.

Additional Notes

To do this I copied the code from the main branch on the Collector and replaced the imports. diff between the translator code and the Collector translator code as of commit open-telemetry/opentelemetry-collector-contrib@e066c9c:

diff -u pkg/otlp/model/translator/metrics_translator.go /Users/pablo.baeyens/Source/otel/opentelemetry-collector-contrib/exporter/datadogexporter/internal/translator/metrics_translator.go
--- pkg/otlp/model/translator/metrics_translator.go     2021-11-08 13:18:11.000000000 +0100
+++ opentelemetry-collector-contrib/exporter/datadogexporter/internal/translator/metrics_translator.go 2021-11-08 13:16:32.000000000 +0100
@@ -24,9 +24,9 @@
        "go.opentelemetry.io/collector/model/pdata"
        "go.uber.org/zap"
 
-       "github.com/DataDog/datadog-agent/pkg/otlp/model/attributes"
-       "github.com/DataDog/datadog-agent/pkg/otlp/model/internal/instrumentationlibrary"
-       "github.com/DataDog/datadog-agent/pkg/otlp/model/internal/utils"
+       "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter/internal/attributes"
+       "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter/internal/instrumentationlibrary"
+       "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter/internal/translator/utils"
 )
 
 const metricName string = "metric name"
diff -u pkg/otlp/model/translator/metrics_translator_test.go /Users/pablo.baeyens/Source/otel/opentelemetry-collector-contrib/exporter/datadogexporter/internal/translator/metrics_translator_test.go
--- pkg/otlp/model/translator/metrics_translator_test.go        2021-11-08 13:18:11.000000000 +0100
+++ opentelemetry-collector-contrib/exporter/datadogexporter/internal/translator/metrics_translator_test.go    2021-11-08 13:16:32.000000000 +0100
@@ -30,7 +30,7 @@
        "go.uber.org/zap/zapcore"
        "go.uber.org/zap/zaptest/observer"
 
-       "github.com/DataDog/datadog-agent/pkg/otlp/model/attributes"
+       "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter/internal/attributes"
 )
 
 func TestGetTags(t *testing.T) {
Only in opentelemetry-collector-contrib/exporter/datadogexporter/internal/translator/: utils

Describe how to test your changes

To test open-telemetry/opentelemetry-collector-contrib#6120:

  1. Setup an OTLP-producing program that generates a cumulative histogram and a cumulative sum (e.g. with the Histogram and Counter instruments with default settings).
  2. Send a constant amount per collection period (e.g. increase the value by 10 on every collection period).
  3. Check that the graph on the Datadog's webapp looks constant
  4. Restart the application (but not the Agent); check that there are no spikes on the webapp graph.

One can also add a negative amount with the counters histogram mode and check that the sum is non 0.

open-telemetry/opentelemetry-collector-contrib#5885 doesn't need testing (only adds unit tests on this module)

Checklist

  • A release note has been added or the changelog/no-changelog label has been applied.
  • The need-change/operator and need-change/helm labels has been applied if applicable.
  • The appropriate team/.. label has been applied, if known.
  • If known, an appropriate milestone has been selected; otherwise the Triage milestone is set.
  • The config template has been updated if applicable.

Note: Adding GitHub labels is only possible for contributors with write access.

@mx-psi mx-psi force-pushed the mx-psi/backport-otlp-changes branch from 6cbffb1 to a169c56 Compare November 8, 2021 12:19
delta := md.Histogram().AggregationTemporality() == pdata.MetricAggregationTemporalityDelta
t.mapHistogramMetrics(ctx, consumer, md.Name(), md.Histogram().DataPoints(), delta, additionalTags, host)
default: // pdata.MetricAggregationTemporalityUnspecified or any other not supported type
default: // pdata.AggregationTemporalityUnspecified or any other not supported type
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This and the comment above were changed on #9398 but are still unchanged on the contrib repo

}
}
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@mx-psi mx-psi marked this pull request as ready for review November 8, 2021 12:33
@mx-psi mx-psi requested a review from a team as a code owner November 8, 2021 12:33
@mx-psi mx-psi merged commit b8a19a7 into main Nov 8, 2021
@mx-psi mx-psi deleted the mx-psi/backport-otlp-changes branch November 8, 2021 15:10
@mx-psi mx-psi added the component/otlp PRs and issues related to OTLP ingest label Feb 17, 2022
zandrewitte pushed a commit to StackVista/stackstate-agent that referenced this pull request Nov 17, 2022
* [pkg/otlp/model] Backport recent changes in the Datadog exporter

* Add release note
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/otlp PRs and issues related to OTLP ingest [deprecated] team/agent-platform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants