MCPcopy
hub / github.com/grafana/tempo / set

Method set

modules/overrides/userconfigurable/api/api.go:86–113  ·  view source on GitHub ↗

set the Limits. Can return backend.ErrVersionDoesNotMatch, validationError

(ctx context.Context, userID string, limits *client.Limits, version backend.Version, skipConflictingOverridesCheck bool)

Source from the content-addressed store, hash-verified

84
85// set the Limits. Can return backend.ErrVersionDoesNotMatch, validationError
86func (a *UserConfigOverridesAPI) set(ctx context.Context, userID string, limits *client.Limits, version backend.Version, skipConflictingOverridesCheck bool) (backend.Version, error) {
87 ctx, span := tracer.Start(ctx, "UserConfigOverridesAPI.set", trace.WithAttributes(
88 attribute.String("userID", userID),
89 attribute.String("version", string(version)),
90 attribute.String("limits", logLimits(limits)),
91 ))
92 defer span.End()
93 traceID, _ := tracing.ExtractTraceID(ctx)
94
95 err := a.validator.Validate(limits)
96 if err != nil {
97 return "", newValidationError(err)
98 }
99
100 if a.cfg.CheckForConflictingRuntimeOverrides && !skipConflictingOverridesCheck {
101 err = a.assertNoConflictingRuntimeOverrides(ctx, userID)
102 if err != nil {
103 return "", err
104 }
105 }
106
107 level.Info(a.logger).Log("traceID", traceID, "msg", "storing user-configurable overrides", "userID", userID, "limits", logLimits(limits), "version", version)
108
109 newVersion, err := a.client.Set(ctx, userID, limits, version)
110
111 level.Info(a.logger).Log("traceID", traceID, "msg", "stored user-configurable overrides", "userID", userID, "limits", logLimits(limits), "version", version, "newVersion", newVersion, "err", err)
112 return newVersion, err
113}
114
115func (a *UserConfigOverridesAPI) update(ctx context.Context, userID string, patch []byte, skipConflictingOverridesCheck bool) (*client.Limits, backend.Version, error) {
116 ctx, span := tracer.Start(ctx, "UserConfigOverridesAPI.update", trace.WithAttributes(

Callers 9

updateMethod · 0.95
PostHandlerMethod · 0.95
SetMethod · 0.80
setFunction · 0.80
constructorMethod · 0.80
showMethod · 0.80
HeFunction · 0.80
showMethod · 0.80

Calls 9

ExtractTraceIDFunction · 0.92
logLimitsFunction · 0.85
newValidationErrorFunction · 0.85
StartMethod · 0.65
ValidateMethod · 0.65
LogMethod · 0.65
SetMethod · 0.65
StringMethod · 0.45

Tested by 1

SetMethod · 0.64