Remove the recheck callback since it isn't necessary for now

This commit is contained in:
David Baker 2023-04-05 19:00:07 +01:00
parent 88f3b30040
commit caea22fa89

View file

@ -40,7 +40,20 @@ export class ElementCallOpenTelemetry {
private _otlpExporter: OTLPTraceExporter; private _otlpExporter: OTLPTraceExporter;
static globalInit(): void { static globalInit(): void {
recheckOTelEnabledStatus(); // we always enable opentelemetry in general. We only enable the OTLP
// collector if a URL is defined (and in future if another setting is defined)
// The posthog exporteer is always enabled, posthog reporting is enabled or disabled
// within the posthog code.
const shouldEnableOtlp = Boolean(Config.get().opentelemetry?.collector_url);
if (!sharedInstance || sharedInstance.isOtlpEnabled !== shouldEnableOtlp) {
logger.info("(Re)starting OpenTelemetry debug reporting");
sharedInstance?.dispose();
sharedInstance = new ElementCallOpenTelemetry(
Config.get().opentelemetry?.collector_url
);
}
} }
static get instance(): ElementCallOpenTelemetry { static get instance(): ElementCallOpenTelemetry {
@ -101,20 +114,3 @@ export class ElementCallOpenTelemetry {
return this._anonymity; return this._anonymity;
} }
} }
function recheckOTelEnabledStatus(): void {
// we always enable opentelemetry in general. We only enable the OTLP
// collector if a URL is defined (and in future if another setting is defined)
// The posthog exporteer is always enabled, posthog reporting is enabled or disabled
// within the posthog code.
const shouldEnableOtlp = Boolean(Config.get().opentelemetry?.collector_url);
if (!sharedInstance || sharedInstance.isOtlpEnabled !== shouldEnableOtlp) {
logger.info("(Re)starting OpenTelemetry debug reporting");
sharedInstance?.dispose();
sharedInstance = new ElementCallOpenTelemetry(
Config.get().opentelemetry?.collector_url
);
}
}