@multiplayer-app/otlp-core
Version:
Multiplayer otlp core
19 lines • 1.1 kB
JavaScript
import { OTLPExporterBase } from '@opentelemetry/otlp-exporter-base';
import { convertLegacyHttpOptions, createOtlpHttpExportDelegate, } from '@opentelemetry/otlp-exporter-base/node-http';
import { MultiplayerJsonLogsSerializer } from './MultiplayerJsonLogsSerializer';
import { MULTIPLAYER_OTEL_DEFAULT_LOGS_EXPORTER_URL } from './constants.base';
/**
* Logs Exporter for Node
*/
export class MultiplayerHttpLogExporterNode extends OTLPExporterBase {
constructor(config = {}) {
const _config = Object.assign(Object.assign({}, config), { url: config.url || MULTIPLAYER_OTEL_DEFAULT_LOGS_EXPORTER_URL, headers: Object.assign(Object.assign({}, (config.headers || {})), config.apiKey
? { Authorization: config.apiKey }
: {}) });
super(createOtlpHttpExportDelegate(convertLegacyHttpOptions(_config, 'LOGS', 'v1/logs', {
'User-Agent': 'Multiplayer-OTel-OTLP-Exporter-JavaScript-LOGS',
'Content-Type': 'application/json',
}), MultiplayerJsonLogsSerializer));
}
}
//# sourceMappingURL=MultiplayerHttpLogExporterNode.js.map