This guide outlines how to report events directly to Telemetry Gateway from standalone managed services (i.e. services not operated within single-tenant Sourcegraph deployments, and instead operated on something like Sourcegraph Managed Services Platform (MSP)).
<aside> ⚠️ This page covers the standalone Telemetry Gateway service and touches on adjacent components only - it does not cover “how to record telemetry” within single-tenant Sourcegraph, which is covered in V2 telemetry guidelines for the Sourcegraph application.
</aside>
Before you start, please read What this service does to get a high-level understanding of how Telemetry Gateway fits into the user event processing system at Sourcegraph (”Telemetry V2”). In particular, note the following diagram exhibiting how the Telemetry Gateway service API is not intended to be the same API developers expose within their services:
flowchart TD
subgraph Standalone service
Client -- "Feature, Action, Timestamp, Metadata" --> backend[Service backend]
internal[Backend] -- "Feature, Action, Metadata" --> backend
backend -. "Authenticated user, Service version, client-provided fields" .-> api[full Telemetry Gateway Event spec]
end
api --> tg[Telemetry Gateway]
telemetry recorder
(noun) and record event
(verb).
log event
should not be be used to avoid confusion with “V1 telemetry”, “security event logging”, standard error logging, and numerous other similarly-named mechanisms.feature
, action
, timestamp
, and a UUIDv7 event id
.^[a-z][a-zA-Z-\\\\.]+$
feature
and action
to describe eventsinteraction
details such as a relevant trace ID<aside> 💡
Naming and data conventions outlined in V2 telemetry guidelines for the Sourcegraph application also apply in general for managed services.
</aside>
Telemetry Gateway SDK and API definitions are available in lib/telemetrygateway
for external consumption. The library also includes some rudimentary helpers and generated Go bindings for the service API specifications that are also used in single-tenant Sourcegraph.
To authenticate with SAMS service credentials, please refer to SAMS Machine-to-machine (M2M) Authentication and Authorization.