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

[exporter/datadog] add instrumentation_scope_metadata_as_tags #11135

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix lint
  • Loading branch information
keisku committed Jun 18, 2022
commit 7956d62ae7e8201382e089389912fa24ae63920a
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package instrumentationscope // import "github.com/open-telemetry/opentelemetry-

import (
"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter/internal/model/internal/utils"

"go.opentelemetry.io/collector/pdata/pcommon"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ import (
"strconv"

"github.com/DataDog/datadog-agent/pkg/quantile"
"go.opentelemetry.io/collector/pdata/pmetric"
"go.uber.org/zap"

"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter/internal/model/attributes"
"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter/internal/model/internal/instrumentationlibrary"
"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter/internal/model/internal/instrumentationscope"
"go.opentelemetry.io/collector/pdata/pmetric"
"go.uber.org/zap"
)

const metricName string = "metric name"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (

"github.com/DataDog/datadog-agent/pkg/quantile"
"github.com/DataDog/datadog-agent/pkg/quantile/summary"
"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter/internal/model/attributes"
gocache "github.com/patrickmn/go-cache"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand All @@ -34,6 +33,8 @@ import (
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
"go.uber.org/zap/zaptest/observer"

"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter/internal/model/attributes"
)

func TestIsCumulativeMonotonic(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions exporter/datadogexporter/metrics_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ func translatorFromConfig(logger *zap.Logger, cfg *config.Config, hostProvider p
options = append(options, translator.WithResourceAttributesAsTags())
}

if cfg.Metrics.ExporterConfig.InstrumentationScopeMetadataAsTags && cfg.Metrics.ExporterConfig.InstrumentationLibraryMetadataAsTags {
if cfg.Metrics.ExporterConfig.InstrumentationScopeMetadataAsTags && cfg.Metrics.ExporterConfig.InstrumentationLibraryMetadataAsTags { // nolint SA1019
return nil, fmt.Errorf("cannot use both instrumentation_library_metadata_as_tags(deprecated) and instrumentation_scope_metadata_as_tags")
}

if cfg.Metrics.ExporterConfig.InstrumentationScopeMetadataAsTags {
options = append(options, translator.WithInstrumentationScopeMetadataAsTags())
}

if cfg.Metrics.ExporterConfig.InstrumentationLibraryMetadataAsTags {
if cfg.Metrics.ExporterConfig.InstrumentationLibraryMetadataAsTags { // nolint SA1019
options = append(options, translator.WithInstrumentationLibraryMetadataAsTags())
}

Expand Down