Skip to content

Commit

Permalink
chore: format, debug statements, rm metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
tokebe committed Dec 14, 2023
1 parent 9502f59 commit 799a45e
Showing 1 changed file with 15 additions and 27 deletions.
42 changes: 15 additions & 27 deletions src/controllers/opentelemetry.js
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.");

0 comments on commit 799a45e

Please sign in to comment.