Sourcegraph DocsSourcegraph Docs
  • Code Intelligence

    • Cody
    • Code Search
  • Code Management

    • Batch Changes
    • Code Navigation
    • Code Monitoring
    • Code Ownership
    • Code Insights
    • Notebooks
  • Platform

    • Sourcegraph Admin
    • Sourcegraph Cloud
    • Integrations
    • Development
  • CLI & API

    • Sourcegraph CLI
    • Sourcegraph GraphQL API
    • Sourcegraph Stream API
  • Help & Support

    • SLAs & Premium Support
    • Tutorials
    • Sourcegraph Accounts
    • Changelog
  1. Docs
  2. dev
  3. background-information
  4. telemetry
  5. protocol

Telemetry Gateway

This page contains generated documentation for telemetry event data that gets exported to Sourcegraph from individual Sourcegraph instances.

WARNING: This page primarily pertains to the new telemetry system introduced in Sourcegraph 5.2.1 - refer to DEPRECATED: Telemetry for the legacy system which may still be in use if a callsite has not been migrated yet.

Table of Contents

  • telemetrygateway/v1/telemetrygateway.proto

    • Event

    • EventBillingMetadata

    • EventFeatureFlags

    • EventFeatureFlags.FlagsEntry

    • EventInteraction

    • EventInteraction.Geolocation

    • EventMarketingTracking

    • EventParameters

    • EventParameters.LegacyMetadataEntry

    • EventParameters.MetadataEntry

    • EventSource

    • EventSource.Client

    • EventSource.Server

    • EventUser

    • Identifier

    • Identifier.LicensedInstanceIdentifier

    • Identifier.UnlicensedInstanceIdentifier

    • RecordEventsRequest

    • RecordEventsRequest.EventsPayload

    • RecordEventsRequestMetadata

    • RecordEventsResponse

    • TelemeteryGatewayService

  • Scalar Value Types

Top

telemetrygateway/v1/telemetrygateway.proto

Event

FieldTypeLabelDescription
idstring

Generated ID of the event, currently expected to be UUID v4.

timestampgoogle.protobuf.Timestamp

Timestamp of when the original event was recorded.

featurestring

Feature associated with the event in camelCase, e.g. 'myFeature'.

actionstring

Action associated with the event in camelCase, e.g. 'pageView'.

sourceEventSource

Source of the event.

parametersEventParameters

Parameters of the event.

userEventUseroptional

Optional user associated with the event.

This field should be hydrated by the Sourcegraph server, and not provided

by clients.

feature_flagsEventFeatureFlagsoptional

Optional feature flags configured in the context of the event.

marketing_trackingEventMarketingTrackingoptional

Optional marketing campaign tracking parameters.

🚨 SECURITY: This metadata is NEVER exported from an instance, and is only

exported for events tracked in the public Sourcegraph.com instance.

interactionEventInteractionoptional

Optional metadata identifying the interaction that generated the event.

EventBillingMetadata

FieldTypeLabelDescription
productstring

Billing product ID associated with the event.

categorystring

Billing category ID the event falls into.

EventFeatureFlags

FieldTypeLabelDescription
flagsEventFeatureFlags.FlagsEntryrepeated

Evaluated feature flags. In Soucegraph we currently only support boolean

feature flags, but in the API we allow arbitrary string values for future

extensibility.

This field should be hydrated by the Sourcegraph server, and not provided

by clients.

EventFeatureFlags.FlagsEntry

FieldTypeLabelDescription
keystring

valuestring

EventInteraction

FieldTypeLabelDescription
trace_idstringoptional

OpenTelemetry trace ID representing the interaction associated with the event.

interaction_idstringoptional

Custom interaction ID representing the interaction associated with the event.

geolocationEventInteraction.Geolocationoptional

Geolocation associated with the interaction, typically inferred from the

originating client's IP address (which we do not collect).

EventInteraction.Geolocation

FieldTypeLabelDescription
country_codestring

Inferred ISO 3166-1 alpha-2 or alpha-3 country code

EventMarketingTracking

Marketing campaign tracking metadata.

🚨 SECURITY: This metadata is NEVER exported from private Sourcegraph instances, and is only exported for events tracked in the public Sourcegraph.com instance.

FieldTypeLabelDescription
urlstringoptional

URL the event occurred on.

first_source_urlstringoptional

Initial URL the user landed on.

cohort_idstringoptional

Cohort ID to identify the user as part of a specific A/B test.

referrerstringoptional

Referrer URL that refers the user to Sourcegraph.

last_source_urlstringoptional

Last source URL visited by the user.

device_session_idstringoptional

Device session ID to identify the user's session.

session_referrerstringoptional

Session referrer URL for the user.

session_first_urlstringoptional

First URL the user visited in their current session.

EventParameters

FieldTypeLabelDescription
versionint32

Version of the event parameters, used for indicating the "shape" of this

event's metadata, beginning at 0. Useful for denoting if the shape of

metadata has changed in any way.

legacy_metadataEventParameters.LegacyMetadataEntryrepeated

Legacy metadata format that only accepted int64 - use the new metadata

field instead, which accepts float values. Values sent through this proto

field will be merged into the new metadata attributes.

We don't use a [deprecated = true] tag because we use this field to handle

accepting exporters sending metadata in this format.

metadataEventParameters.MetadataEntryrepeated

Strictly typed metadata, restricted to integer values to avoid accidentally

exporting sensitive or private data.

private_metadatagoogle.protobuf.Structoptional

Additional potentially sensitive metadata - i.e. not restricted to integer

values.

🚨 SECURITY: This metadata is NOT exported from instances by default, as it

can contain arbitrarily-shaped data that may accidentally contain sensitive

or private contents.

This metadata is only exported on an allowlist basis based on terms of

use agreements and combinations of event feature and action, alongside

careful audit of callsites.

billing_metadataEventBillingMetadataoptional

Optional billing-related metadata.

EventParameters.LegacyMetadataEntry

FieldTypeLabelDescription
keystring

valueint64

EventParameters.MetadataEntry

FieldTypeLabelDescription
keystring

valuedouble

EventSource

FieldTypeLabelDescription
serverEventSource.Server

Information about the Sourcegraph instance that received the event.

clientEventSource.Clientoptional

Information about the client that generated the event.

EventSource.Client

FieldTypeLabelDescription
namestring

Source client of the event.

versionstringoptional

Version of the cleint.

EventSource.Server

FieldTypeLabelDescription
versionstring

Version of the Sourcegraph server.

EventUser

FieldTypeLabelDescription
user_idint64optional

Database user ID of signed in user. User IDs are specific to a Sourcegraph

instance, and not universal.

We use an int64 as an ID because in Sourcegraph, database user IDs are

always integers.

anonymous_user_idstringoptional

Randomized unique identifier for an actor (e.g. stored in localstorage in

web client).

Identifier

FieldTypeLabelDescription
licensed_instanceIdentifier.LicensedInstanceIdentifier

A licensed Sourcegraph instance.

unlicensed_instanceIdentifier.UnlicensedInstanceIdentifier

An unlicensed Sourcegraph instance.

Identifier.LicensedInstanceIdentifier

FieldTypeLabelDescription
license_keystring

License key configured in the Sourcegraph instance emitting the event.

instance_idstring

Self-reported Sourcegraph instance identifier.

Identifier.UnlicensedInstanceIdentifier

FieldTypeLabelDescription
instance_idstring

Self-reported Sourcegraph instance identifier.

RecordEventsRequest

FieldTypeLabelDescription
metadataRecordEventsRequestMetadata

Metadata about the events being recorded.

eventsRecordEventsRequest.EventsPayload

Batch of events to record in a single request. Clients should aim to

batch large event backlogs into a series of smaller requests in the

RecordEvents stream, being mindful of common limits in individual message

sizes: https://protobuf.dev/programming-guides/api/#bound-req-res-sizes

RecordEventsRequest.EventsPayload

FieldTypeLabelDescription
eventsEventrepeated

RecordEventsRequestMetadata

FieldTypeLabelDescription
request_idstring

Client-provided request identifier for diagnostics purposes.

identifierIdentifier

Telemetry source self-identification.

RecordEventsResponse

FieldTypeLabelDescription
succeeded_eventsstringrepeated

IDs of all events that were successfully recorded in the request.

Note that if succeeded_events is a subset of events that were submitted,

then some events failed to record and should be retried.

TelemeteryGatewayService

Method NameRequest TypeResponse TypeDescription
RecordEventsRecordEventsRequest streamRecordEventsResponse stream

RecordEvents streams telemetry events in batches to the Telemetry Gateway

service. Events should only be considered delivered if recording is

acknowledged in RecordEventsResponse.

🚨 SECURITY: Callers should check the attributes of the Event type to ensure

that only the appropriate fields are exported, as some fields should only

be exported on an allowlist basis.

Scalar Value Types

.proto TypeNotes
double
float
int32Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead.
int64Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead.
uint32Uses variable-length encoding.
uint64Uses variable-length encoding.
sint32Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s.
sint64Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s.
fixed32Always four bytes. More efficient than uint32 if values are often greater than 2^28.
fixed64Always eight bytes. More efficient than uint64 if values are often greater than 2^56.
sfixed32Always four bytes.
sfixed64Always eight bytes.
bool
stringA string must always contain UTF-8 encoded or 7-bit ASCII text.
bytesMay contain any arbitrary sequence of bytes.

On this page

  1. Telemetry Gateway

    1. Table of Contents
    1. telemetrygateway/v1/telemetrygateway.proto
    1. Scalar Value Types