Skip to content

Commit

Permalink
[chore] use generated scope name (#34587)
Browse files Browse the repository at this point in the history
This doesn't change the scope itself, just where the variable is pulled
from.

---------

Signed-off-by: Alex Boten <[email protected]>
  • Loading branch information
codeboten authored Aug 9, 2024
1 parent 8d1291d commit fb6ccce
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions connector/countconnector/connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@ import (
"go.opentelemetry.io/collector/pdata/pmetric"
"go.opentelemetry.io/collector/pdata/ptrace"

"github.com/open-telemetry/opentelemetry-collector-contrib/connector/countconnector/internal/metadata"
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl/contexts/ottldatapoint"
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl/contexts/ottllog"
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl/contexts/ottlmetric"
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl/contexts/ottlspan"
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl/contexts/ottlspanevent"
)

const scopeName = "github.com/open-telemetry/opentelemetry-collector-contrib/connector/countconnector"

// count can count spans, span event, metrics, data points, or log records
// and emit the counts onto a metrics pipeline.
type count struct {
Expand Down Expand Up @@ -76,7 +75,7 @@ func (c *count) ConsumeTraces(ctx context.Context, td ptrace.Traces) error {

countResource.ScopeMetrics().EnsureCapacity(resourceSpan.ScopeSpans().Len())
countScope := countResource.ScopeMetrics().AppendEmpty()
countScope.Scope().SetName(scopeName)
countScope.Scope().SetName(metadata.ScopeName)

spansCounter.appendMetricsTo(countScope.Metrics())
spanEventsCounter.appendMetricsTo(countScope.Metrics())
Expand Down Expand Up @@ -151,7 +150,7 @@ func (c *count) ConsumeMetrics(ctx context.Context, md pmetric.Metrics) error {

countResource.ScopeMetrics().EnsureCapacity(resourceMetric.ScopeMetrics().Len())
countScope := countResource.ScopeMetrics().AppendEmpty()
countScope.Scope().SetName(scopeName)
countScope.Scope().SetName(metadata.ScopeName)

metricsCounter.appendMetricsTo(countScope.Metrics())
dataPointsCounter.appendMetricsTo(countScope.Metrics())
Expand Down Expand Up @@ -190,7 +189,7 @@ func (c *count) ConsumeLogs(ctx context.Context, ld plog.Logs) error {

countResource.ScopeMetrics().EnsureCapacity(resourceLog.ScopeLogs().Len())
countScope := countResource.ScopeMetrics().AppendEmpty()
countScope.Scope().SetName(scopeName)
countScope.Scope().SetName(metadata.ScopeName)

counter.appendMetricsTo(countScope.Metrics())
}
Expand Down

0 comments on commit fb6ccce

Please sign in to comment.