R
Railway•8mo ago
Deani1232

Open Telemetry with HyperDX

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));
});
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
6 Replies
Percy
Percy•8mo ago
Project ID: 29a5fb27-3661-4597-af03-ec799c4720cd
Deani1232
Deani1232•8mo ago
29a5fb27-3661-4597-af03-ec799c4720cd 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.
Brody
Brody•8mo ago
they have a discord server, have you asked there?
Deani1232
Deani1232•8mo ago
Yeah. Crickets. Too bad, they were so much cheaper than new relic.
Brody
Brody•8mo ago
that's unfortunate 😦
Duchess
Duchess•7mo ago
New reply sent from Help Station thread:
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 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, our native JS SDK is a bit more straightforward (though with less options out of the box). https://www.hyperdx.io/docs/install/javascript
You're seeing this because this thread has been automatically linked to the Help Station thread.
Want results from more Discord servers?
Add your server