{"id":25775,"library":"jaeger-client-utility","title":"Jaeger Client Utility","description":"A lightweight wrapper around the Jaeger client (opentracing) that simplifies tracing setup and span management for Node.js services. Current stable version is 1.0.1 (last updated 2020). It provides a simple API to initialize the tracer, start spans, and inject/extract context for distributed tracing. This package is a thin layer over the official jaeger-client library, intended for quick integration but may lack flexibility for advanced use cases. No breaking changes documented; the package relies on opentracing as a peer dependency. Compared to the official jaeger-client, it reduces boilerplate but hides configuration options like sampling and reporter settings.","status":"maintenance","version":"1.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/devit-tel/jaeger-client-utility","tags":["javascript","jaeger","jaeger-client","opentracing"],"install":[{"cmd":"npm install jaeger-client-utility","lang":"bash","label":"npm"},{"cmd":"yarn add jaeger-client-utility","lang":"bash","label":"yarn"},{"cmd":"pnpm add jaeger-client-utility","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency required for FORMAT_HTTP_HEADERS and span types.","package":"opentracing","optional":true}],"imports":[{"note":"Package uses default export; CommonJS require works but TypeScript users prefer ESM. In CJS, use `const jaegerClient = require('jaeger-client-utility').default` or import syntax.","wrong":"const jaegerClient = require('jaeger-client-utility')","symbol":"default","correct":"import jaegerClient from 'jaeger-client-utility'"},{"note":"init expects an object with serviceName, not a string.","wrong":"jaegerClient.init('my-service')","symbol":"jaegerClient.init","correct":"jaegerClient.init({ serviceName: 'my-service' })"},{"note":"Child span context is passed as an object via the second argument, not separate parameters.","wrong":"jaegerClient.startSpan('op', FORMAT_HTTP_HEADERS, headers)","symbol":"jaegerClient.startSpan","correct":"jaegerClient.startSpan('operationName', { isChild: { format: FORMAT_HTTP_HEADERS, injectData: headers } })"}],"quickstart":{"code":"import jaegerClient from 'jaeger-client-utility';\nimport { FORMAT_HTTP_HEADERS } from 'opentracing';\n\njaegerClient.init({ serviceName: 'my-service' });\n\nconst span = jaegerClient.startSpan('my-operation');\ntry {\n  // Simulate work\n} finally {\n  span.finish();\n}\n\n// For distributed tracing:\nconst parentSpan = jaegerClient.startSpan('parent');\nconst headers = {};\njaegerClient.inject(FORMAT_HTTP_HEADERS, headers);\nparentSpan.finish();\n\n// In downstream service:\nconst childSpan = jaegerClient.startSpan('child', {\n  isChild: {\n    format: FORMAT_HTTP_HEADERS,\n    injectData: headers\n  }\n});\nchildSpan.finish();","lang":"typescript","description":"Initializes Jaeger tracer, starts a span, and demonstrates distributed tracing with injection and extraction."},"warnings":[{"fix":"Use the official jaeger-client directly if you need custom sampler or agent location.","message":"Package does not expose configuration for Jaeger agent host/port or sampler; defaults to localhost:6831 and const sampler.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Consider migrating to OpenTelemetry-based instrumentation.","message":"The opentracing API is deprecated in favor of OpenTelemetry. This package still uses opentracing.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Install @types/opentracing and create a declaration file: declare module 'jaeger-client-utility';","message":"Package has no TypeScript type definitions; users must declare module or use @types/opentracing.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Replace `const client = new JaegerClient()` with `import jaegerClient from 'jaeger-client-utility'` and use `jaegerClient.init()`.","message":"In version 1.0.0, the default export was changed from a class to an object with methods. Previous 0.x versions used `new JaegerClient()`.","severity":"breaking","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use ES import or `const jaegerClient = require('jaeger-client-utility').default;`","cause":"In CJS, require returns the module object; the default export is not automatically assigned.","error":"TypeError: jaegerClient.init is not a function"},{"fix":"Call `jaegerClient.init({ serviceName: 'your-service' })`","cause":"Called init() without arguments or with a string instead of an object.","error":"Error: No serviceName provided. Must pass serviceName to init."},{"fix":"Add `import { FORMAT_HTTP_HEADERS } from 'opentracing';`","cause":"Missing import from opentracing package.","error":"ReferenceError: FORMAT_HTTP_HEADERS is not defined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}