Is your feature request related to a problem? Please describe.
As part of integrating Honeycomb and open telemetry in - https://github.com/netlify/build - we've spotted there's a set of console warnings that always show up when initialising the SDK:
|
// warn if api key is missing |
|
if (!opts.apiKey) { |
|
console.warn(MISSING_API_KEY_ERROR); |
|
} |
|
|
|
// warn if service name is missing |
|
if (!opts.serviceName) { |
|
console.warn(MISSING_SERVICE_NAME_ERROR); |
|
} |
|
|
|
// warn if dataset is set while using an environment-aware key |
|
if (opts.apiKey && !isClassic(opts.apiKey) && opts.dataset) { |
|
console.warn(IGNORED_DATASET_ERROR); |
|
} |
|
|
|
// warn if dataset is missing if using classic key |
|
if (opts.apiKey && isClassic(opts.apiKey) && !opts.dataset) { |
|
console.warn(MISSING_DATASET_ERROR); |
|
} |
We're using an open telemetry collector which exports traces to Honeycomb directly, however we would still like to leverage the packaged spanProcessor, traceExporter, etc. that the @honeycombio/opentelemetry-node module exports.
|
export class HoneycombSDK extends NodeSDK { |
|
constructor(options?: HoneycombOptions) { |
|
const opts = computeOptions(options); |
|
super({ |
|
...opts, |
|
serviceName: opts?.serviceName, |
|
resource: configureHoneycombResource(opts), |
|
metricReader: getHoneycombMetricReader(opts), |
|
spanProcessor: configureBatchWithBaggageSpanProcessor(opts), |
|
sampler: configureDeterministicSampler(opts?.sampleRate), |
|
}); |
|
|
|
if (opts.debug) { |
|
diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.DEBUG); |
|
diag.debug(JSON.stringify(opts, null, 2)); |
|
} |
|
} |
|
} |
These warnings however won't let us use the SDK directly in prod since our process execution is customer facing and so are the logs it produces (including the warnings mentioned above ☝️) and for which we have no control over.
Describe the solution you'd like
Having a way to optionally disable the logs? Either by only logging when opts.debug === true or by having a specific flag we could check? (e.g. opts.skipOptionsValidation or something like that)
Describe alternatives you've considered
I guess we can manually setup our own NodeSDK and potentially use the components this module exports directly, something like (still struggling with some type incompatibilies which I think are related with the versions imported):
Nevertheless I think it's extra setup work we could bypass if we had a way to bypass the warning logs 👍
Additional context
Is your feature request related to a problem? Please describe.
As part of integrating Honeycomb and open telemetry in - https://github.com/netlify/build - we've spotted there's a set of console warnings that always show up when initialising the SDK:
honeycomb-opentelemetry-node/src/honeycomb-options.ts
Lines 108 to 126 in ed5b096
We're using an open telemetry collector which exports traces to Honeycomb directly, however we would still like to leverage the packaged
spanProcessor,traceExporter, etc. that the@honeycombio/opentelemetry-nodemodule exports.honeycomb-opentelemetry-node/src/opentelemetry-node.ts
Lines 15 to 32 in ed5b096
These warnings however won't let us use the SDK directly in prod since our process execution is customer facing and so are the logs it produces (including the warnings mentioned above ☝️) and for which we have no control over.
Describe the solution you'd like
Having a way to optionally disable the logs? Either by only logging when
opts.debug === trueor by having a specific flag we could check? (e.g.opts.skipOptionsValidationor something like that)Describe alternatives you've considered
I guess we can manually setup our own
NodeSDKand potentially use the components this module exports directly, something like (still struggling with some type incompatibilies which I think are related with the versions imported):Nevertheless I think it's extra setup work we could bypass if we had a way to bypass the warning logs 👍
Additional context