TelemetryService
Defined in: packages/synapse-sdk/src/telemetry/service.ts:68
Main telemetry service that manages the adapter and provides high-level APIs
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new TelemetryService(): TelemetryService;Returns
Section titled “Returns”TelemetryService
Properties
Section titled “Properties”sentry
Section titled “sentry”sentry: SentryType | null = null;Defined in: packages/synapse-sdk/src/telemetry/service.ts:72
Methods
Section titled “Methods”createBeforeSend()
Section titled “createBeforeSend()”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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
config | TelemetryConfig |
Returns
Section titled “Returns”SentryBeforeSendFunction
Function that can be set for beforeSend Sentry option.
createBeforeSendSpan()
Section titled “createBeforeSendSpan()”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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
config | TelemetryConfig |
globalTags | Record<string, string> |
Returns
Section titled “Returns”Function that can be set for beforeSendSpan Sentry option.
(span): SpanJSON;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
span | SpanJSON |
Returns
Section titled “Returns”SpanJSON
debugDump()
Section titled “debugDump()”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
Parameters
Section titled “Parameters”| Parameter | Type | Default value |
|---|---|---|
limit | number | 50 |
Returns
Section titled “Returns”Example
Section titled “Example”const dump = synapse.telemetry.debugDump()console.log(JSON.stringify(dump, null, 2))initSentry()
Section titled “initSentry()”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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
config | TelemetryConfig |
context | TelemetryRuntimeContext |
Returns
Section titled “Returns”Promise<void>