Skip to content

Commit 504e12f

Browse files
authored
Remove auto http instrumentation for privacy (#205)
1 parent 3f40e33 commit 504e12f

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

src/schema/GetSchemaTask.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import { Logger } from 'pino';
33
import { AwsCredentials } from '../auth/AwsCredentials';
44
import { DataStore } from '../datastore/DataStore';
55
import { CfnService } from '../services/CfnService';
6-
import { Measure } from '../telemetry/TelemetryDecorator';
6+
import { ScopedTelemetry } from '../telemetry/ScopedTelemetry';
7+
import { Measure, Telemetry } from '../telemetry/TelemetryDecorator';
78
import { AwsRegion } from '../utils/Region';
89
import { downloadFile } from '../utils/RemoteDownload';
910
import { PrivateSchemas, PrivateSchemasType } from './PrivateSchemas';
@@ -19,6 +20,9 @@ export abstract class GetSchemaTask {
1920
}
2021

2122
export class GetPublicSchemaTask extends GetSchemaTask {
23+
@Telemetry()
24+
private readonly telemetry!: ScopedTelemetry;
25+
2226
static readonly MaxAttempts = 3;
2327
private attempts = 0;
2428

@@ -38,6 +42,7 @@ export class GetPublicSchemaTask extends GetSchemaTask {
3842
}
3943

4044
this.attempts++;
45+
this.telemetry.count(`getSchemas.${this.region}`, 1);
4146
const schemas = await this.getSchemas(this.region);
4247
const value: RegionalSchemasType = {
4348
version: RegionalSchemas.V1,

src/schema/SchemaRetriever.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import { DateTime } from 'luxon';
22
import { SettingsConfigurable, ISettingsSubscriber, SettingsSubscription } from '../settings/ISettingsSubscriber';
33
import { DefaultSettings, ProfileSettings } from '../settings/Settings';
44
import { LoggerFactory } from '../telemetry/LoggerFactory';
5-
import { TelemetryService } from '../telemetry/TelemetryService';
5+
import { ScopedTelemetry } from '../telemetry/ScopedTelemetry';
6+
import { Telemetry } from '../telemetry/TelemetryDecorator';
67
import { Closeable } from '../utils/Closeable';
78
import { AwsRegion, getRegion } from '../utils/Region';
89
import { CombinedSchemas } from './CombinedSchemas';
@@ -18,7 +19,9 @@ export class SchemaRetriever implements SettingsConfigurable, Closeable {
1819
private settingsSubscription?: SettingsSubscription;
1920
private settings: ProfileSettings = DefaultSettings.profile;
2021
private readonly log = LoggerFactory.getLogger(SchemaRetriever);
21-
private readonly telemetry = TelemetryService.instance.get('SchemaRetriever');
22+
23+
@Telemetry()
24+
private readonly telemetry!: ScopedTelemetry;
2225

2326
constructor(
2427
private readonly schemaTaskManager: GetSchemaTaskManager,

src/telemetry/OTELInstrumentation.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,7 @@ export function otelSdk(clientId: string, client?: ClientInfo) {
7777
enabled: false,
7878
},
7979
'@opentelemetry/instrumentation-http': {
80-
ignoreOutgoingRequestHook: (request) => {
81-
if (!request.hostname) {
82-
return false;
83-
}
84-
85-
return telemetryUrl.includes(request.hostname);
86-
},
80+
enabled: false,
8781
},
8882
'@opentelemetry/instrumentation-runtime-node': {
8983
monitoringPrecision: ExportIntervalSeconds * 1000,

0 commit comments

Comments
 (0)