hyperdx icon indicating copy to clipboard operation
hyperdx copied to clipboard

I'm trying to use HyperDX with Pino and the instructions in the docs don't compile

Open peter opened this issue 2 weeks ago • 6 comments
trafficstars

I'm following the instructions here:

https://www.hyperdx.io/docs/install/javascript

const logger = pino(
  pino.transport({
    mixin: HyperDX.getPinoMixinFunction,
    targets: [
      HyperDX.getPinoTransport('info', { // Send logs info and above
        detectResources: true,
      }),
    ],
  }),
);

I can't get this to compile with the latest 10.1.0 version of pino. I suppose the mixin option has been removed or moved somewhere in a new version of pino?

peter avatar Nov 03 '25 09:11 peter

Hey @peter , it should work with pino 10.0.0 since hyperdx app itself is using pino transport (https://github.com/hyperdxio/hyperdx/blob/2dc0079b084c10113443f458ef03e3f0c9bca99b/packages/api/src/utils/logger.ts#L57-L61). Could you share the errors? And I will try to repro the issue on my end

wrn14897 avatar Nov 03 '25 18:11 wrn14897

@wrn14897 on the same vein, I don't get stack traces in my Hono+Pino+Hyperdx setup, in case of an exception, is that intended? Do you know how to add stack traces?

maelp avatar Nov 10 '25 10:11 maelp

(I'm using the same configuration as the docs)

maelp avatar Nov 10 '25 10:11 maelp

@maelp , Hono is not currently supported natively in hyperdx node SDK (fwiw, you can checkout hono otel middleware https://github.com/honojs/middleware/tree/main/packages/otel). I believe you can still use recordException API to capture the exception and stack trace

wrn14897 avatar Nov 12 '25 00:11 wrn14897

Indeed, my stack is Hono + oRPC + HyperDX + Pino for logging...

So:

  • HyperDX has a way to setup otel (with Pino integration)
  • oRPC has a way to setup otel
  • Hono has a way to setup otel

and I'm not sure whether I should use just 1 of those, or all of them, etc

I thought that all the otel setup would do something like:

  • check if some setup already exists
  • if so, just add some instrumentation

Right now I'm using HyperDX setup, and adding oRPC integration as an additionalIntegration in the HyperDX setup. I do correctly see spans for Hono API calls, but not for oRPC method calls

maelp avatar Nov 12 '25 08:11 maelp

@peter If you are using ESM, I found that in standard OTEL I had to follow the module registration process here https://github.com/open-telemetry/opentelemetry-js/blob/main/doc/esm-support.md.

In Node LTS, add before setup of the SDK:

import { register } from "node:module";

register("@opentelemetry/instrumentation/hook.mjs", import.meta.url);

This was necessary to make the instrumentation work for ESM imports.

sgarfinkel avatar Nov 12 '25 15:11 sgarfinkel