Skip to content

Adding Telemetry increase in startup time #852

Closed Answered by askareija
askareija asked this question in Q&A
Discussion options

You must be logged in to vote

I've resolved it by using another instance and use lazy load module.

in main.ts:

app.use(import("./otel"));

then create new Elysia instance otel.ts:

import { BatchSpanProcessor } from "@opentelemetry/sdk-trace-node";
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-proto";
import { APP_NAME, OTEL_BACKEND_HOST } from "../utils/constants";
import Elysia from "elysia";
import { opentelemetry } from "@elysiajs/opentelemetry";

const spanProcessor = new BatchSpanProcessor(
  new OTLPTraceExporter({
    url: `http://${OTEL_BACKEND_HOST}/v1/traces`,
  })
);

const otelModule = new Elysia({
  prefix: "otel",
});
otelModule.use(
  opentelemetry({
    serviceName: APP_NAME,
    s…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by askareija
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant