generated from honeycombio/.github
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathtelemetry.go
24 lines (20 loc) · 1.04 KB
/
telemetry.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
package husky
import "context"
// AddTelemetryAttributeFunc is used to provide a function that adds attributes to telemetry controlled
// by users of this package.
// For example, beeline users would use beeline.AddField and OTel users would use span.SetAttributes.
var AddTelemetryAttributeFunc func(ctx context.Context, key string, value any) = nil
// AddTelemetryAttribute is used internally to set attributes using the configured SetAddAttributesFunc.
// This function is not intended to be used directly by consumers of this package.
func AddTelemetryAttribute(ctx context.Context, key string, value any) {
if AddTelemetryAttributeFunc != nil {
AddTelemetryAttributeFunc(ctx, key, value)
}
}
// AddTelemetryAttributes is used internally to set multiple attributes using the configured SetAddAttributesFunc.
// This function is not intended to be used directly by consumers of this package.
func AddTelemetryAttributes(ctx context.Context, attributes map[string]any) {
for key, value := range attributes {
AddTelemetryAttribute(ctx, key, value)
}
}