MCPcopy
hub / github.com/cortexlabs/cortex / Error

Function Error

pkg/lib/telemetry/telemetry.go:168–188  ·  view source on GitHub ↗
(err error, tags ...map[string]string)

Source from the content-addressed store, hash-verified

166}
167
168func Error(err error, tags ...map[string]string) {
169 if err == nil || _config == nil || errors.IsNoTelemetry(err) {
170 return
171 }
172
173 if shouldBlock(err, _config.BackoffMode) {
174 return
175 }
176
177 mergedTags := maps.MergeStrMapsString(tags...)
178
179 sentry.WithScope(func(scope *sentry.Scope) {
180 e := EventFromException(err)
181 scope.SetUser(sentry.User{ID: _config.UserID})
182 scope.SetTags(maps.MergeStrMapsString(_config.Properties, mergedTags))
183 scope.SetTags(map[string]string{"error_type": e.Exception[0].Type})
184 sentry.CaptureEvent(e)
185
186 go sentry.Flush(10 * time.Second)
187 })
188}
189
190func EventFromException(exception error) *sentry.Event {
191 stacktrace := sentry.ExtractStacktrace(exception)

Callers 15

AddAPIMethod · 0.92
AwakenMethod · 0.92
ScaleMethod · 0.92
ErrorFunction · 0.92
PanicFunction · 0.92
HandlerFunction · 0.92
ServeHTTPMethod · 0.92
addAPIMethod · 0.92
updateAPIMethod · 0.92
removeAPIMethod · 0.92

Calls 5

IsNoTelemetryFunction · 0.92
MergeStrMapsStringFunction · 0.92
shouldBlockFunction · 0.85
EventFromExceptionFunction · 0.85
FlushMethod · 0.80

Tested by

no test coverage detected