Skip to content

Commit

Permalink
NGSTN-1241 Farster coldstart with HTTP/protobuf exporters (#55)
Browse files Browse the repository at this point in the history
* Use http/proto exporter instead of grpc to reduce the cost of loading libraries

* Disable tracing/metrics of http exporter
  • Loading branch information
RafalSumislawski authored Dec 4, 2024
1 parent 7cd64e4 commit 6b730a6
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 488 deletions.
6 changes: 5 additions & 1 deletion nodejs/packages/cx-wrapper/instrumentation-init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Instrumentation, registerInstrumentations } from '@opentelemetry/instru
import { NormalizedResponse, AwsSdkRequestHookInformation, AwsSdkResponseHookInformation } from '@opentelemetry/instrumentation-aws-sdk';
import { PgResponseHookInformation } from '@opentelemetry/instrumentation-pg';
import { OTEL_PAYLOAD_SIZE_LIMIT, OtelAttributes, parseBooleanEnvvar } from './common';
import { RequestOptions } from 'http';

declare global {
function configureInstrumentations(): Instrumentation[]
Expand Down Expand Up @@ -50,7 +51,10 @@ function defaultConfigureInstrumentations(): Instrumentation[] {

if (parseBooleanEnvvar("OTEL_INSTRUMENTATION_HTTP_ENABLED") ?? defaults) {
const { HttpInstrumentation } = require('@opentelemetry/instrumentation-http');
instrumentations.push(new HttpInstrumentation());
instrumentations.push(new HttpInstrumentation({
ignoreOutgoingRequestHook: (request: RequestOptions) =>
request.hostname === "localhost" && Number(request.port) === 4318,
}));
}

if (parseBooleanEnvvar("OTEL_INSTRUMENTATION_IOREDIS_ENABLED") ?? defaults) {
Expand Down
Loading

0 comments on commit 6b730a6

Please sign in to comment.