package plug import ( "context" "git.anthrove.art/Anthrove/plug-sdk/v4/pkg/telemetry" log "github.com/sirupsen/logrus" "go.opentelemetry.io/otel/codes" ) func SetupOpenTelemtry(ctx context.Context, serviceName string) error { ctx, span := tracer.Start(ctx, "SetupOpenTelemtry") defer span.End() err := telemetry.SetupMeterProvider(serviceName) if err != nil { span.RecordError(err) span.SetStatus(codes.Error, err.Error()) log.WithContext(ctx).WithError(err).Error("Failed to setup meter provider") return err } err = telemetry.SetupTraceProvider(ctx, serviceName) if err != nil { span.RecordError(err) span.SetStatus(codes.Error, err.Error()) log.WithContext(ctx).WithError(err).Error("Failed to setup trace provider") return err } return nil }