Skip to content

Commit

Permalink
feat(otlp-exporter-base): allow agent override in Node exporter
Browse files Browse the repository at this point in the history
  • Loading branch information
henrinormak committed Jun 27, 2023
1 parent 10c3e93 commit 202bf4b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,17 @@ export abstract class OTLPExporterNodeBase<
parseHeaders(config.headers),
baggageUtils.parseKeyPairsIntoRecord(getEnv().OTEL_EXPORTER_OTLP_HEADERS)
);
this.agent = createHttpAgent(config);

if (
config.httpAgent !== undefined &&
config.httpAgentOptions !== undefined
) {
diag.warn(
'Both httpAgent and httpAgentOptions are set. Using httpAgent and ignoring httpAgentOptions'
);
}

this.agent = config.httpAgent ?? createHttpAgent(config);
this.compression = configureCompression(config.compression);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ export interface OTLPExporterNodeConfigBase extends OTLPExporterConfigBase {
keepAlive?: boolean;
compression?: CompressionAlgorithm;
httpAgentOptions?: http.AgentOptions | https.AgentOptions;

/**
* If provided, httpAgentOptions are ignored, and this agent is used instead.
*/
httpAgent?: http.Agent | https.Agent;
}

export enum CompressionAlgorithm {
Expand Down

0 comments on commit 202bf4b

Please sign in to comment.