-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: format, debug statements, rm metrics
- Loading branch information
Showing
1 changed file
with
15 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,22 @@ | ||
/*instrumentation.js*/ | ||
const opentelemetry = require('@opentelemetry/sdk-node'); | ||
const { | ||
getNodeAutoInstrumentations, | ||
} = require('@opentelemetry/auto-instrumentations-node'); | ||
const { | ||
OTLPTraceExporter, | ||
} = require('@opentelemetry/exporter-trace-otlp-proto'); | ||
const { | ||
OTLPMetricExporter, | ||
} = require('@opentelemetry/exporter-metrics-otlp-proto'); | ||
const { PeriodicExportingMetricReader, ConsoleMetricExporter } = require('@opentelemetry/sdk-metrics'); | ||
const { Resource } = require('@opentelemetry/resources') | ||
const { ConsoleSpanExporter } = require('@opentelemetry/sdk-trace-node'); | ||
const opentelemetry = require("@opentelemetry/sdk-node"); | ||
const { getNodeAutoInstrumentations } = require("@opentelemetry/auto-instrumentations-node"); | ||
const { OTLPTraceExporter } = require("@opentelemetry/exporter-trace-otlp-proto"); | ||
const { OTLPMetricExporter } = require("@opentelemetry/exporter-metrics-otlp-proto"); | ||
const { PeriodicExportingMetricReader, ConsoleMetricExporter } = require("@opentelemetry/sdk-metrics"); | ||
const { Resource } = require("@opentelemetry/resources"); | ||
const { ConsoleSpanExporter } = require("@opentelemetry/sdk-trace-node"); | ||
const Debug = require("debug"); | ||
const debug = Debug("bte:biothings-explorer:otel-init"); | ||
|
||
debug("Initializing Opentelemetry instrumentation..."); | ||
const sdk = new opentelemetry.NodeSDK({ | ||
traceExporter: new OTLPTraceExporter({ | ||
url: process.env.JAEGER_URL ?? 'http://localhost:4318/v1/traces', | ||
// optional - collection of custom headers to be sent with each request, empty by default | ||
headers: {}, | ||
}), | ||
metricReader: new PeriodicExportingMetricReader({ | ||
exporter: new OTLPMetricExporter({ | ||
url: process.env.JAEGER_URL ?? 'http://localhost:4318/v1/traces', | ||
headers: {}, // an optional object containing custom headers to be sent with each request | ||
concurrencyLimit: 1, // an optional limit on pending requests | ||
}), | ||
url: process.env.JAEGER_URL ?? "http://localhost:4318/v1/traces", | ||
}), | ||
instrumentations: [getNodeAutoInstrumentations()], | ||
resource: new Resource({ | ||
"service.name": "biothings-explorer" | ||
}) | ||
"service.name": "biothings-explorer", | ||
}), | ||
}); | ||
sdk.start(); | ||
sdk.start(); | ||
debug("Opentelemetry instrumentation initialized."); |