Skip to content

Commit b78111a

Browse files
committed
update span kind
1 parent f6e2225 commit b78111a

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

sdk/highlight-go/log/logrus.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ package hlog
33
import (
44
"context"
55
"fmt"
6+
"strings"
7+
68
"github.com/highlight/highlight/sdk/highlight-go"
79
"github.com/sirupsen/logrus"
810
"go.opentelemetry.io/otel/codes"
911
"go.opentelemetry.io/otel/trace"
10-
"strings"
1112

1213
"go.opentelemetry.io/otel/attribute"
1314
semconv "go.opentelemetry.io/otel/semconv/v1.25.0"
@@ -59,7 +60,7 @@ func (hook *Hook) Fire(entry *logrus.Entry) error {
5960
ctx = context.TODO()
6061
}
6162

62-
span, _ := highlight.StartTraceWithTimestamp(ctx, highlight.LogrusSpanName, entry.Time, []trace.SpanStartOption{trace.WithSpanKind(trace.SpanKindClient)})
63+
span, _ := highlight.StartTraceWithTimestamp(ctx, highlight.LogrusSpanName, entry.Time, []trace.SpanStartOption{trace.WithSpanKind(trace.SpanKindProducer)})
6364
defer highlight.EndTrace(span)
6465

6566
msg := entry.Message

sdk/highlight-go/log/util.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ func submitVercelLog(ctx context.Context, tracer trace.Tracer, projectID int, se
108108
t := time.UnixMilli(log.Timestamp)
109109
span, _ := highlight.StartTraceWithTracer(
110110
ctx, tracer, highlight.LogSpanName, t,
111-
[]trace.SpanStartOption{trace.WithSpanKind(trace.SpanKindClient)},
111+
[]trace.SpanStartOption{trace.WithSpanKind(trace.SpanKindProducer)},
112112
attribute.String(highlight.ProjectIDAttribute, strconv.Itoa(projectID)),
113113
semconv.ServiceNameKey.String(serviceName),
114114
)
@@ -224,7 +224,7 @@ func SubmitHTTPLog(ctx context.Context, tracer trace.Tracer, projectID int, lg L
224224

225225
span, _ := highlight.StartTraceWithTracer(
226226
ctx, tracer, highlight.LogSpanName, t,
227-
[]trace.SpanStartOption{trace.WithSpanKind(trace.SpanKindClient)},
227+
[]trace.SpanStartOption{trace.WithSpanKind(trace.SpanKindProducer)},
228228
attribute.String(highlight.ProjectIDAttribute, strconv.Itoa(projectID)),
229229
)
230230
defer highlight.EndTrace(span)

sdk/highlight-go/otel.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ func RecordLog(ctx context.Context, record log.Record, tags ...log.KeyValue) err
512512
// Highlight session and trace are inferred from the context.
513513
// If no sessionID is set, then the error is associated with the project without a session context.
514514
func RecordError(ctx context.Context, err error, tags ...attribute.KeyValue) context.Context {
515-
span, ctx := StartTraceWithTimestamp(ctx, ErrorSpanName, time.Now(), []trace.SpanStartOption{trace.WithSpanKind(trace.SpanKindClient)}, tags...)
515+
span, ctx := StartTraceWithTimestamp(ctx, ErrorSpanName, time.Now(), []trace.SpanStartOption{trace.WithSpanKind(trace.SpanKindProducer)}, tags...)
516516
defer EndTrace(span)
517517
RecordSpanError(span, err)
518518
return ctx

0 commit comments

Comments
 (0)