Added missing OpenTelemetry instrumentation to several API endpoints. (#32960)
Fixes #32331 Manually tested all paths. `/test` path removed in https://github.com/fleetdm/fleet/pull/32962 Also added support for sending errors to OpenTelemetry, like we do for APM/Sentry. # Checklist for submitter - [x] Changes file added for user-visible changes in `changes/`, `orbit/changes/` or `ee/fleetd-chrome/changes`. See [Changes files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/guides/committing-changes.md#changes-files) for more information. ## Testing - [x] QA'd all new/changed functionality manually <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added OpenTelemetry tracing across core HTTP endpoints (health, version, assets, metrics, enroll/root, debug, Apple MDM, SCEP, SCIM) with dynamic per-request route instrumentation. * Enhanced error reporting to include OpenTelemetry spans/events with contextual user/host attributes. * **Tests** * Added unit tests validating SCIM and error-handling telemetry, span naming, and sensitive-data redaction. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -441,6 +441,7 @@ func RunServerForTestsWithServiceWithDS(t *testing.T, ctx context.Context, ds fl
|
||||
},
|
||||
commander,
|
||||
"https://test-url.com",
|
||||
cfg,
|
||||
)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
@@ -458,6 +459,7 @@ func RunServerForTestsWithServiceWithDS(t *testing.T, ctx context.Context, ds fl
|
||||
ds,
|
||||
logger,
|
||||
timeout,
|
||||
&cfg,
|
||||
)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
@@ -479,7 +481,7 @@ func RunServerForTestsWithServiceWithDS(t *testing.T, ctx context.Context, ds fl
|
||||
extra = append(extra, WithLoginRateLimit(throttled.PerMin(1000)))
|
||||
|
||||
if len(opts) > 0 && opts[0].HostIdentity != nil {
|
||||
require.NoError(t, hostidentity.RegisterSCEP(rootMux, opts[0].HostIdentity.SCEPStorage, ds, logger))
|
||||
require.NoError(t, hostidentity.RegisterSCEP(rootMux, opts[0].HostIdentity.SCEPStorage, ds, logger, &cfg))
|
||||
var httpSigVerifier func(http.Handler) http.Handler
|
||||
httpSigVerifier, err := httpsig.Middleware(ds, opts[0].HostIdentity.RequireHTTPMessageSignature, kitlog.With(logger, "component", "http-sig-verifier"))
|
||||
require.NoError(t, err)
|
||||
@@ -497,7 +499,7 @@ func RunServerForTestsWithServiceWithDS(t *testing.T, ctx context.Context, ds fl
|
||||
rootMux.Handle("/enroll", ServeEndUserEnrollOTA(svc, "", ds, logger))
|
||||
|
||||
if len(opts) > 0 && opts[0].EnableSCIM {
|
||||
require.NoError(t, scim.RegisterSCIM(rootMux, ds, svc, logger))
|
||||
require.NoError(t, scim.RegisterSCIM(rootMux, ds, svc, logger, &cfg))
|
||||
rootMux.Handle("/api/v1/fleet/scim/details", apiHandler)
|
||||
rootMux.Handle("/api/latest/fleet/scim/details", apiHandler)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user