Open Telemetry with HyperDX

deani1232PRO

a year ago

This is not exactly a Railway question but someone here might know the answer. I am trying to get a basic Open Telemetry setup with NestJS to export logs to HyperDX. The opentel data outputs to railway console, but I can't seem to get it to output to the HyperDX endpoint. Their documentation is terrible so I think I'm lost in an implementation detail. This is my tracing file as of now:

import {
  ConsoleSpanExporter,
  SimpleSpanProcessor,
} from "@opentelemetry/sdk-trace-base";
import { NodeSDK } from "@opentelemetry/sdk-node";
import { HttpInstrumentation } from "@opentelemetry/instrumentation-http";
import { ExpressInstrumentation } from "@opentelemetry/instrumentation-express";
import { NestInstrumentation } from "@opentelemetry/instrumentation-nestjs-core";
import { GraphQLInstrumentation } from "@opentelemetry/instrumentation-graphql";
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-grpc";
import { CompressionAlgorithm } from "@opentelemetry/otlp-exporter-base";

const traceExporter = new ConsoleSpanExporter();
const oltpExporter = new OTLPTraceExporter({
  url: "https://in-otel.hyperdx.io:4317",
  headers: {
    authorization: `Bearer ${process.env.HYPER_DX_API_KEY}`,
  },
  compression: CompressionAlgorithm.GZIP,
  timeoutMillis: 10000,
});

export const otelSDK = new NodeSDK({
  spanProcessors: [
    new SimpleSpanProcessor(oltpExporter),
    new SimpleSpanProcessor(traceExporter),
  ],
  instrumentations: [
    new HttpInstrumentation(),
    new ExpressInstrumentation(),
    new NestInstrumentation(),
    new GraphQLInstrumentation(),
  ],
});

// gracefully shut down the SDK on process exit
process.on("SIGTERM", () => {
  otelSDK
    .shutdown()
    .then(
      () => console.log("SDK shut down successfully"),
      (err) => console.log("Error shutting down SDK", err),
    )
    .finally(() => process.exit(0));
});

This is the docs page from their website: https://www.hyperdx.io/docs/install/opentelemetry

1 Replies

deani1232PRO

a year ago

29a5fb27-3661-4597-af03-ec799c4720cd


deani1232PRO

a year ago

After trying this same setup in a different service, I've come to the conclusion that Hyperdx simply doesn't work… You can close this thread.


a year ago

they have a discord server, have you asked there?


deani1232PRO

a year ago

Yeah. Crickets. Too bad, they were so much cheaper than new relic.


a year ago

that's unfortunate 😦


hyperdx_mikeTRIAL

a year ago

Hi there! I know it might be a bit late but just stumbled upon this post. I'm not sure if you saw Warren's response to your question on Discord when you first asked, but he suggested that you try updating the endpoint to [https://in-otel.hyperdx.io:4317/v1/traces](https://in-otel.hyperdx.io:4317/v1/traces) and remove Bearer from the authorization header (it should just be your ingestion key without anything else).

This is largely just due to the API designed by OpenTelemetry (we should double down our docs here to help make it easy for Otel SDK users to onboard as well), our distribution of the JS SDK is a bit more straightforward and documented (though with less options out of the box). https://www.hyperdx.io/docs/install/javascript