Skip to content

Commit f49206f

Browse files
authored
feat: enable operational telemetry (#539)
* test: commit * feat: enable operational telemetry
1 parent cae5cb4 commit f49206f

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

runtimes/runtimes/operational-telemetry/operational-telemetry-service.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ export class OperationalTelemetryService implements OperationalTelemetry {
2727
private static instance: OperationalTelemetryService
2828
private readonly RUNTIMES_SCOPE_NAME = 'language-server-runtimes'
2929
private readonly FIVE_MINUTES = 300000
30-
private readonly FIVE_SECONDS = 5000
3130
private readonly baseResource: Resource
3231
private readonly endpoint: string
3332
private telemetryOptOut: boolean
@@ -46,7 +45,7 @@ export class OperationalTelemetryService implements OperationalTelemetry {
4645

4746
private constructor(config: OperationalTelemetryConfig) {
4847
this.exportIntervalMillis = config.exportIntervalMillis ?? this.FIVE_MINUTES
49-
this.scheduledDelayMillis = config.scheduledDelayMillis ?? this.FIVE_SECONDS
48+
this.scheduledDelayMillis = config.scheduledDelayMillis ?? this.FIVE_MINUTES
5049

5150
this.lspConsole = config.lspConsole
5251

runtimes/runtimes/util/telemetryLspServer.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ import { RuntimeProps } from '../runtime'
77
import { InitializeParams, InitializeResult } from '../../protocol'
88
import { Runtime } from '../../server-interface'
99
import { totalmem } from 'os'
10+
import { OperationalTelemetryService } from '../operational-telemetry/operational-telemetry-service'
1011

11-
const DEFAULT_TELEMETRY_GATEWAY_ENDPOINT = ''
12+
const DEFAULT_TELEMETRY_ENDPOINT = 'https://telemetry.aws-language-servers.us-east-1.amazonaws.com'
1213

1314
function setMemoryUsageTelemetry() {
1415
const optel = OperationalTelemetryProvider.getTelemetryForScope(TELEMETRY_SCOPES.RUNTIMES)
@@ -45,18 +46,18 @@ export function getTelemetryLspServer(
4546
lspServer.setInitializeHandler(async (params: InitializeParams): Promise<InitializeResult> => {
4647
const optOut = params.initializationOptions?.telemetryOptOut ?? true // telemetry disabled if option not provided
4748

48-
const endpoint = runtime.getConfiguration('TELEMETRY_GATEWAY_ENDPOINT') ?? DEFAULT_TELEMETRY_GATEWAY_ENDPOINT
49+
const endpoint = runtime.getConfiguration('TELEMETRY_GATEWAY_ENDPOINT') ?? DEFAULT_TELEMETRY_ENDPOINT
4950

50-
// const optel = OperationalTelemetryService.getInstance({
51-
// serviceName: props.name,
52-
// serviceVersion: props.version,
53-
// extendedClientInfo: params.initializationOptions?.aws?.clientInfo,
54-
// lspConsole: lspConnection.console,
55-
// endpoint: endpoint,
56-
// telemetryOptOut: optOut,
57-
// })
51+
const optel = OperationalTelemetryService.getInstance({
52+
serviceName: props.name,
53+
serviceVersion: props.version,
54+
extendedClientInfo: params.initializationOptions?.aws?.clientInfo,
55+
lspConsole: lspConnection.console,
56+
endpoint: endpoint,
57+
telemetryOptOut: optOut,
58+
})
5859

59-
// OperationalTelemetryProvider.setTelemetryInstance(optel)
60+
OperationalTelemetryProvider.setTelemetryInstance(optel)
6061

6162
setServerCrashTelemetryListeners()
6263
setMemoryUsageTelemetry()

0 commit comments

Comments
 (0)