Skip to content

Commit

Permalink
Fix linting and add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
carrieedwards committed Aug 12, 2024
1 parent 6e6ed7d commit 1fcd76a
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion cmd/otelcontribcol/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/cmd/otelcontrib

go 1.21.0

toolchain go1.22.5
toolchain go1.21.12

require (
github.com/open-telemetry/opentelemetry-collector-contrib/confmap/provider/s3provider v0.106.1
Expand Down
2 changes: 1 addition & 1 deletion cmd/oteltestbedcol/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/cmd/oteltestbed

go 1.21.0

toolchain go1.22.5
toolchain go1.21.12

require (
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/carbonexporter v0.106.1
Expand Down
19 changes: 9 additions & 10 deletions receiver/datadogreceiver/internal/translator/batcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ func TestMetricBatcher(t *testing.T) {
require.Equal(t, 1, resource1.ScopeMetrics().At(0).Metrics().Len())
require.Equal(t, 1, resource2.ScopeMetrics().At(0).Metrics().Len())

require.Equal(t, "TestCount1", resource1.ScopeMetrics().At(0).Metrics().At(0).Name())
require.Equal(t, "TestCount1", resource2.ScopeMetrics().At(0).Metrics().At(0).Name())
requireSum(t, resource1.ScopeMetrics().At(0).Metrics().At(0), "TestCount1", 1)
requireSum(t, resource2.ScopeMetrics().At(0).Metrics().At(0), "TestCount1", 1)
},
},
{
Expand Down Expand Up @@ -110,6 +110,8 @@ func TestMetricBatcher(t *testing.T) {

require.Equal(t, "TestCount1", resource.ScopeMetrics().At(0).Metrics().At(0).Name())
require.Equal(t, "TestCount2", resource.ScopeMetrics().At(0).Metrics().At(1).Name())
requireSum(t, resource.ScopeMetrics().At(0).Metrics().At(0), "TestCount1", 1)
requireSum(t, resource.ScopeMetrics().At(0).Metrics().At(1), "TestCount2", 1)
},
},
{
Expand Down Expand Up @@ -162,8 +164,8 @@ func TestMetricBatcher(t *testing.T) {
require.Equal(t, 1, resource1.ScopeMetrics().At(0).Metrics().Len())
require.Equal(t, 1, resource2.ScopeMetrics().At(0).Metrics().Len())

require.Equal(t, "TestCount1", resource1.ScopeMetrics().At(0).Metrics().At(0).Name())
require.Equal(t, "TestCount1", resource2.ScopeMetrics().At(0).Metrics().At(0).Name())
requireSum(t, resource1.ScopeMetrics().At(0).Metrics().At(0), "TestCount1", 1)
requireSum(t, resource2.ScopeMetrics().At(0).Metrics().At(0), "TestCount1", 1)
},
},
{
Expand Down Expand Up @@ -210,8 +212,8 @@ func TestMetricBatcher(t *testing.T) {
require.Equal(t, "TestMetric", resource.ScopeMetrics().At(0).Metrics().At(0).Name())
require.Equal(t, "TestMetric", resource.ScopeMetrics().At(0).Metrics().At(1).Name())

require.Equal(t, pmetric.MetricTypeSum, resource.ScopeMetrics().At(0).Metrics().At(0).Type())
require.Equal(t, pmetric.MetricTypeGauge, resource.ScopeMetrics().At(0).Metrics().At(1).Type())
requireSum(t, resource.ScopeMetrics().At(0).Metrics().At(0), "TestMetric", 1)
requireGauge(t, resource.ScopeMetrics().At(0).Metrics().At(1), "TestMetric", 1)
},
},
{
Expand Down Expand Up @@ -255,10 +257,7 @@ func TestMetricBatcher(t *testing.T) {

require.Equal(t, 1, resource.ScopeMetrics().Len())

require.Equal(t, "TestMetric", resource.ScopeMetrics().At(0).Metrics().At(0).Name())

require.Equal(t, pmetric.MetricTypeSum, resource.ScopeMetrics().At(0).Metrics().At(0).Type())
require.Equal(t, 2, resource.ScopeMetrics().At(0).Metrics().At(0).Sum().DataPoints().Len())
requireSum(t, resource.ScopeMetrics().At(0).Metrics().At(0), "TestMetric", 2)
},
},
}
Expand Down
2 changes: 1 addition & 1 deletion receiver/datadogreceiver/internal/translator/series.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func (mt *MetricsTranslator) TranslateSeriesV2(series []*gogen.MetricPayload_Met
dimensions := parseSeriesProperties(serie.Metric, strings.ToLower(serie.Type.String()), serie.Tags, resourceMap["host"], mt.buildInfo.Version, mt.stringPool)
for k, v := range resourceMap {
if k == "host" {
continue
continue // Host has already been added as a resource attribute in parseSeriesProperties(), so avoid duplicating that attribute
}
dimensions.resourceAttrs.PutStr(k, v)
}
Expand Down
1 change: 0 additions & 1 deletion receiver/datadogreceiver/internal/translator/tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ func (s *StringPool) Intern(str string) string {
}

type attributes struct {
host string
resource pcommon.Map
scope pcommon.Map
dp pcommon.Map
Expand Down
3 changes: 2 additions & 1 deletion receiver/datadogreceiver/receiver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ import (
"context"
"errors"
"fmt"
"github.com/DataDog/agent-payload/v5/gogen"
"io"
"net/http"
"strings"
"testing"

"github.com/DataDog/agent-payload/v5/gogen"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/component/componenttest"
Expand Down

0 comments on commit 1fcd76a

Please sign in to comment.