Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 1 addition & 2 deletions exporter/signalfxexporter/dpclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"go.uber.org/zap"

"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/signalfxexporter/internal/translation"
"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/signalfxexporter/internal/utils"
"github.com/open-telemetry/opentelemetry-collector-contrib/internal/splunk"
)

Expand Down Expand Up @@ -102,7 +101,7 @@ func (s *sfxDPClient) pushMetricsData(

// export any histograms in otlp if sendOTLPHistograms is true
if s.sendOTLPHistograms {
histogramData, metricCount := utils.GetHistograms(md)
histogramData, metricCount := getHistograms(md)
if metricCount > 0 {
droppedCount, err := s.pushOTLPMetricsDataForToken(ctx, histogramData, metricToken)
if err != nil {
Expand Down
3 changes: 1 addition & 2 deletions exporter/signalfxexporter/exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import (
componentmetadata "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/signalfxexporter/internal/metadata"
"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/signalfxexporter/internal/translation"
"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/signalfxexporter/internal/translation/dpfilters"
"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/signalfxexporter/internal/utils"
"github.com/open-telemetry/opentelemetry-collector-contrib/internal/splunk"
metadata "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/experimentalmetricmetadata"
)
Expand Down Expand Up @@ -2099,7 +2098,7 @@ func TestConsumeMixedMetrics(t *testing.T) {

if tt.wantThrottleErr {
if tt.wantPartialMetricsErr {
partialMetrics, _ := utils.GetHistograms(smallBatch)
partialMetrics, _ := getHistograms(smallBatch)
throttleErr := errors.New(errMsg)
throttleErr = exporterhelper.NewThrottleRetry(throttleErr, time.Duration(tt.retryAfter)*time.Second)
testErr := consumererror.NewMetrics(throttleErr, partialMetrics)
Expand Down
26 changes: 0 additions & 26 deletions exporter/signalfxexporter/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -656,29 +656,3 @@ func testReadJSON(f string, v any) error {
}
return json.Unmarshal(bytes, &v)
}

func buildHistogramDP(dp pmetric.HistogramDataPoint, timestamp pcommon.Timestamp) {
dp.SetStartTimestamp(timestamp)
dp.SetTimestamp(timestamp)
dp.SetMin(1.0)
dp.SetMax(2)
dp.SetCount(5)
dp.SetSum(7.0)
dp.BucketCounts().FromRaw([]uint64{3, 2})
dp.ExplicitBounds().FromRaw([]float64{1, 2})
dp.Attributes().PutStr("k1", "v1")
}

func buildHistogram(im pmetric.Metric, name string, timestamp pcommon.Timestamp, dpCount int) {
im.SetName(name)
im.SetDescription("Histogram")
im.SetUnit("1")
im.SetEmptyHistogram().SetAggregationTemporality(pmetric.AggregationTemporalityDelta)
idps := im.Histogram().DataPoints()
idps.EnsureCapacity(dpCount)

for range dpCount {
dp := idps.AppendEmpty()
buildHistogramDP(dp, timestamp)
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

package utils // import "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/signalfxexporter/internal/utils"
package signalfxexporter // import "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/signalfxexporter"

import (
"go.opentelemetry.io/collector/pdata/pcommon"
Expand Down Expand Up @@ -76,10 +76,10 @@ func matchedHistogramMetrics(ilm pmetric.ScopeMetrics) (matchedMetricsIdx []int)
return matchedMetricsIdx
}

// GetHistograms returns new Metrics slice containing only Histogram metrics found in the input
// getHistograms returns new Metrics slice containing only Histogram metrics found in the input
// and the count of histogram metrics
// This function also adds the host ID attribute to the resource if it can be derived from the resource attributes
func GetHistograms(md pmetric.Metrics) (pmetric.Metrics, int) {
func getHistograms(md pmetric.Metrics) (pmetric.Metrics, int) {
matchedMetricsIdxes := matchedHistogramResourceMetrics(md)
matchedRmCount := len(matchedMetricsIdxes)
if matchedRmCount == 0 {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

package utils
package signalfxexporter

import (
"testing"
Expand Down Expand Up @@ -383,7 +383,7 @@ func TestHistogramsAreRetrieved(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
md := tt.inMetricsFunc()
gotMetrics, gotCount := GetHistograms(md)
gotMetrics, gotCount := getHistograms(md)
assert.Equal(t, tt.wantMetricCount, gotCount)
if tt.wantMetricCount == 0 {
assert.Equal(t, tt.wantMetrics(), gotMetrics)
Expand Down
14 changes: 0 additions & 14 deletions exporter/signalfxexporter/internal/utils/package_test.go

This file was deleted.

Loading