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

Always add tags for observability, other metrics may use them #1312

Merged
merged 1 commit into from
Jul 10, 2020
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
4 changes: 1 addition & 3 deletions obsreport/obsreport_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,7 @@ func ExporterContext(
ctx, _ = tag.New(ctx, tag.Upsert(LegacyTagKeyExporter, exporter, tag.WithTTL(tag.TTLNoPropagation)))
}

if useNew {
ctx, _ = tag.New(ctx, tag.Upsert(tagKeyExporter, exporter, tag.WithTTL(tag.TTLNoPropagation)))
}
ctx, _ = tag.New(ctx, tag.Upsert(tagKeyExporter, exporter, tag.WithTTL(tag.TTLNoPropagation)))

return ctx
}
Expand Down
55 changes: 11 additions & 44 deletions obsreport/obsreport_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,23 +119,14 @@ func ProcessorMetricViews(configType string, legacyViews []*view.View) []*view.V
// the given context returning the newly created context. This context should
// be used in related calls to the obsreport functions so metrics are properly
// recorded.
func ProcessorContext(
ctx context.Context,
processor string,
) context.Context {
if useNew {
ctx, _ = tag.New(
ctx, tag.Upsert(tagKeyProcessor, processor, tag.WithTTL(tag.TTLNoPropagation)))
}
func ProcessorContext(ctx context.Context, processor string) context.Context {
ctx, _ = tag.New(ctx, tag.Upsert(tagKeyProcessor, processor, tag.WithTTL(tag.TTLNoPropagation)))

return ctx
}

// ProcessorTraceDataAccepted reports that the trace data was accepted.
func ProcessorTraceDataAccepted(
processorCtx context.Context,
numSpans int,
) {
func ProcessorTraceDataAccepted(processorCtx context.Context, numSpans int) {
if useNew {
stats.Record(
processorCtx,
Expand All @@ -147,10 +138,7 @@ func ProcessorTraceDataAccepted(
}

// ProcessorTraceDataRefused reports that the trace data was refused.
func ProcessorTraceDataRefused(
processorCtx context.Context,
numSpans int,
) {
func ProcessorTraceDataRefused(processorCtx context.Context, numSpans int) {
if useNew {
stats.Record(
processorCtx,
Expand All @@ -162,10 +150,7 @@ func ProcessorTraceDataRefused(
}

// ProcessorTraceDataDropped reports that the trace data was dropped.
func ProcessorTraceDataDropped(
processorCtx context.Context,
numSpans int,
) {
func ProcessorTraceDataDropped(processorCtx context.Context, numSpans int) {
if useNew {
stats.Record(
processorCtx,
Expand All @@ -177,10 +162,7 @@ func ProcessorTraceDataDropped(
}

// ProcessorMetricsDataAccepted reports that the metrics were accepted.
func ProcessorMetricsDataAccepted(
processorCtx context.Context,
numPoints int,
) {
func ProcessorMetricsDataAccepted(processorCtx context.Context, numPoints int) {
if useNew {
stats.Record(
processorCtx,
Expand All @@ -192,10 +174,7 @@ func ProcessorMetricsDataAccepted(
}

// ProcessorMetricsDataRefused reports that the metrics were refused.
func ProcessorMetricsDataRefused(
processorCtx context.Context,
numPoints int,
) {
func ProcessorMetricsDataRefused(processorCtx context.Context, numPoints int) {
if useNew {
stats.Record(
processorCtx,
Expand All @@ -207,10 +186,7 @@ func ProcessorMetricsDataRefused(
}

// ProcessorMetricsDataDropped reports that the metrics were dropped.
func ProcessorMetricsDataDropped(
processorCtx context.Context,
numPoints int,
) {
func ProcessorMetricsDataDropped(processorCtx context.Context, numPoints int) {
if useNew {
stats.Record(
processorCtx,
Expand All @@ -222,10 +198,7 @@ func ProcessorMetricsDataDropped(
}

// ProcessorLogRecordsAccepted reports that the metrics were accepted.
func ProcessorLogRecordsAccepted(
processorCtx context.Context,
numRecords int,
) {
func ProcessorLogRecordsAccepted(processorCtx context.Context, numRecords int) {
if useNew {
stats.Record(
processorCtx,
Expand All @@ -237,10 +210,7 @@ func ProcessorLogRecordsAccepted(
}

// ProcessorLogRecordsRefused reports that the metrics were refused.
func ProcessorLogRecordsRefused(
processorCtx context.Context,
numRecords int,
) {
func ProcessorLogRecordsRefused(processorCtx context.Context, numRecords int) {
if useNew {
stats.Record(
processorCtx,
Expand All @@ -252,10 +222,7 @@ func ProcessorLogRecordsRefused(
}

// ProcessorLogRecordsDropped reports that the metrics were dropped.
func ProcessorLogRecordsDropped(
processorCtx context.Context,
numRecords int,
) {
func ProcessorLogRecordsDropped(processorCtx context.Context, numRecords int) {
if useNew {
stats.Record(
processorCtx,
Expand Down
12 changes: 3 additions & 9 deletions obsreport/obsreport_receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,15 +247,9 @@ func ReceiverContext(
ctx, _ = tag.New(ctx, tag.Upsert(LegacyTagKeyReceiver, name, tag.WithTTL(tag.TTLNoPropagation)))
}

if useNew {
mutators := make([]tag.Mutator, 0, 2)
mutators = append(mutators, tag.Upsert(tagKeyReceiver, receiver, tag.WithTTL(tag.TTLNoPropagation)))
if transport != "" {
mutators = append(mutators, tag.Upsert(tagKeyTransport, transport, tag.WithTTL(tag.TTLNoPropagation)))
}

ctx, _ = tag.New(ctx, mutators...)
}
ctx, _ = tag.New(ctx,
tag.Upsert(tagKeyReceiver, receiver, tag.WithTTL(tag.TTLNoPropagation)),
tag.Upsert(tagKeyTransport, transport, tag.WithTTL(tag.TTLNoPropagation)))

return ctx
}
Expand Down