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

update all metrics to include otelcol_ prefix #9759

Merged
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
fix test
Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
  • Loading branch information
codeboten committed Jul 12, 2024
commit b0305677b4568917a19f64cf0d7ca76341402512
14 changes: 7 additions & 7 deletions service/telemetry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,33 +329,33 @@ func TestTelemetryInit(t *testing.T) {

func createTestMetrics(t *testing.T, mp metric.MeterProvider) *view.View {
// Creates a OTel Go counter
counter, err := mp.Meter("collector_test").Int64Counter(otelPrefix+counterName, metric.WithUnit("ms"))
counter, err := mp.Meter("collector_test").Int64Counter(metricPrefix+otelPrefix+counterName, metric.WithUnit("ms"))
require.NoError(t, err)
counter.Add(context.Background(), 13)

grpcExampleCounter, err := mp.Meter(proctelemetry.GRPCInstrumentation).Int64Counter(grpcPrefix + counterName)
grpcExampleCounter, err := mp.Meter(proctelemetry.GRPCInstrumentation).Int64Counter(metricPrefix + grpcPrefix + counterName)
require.NoError(t, err)
grpcExampleCounter.Add(context.Background(), 11, metric.WithAttributes(proctelemetry.GRPCUnacceptableKeyValues...))

httpExampleCounter, err := mp.Meter(proctelemetry.HTTPInstrumentation).Int64Counter(httpPrefix + counterName)
httpExampleCounter, err := mp.Meter(proctelemetry.HTTPInstrumentation).Int64Counter(metricPrefix + httpPrefix + counterName)
require.NoError(t, err)
httpExampleCounter.Add(context.Background(), 10, metric.WithAttributes(proctelemetry.HTTPUnacceptableKeyValues...))

// Creates a OpenCensus measure
ocCounter := stats.Int64(ocPrefix+counterName, counterName, stats.UnitDimensionless)
ocCounter := stats.Int64(metricPrefix+ocPrefix+counterName, counterName, stats.UnitDimensionless)
v := &view.View{
Name: ocPrefix + counterName,
Name: metricPrefix + ocPrefix + counterName,
Description: ocCounter.Description(),
Measure: ocCounter,
Aggregation: view.Sum(),
}
err = view.Register(v)
require.NoError(t, err)

stats.Record(context.Background(), stats.Int64(ocPrefix+counterName, counterName, stats.UnitDimensionless).M(13))
stats.Record(context.Background(), stats.Int64(metricPrefix+ocPrefix+counterName, counterName, stats.UnitDimensionless).M(13))

// Forces a flush for the view data.
_, _ = view.RetrieveData(ocPrefix + counterName)
_, _ = view.RetrieveData(metricPrefix + ocPrefix + counterName)

return v
}
Expand Down
Loading