Skip to content

TelemetryService

Defined in: packages/synapse-sdk/src/telemetry/service.ts:68

Main telemetry service that manages the adapter and provides high-level APIs

new TelemetryService(): TelemetryService;

TelemetryService

sentry: SentryType | null = null;

Defined in: packages/synapse-sdk/src/telemetry/service.ts:72

protected createBeforeSend(config): SentryBeforeSendFunction;

Defined in: packages/synapse-sdk/src/telemetry/service.ts:151

Create a function that stores any events before Sentry sends to help with local debugging via debugDump. This function is intended to be set to Sentry’s beforeSend option. If the TelemetryConfig specified a beforeSend function, that function will be called after storing the event locally. The created beforeSend function is not currently doing any filtering.

ParameterType
configTelemetryConfig

SentryBeforeSendFunction

Function that can be set for beforeSend Sentry option.


protected createBeforeSendSpan(config, globalTags): (span) => SpanJSON;

Defined in: packages/synapse-sdk/src/telemetry/service.ts:177

Create a function that sanitizes span descriptions before sending to Sentry. This function is intended to be set to Sentry’s beforeSendSpan option. If the TelemetryConfig specified a beforeSendSpan function, that function will be called first, then sanitization will be applied. The sanitization replaces variable parts (UUIDs, CIDs, transaction hashes, numeric IDs) with placeholders to improve span grouping and reduce cardinality. Only applies to spans with descriptions that start with HTTP verbs (GET, POST, PUT, etc.).

In addition, we ensure op=http.client spans get the tags that were set with sentry.setTags. Without this, op=http.client spans will miss tags like synapseSdkVersion. We don’t know why op=http.client doesn’t otherwise get “global tags”, but this is our workaround. We want this so we can group by <server.address,url.sanitizedPath,http.response.status_code> and still filter by synapseSdkVersion.

ParameterType
configTelemetryConfig
globalTagsRecord<string, string>

Function that can be set for beforeSendSpan Sentry option.

(span): SpanJSON;
ParameterType
spanSpanJSON

SpanJSON


debugDump(limit): DebugDump;

Defined in: packages/synapse-sdk/src/telemetry/service.ts:226

Get debug dump for support tickets

Returns enough information for devs to dive into the data on filoz.sentry.io

ParameterTypeDefault value
limitnumber50

DebugDump

const dump = synapse.telemetry.debugDump()
console.log(JSON.stringify(dump, null, 2))

initSentry(config, context): Promise<void>;

Defined in: packages/synapse-sdk/src/telemetry/service.ts:79

This is a separate function rather than being in the constructor because it is async. This is called by initGlobalTelemetry in singleton.ts, which is called by Synapse.create in synapse.ts. Default values that make sense for synapse-sdk will be set for some Sentry configuration options if they aren’t otherwise specified. See the source for the specific defaults.

ParameterType
configTelemetryConfig
contextTelemetryRuntimeContext

Promise<void>