-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprivate.go
42 lines (37 loc) · 1.49 KB
/
private.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package leafGooglePubsub
import (
"context"
"fmt"
leafSentryTracer "github.com/paulusrobin/leaf-utilities/tracer/integrations/sentry"
leafSentryDestination "github.com/paulusrobin/leaf-utilities/tracer/integrations/sentry/messageDestinationType"
leafSentrySpanType "github.com/paulusrobin/leaf-utilities/tracer/integrations/sentry/spanType"
leafTracer "github.com/paulusrobin/leaf-utilities/tracer/tracer"
"github.com/paulusrobin/leaf-utilities/tracer/tracer/tracer"
)
func startMessagingProducerSpan(ctx context.Context, topic string) leafTracer.Span {
span, found := tracer.SpanFromContext(ctx)
if !found {
return tracer.NoopSpan()
}
tracerSpan, err := tracer.StartSpanFromContext(ctx, fmt.Sprintf("[GooglePubSub-Producer] %s", topic),
tracer.ChildOf(span.Context()),
//taniNewRelicTracer.WithSpanType(taniNewRelicSpanType.MessageProducer),
//taniNewRelicTracer.WithMessageProducer(taniNewRelicTracer.MessageProducerOption{
// Library: "GooglePubSub",
// DestinationType: taniNewRelicDestination.MessageTopic,
// DestinationName: topic,
// DestinationTemporary: false,
//}),
leafSentryTracer.WithSpanType(leafSentrySpanType.MessageProducer),
leafSentryTracer.WithMessageProducer(leafSentryTracer.MessageProducerOption{
Library: "GooglePubSub",
DestinationType: leafSentryDestination.MessageTopic,
DestinationName: topic,
DestinationTemporary: false,
}),
)
if err != nil {
return tracer.NoopSpan()
}
return tracerSpan
}