add service name attribute and fix context for flush

main
William Perron 10 months ago
parent 6b280e7b33
commit 3e8d49c0c0
Signed by: wperron
GPG Key ID: BFDB4EF72D73C5F2

@ -26,6 +26,7 @@ import (
"go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/propagation"
"go.opentelemetry.io/otel/sdk/resource" "go.opentelemetry.io/otel/sdk/resource"
sdktrace "go.opentelemetry.io/otel/sdk/trace" sdktrace "go.opentelemetry.io/otel/sdk/trace"
semconv "go.opentelemetry.io/otel/semconv/v1.24.0"
"go.opentelemetry.io/otel/trace" "go.opentelemetry.io/otel/trace"
"go.wperron.io/sqliteexporter" "go.wperron.io/sqliteexporter"
@ -802,7 +803,7 @@ func registerHandlers(sess *discordgo.Session, handlers map[string]Handler) {
log.Debug().Ctx(ctx).Str("value", sub).Msg("flush modal submitted") log.Debug().Ctx(ctx).Str("value", sub).Msg("flush modal submitted")
if sub == "y" || sub == "ye" || sub == "yes" { if sub == "y" || sub == "ye" || sub == "yes" {
err := store.Flush(context.Background(), i.Member.User.ID) err := store.Flush(ctx, i.Member.User.ID)
msg := "Flushed all claims!" msg := "Flushed all claims!"
if err != nil { if err != nil {
log.Error().Ctx(ctx).Err(err).Msg("failed to flush claims") log.Error().Ctx(ctx).Err(err).Msg("failed to flush claims")
@ -1022,6 +1023,7 @@ func initTracing(db *sql.DB) {
resource.WithOS(), resource.WithOS(),
resource.WithProcess(), resource.WithProcess(),
resource.WithTelemetrySDK(), resource.WithTelemetrySDK(),
resource.WithAttributes(semconv.ServiceName("themis")),
) )
ex, err := sqliteexporter.NewSqliteSDKTraceExporterWithDB(db) ex, err := sqliteexporter.NewSqliteSDKTraceExporterWithDB(db)

Loading…
Cancel
Save