Skip to content
This repository has been archived by the owner on Mar 3, 2024. It is now read-only.

Commit

Permalink
Include attributes in place of composit span name
Browse files Browse the repository at this point in the history
  • Loading branch information
zachfi committed May 10, 2023
1 parent 9a55f31 commit 92e4086
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion modules/telemetry/telemetry.go
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/codes"
"go.opentelemetry.io/otel/trace"
"google.golang.org/protobuf/proto"
Expand Down Expand Up @@ -275,9 +276,18 @@ func (l *Telemetry) ReportIOTDevice(ctx context.Context, request *inventory.IOTD

discovery := request.DeviceDiscovery

spanCtx, span := l.tracer.Start(ctx, fmt.Sprintf("ReportIOTDevice/%s/%s", discovery.Component, discovery.ObjectId))
spanCtx, span := l.tracer.Start(
ctx,
"ReportIOTDevice",
trace.WithSpanKind(trace.SpanKindServer),
)
defer span.End()

span.SetAttributes(
attribute.String("component", discovery.Component),
attribute.String("object_id", discovery.ObjectId),
)

if discovery.ObjectId != "" {
telemetryIOTReport.WithLabelValues(discovery.ObjectId, discovery.Component).Inc()
}
Expand Down

0 comments on commit 92e4086

Please sign in to comment.