Registry / devops / sasdn-middleware-grpc-zipkin

sasdn-middleware-grpc-zipkin

JSON →
library0.1.5jsnpmunverified

Provides Zipkin distributed tracing instrumentation for gRPC applications using the SASDN framework. Version 0.1.5 is the latest stable release. It wraps gRPC clients and server middleware to automatically propagate trace context and record spans. Differentiators: tightly integrated with SASDN ecosystem, supports both server middleware and client proxy patterns, and allows custom tracer configuration. Compared to general-purpose Zipkin libraries, this package is purpose-built for SASDN-based microservices, offering a simple API for adding tracing without manual instrumentation.

npm install sasdn-middleware-grpc-zipkin
INSTALL
IMPORT
SIG · SASDN-MIDDLEWARE-G
S
sasdn-middleware-grpc-zipkin
devopsjavascriptv0.1.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

GrpcInstrumentation
import { GrpcInstrumentation } from 'sasdn-middleware-grpc-zipkin'
const GrpcInstrumentation = require('sasdn-middleware-grpc-zipkin').GrpcInstrumentation
Default export not available; must use named import. Works in both ESM and CJS contexts, but named import syntax is consistent.
Tracer
import { Tracer } from 'zipkin'
import Tracer from 'zipkin'
This is not from this package, but a required peer dependency. The import is named from the 'zipkin' package.
RpcApplication
import { RpcApplication } from 'sasdn'
import RpcApplication from 'sasdn'
Named import from 'sasdn' package, not default.

Shows how to set up the Zipkin middleware for a SASDN gRPC server.

import { Tracer, ExplicitContext, ConsoleRecorder } from 'zipkin'; import { GrpcInstrumentation } from 'sasdn-middleware-grpc-zipkin'; import { RpcApplication } from 'sasdn'; const tracer = new Tracer({ ctxImpl: new ExplicitContext(), recorder: new ConsoleRecorder() }); const app = new RpcApplication(); app.use(GrpcInstrumentation.middleware({ tracer })); app.start();
Debug
Known issues
gotchaThe 'tracer' option can be set to 'false' to disable tracing, but this is easy to miss when reading documentation.
fix
Ensure 'tracer' is either a valid Tracer instance or explicit 'false'; do not omit entirely.
affects: >=0.1.0
gotchaThe 'proxyClient' function expects a gRPC client that matches the generated stub; passing an incorrect type will cause runtime errors.
fix
Use 'GrpcInstrumentation.proxyClient()' only with valid 'grpc.Client' instances.
affects: all
deprecatedThe 'grpc' package used in examples is the legacy library; consider using '@grpc/grpc-js' for modern gRPC.
fix
Replace 'import * as grpc from 'grpc'' with 'import * as grpc from '@grpc/grpc-js''.
affects: all
breakingRequires 'zipkin' package as a peer dependency; version conflicts may cause unstable tracing.
fix
Install compatible 'zipkin' version as per package.json peerDependencies.
affects: >=0.1.0
Errors
Common errors & fixes
TypeError: GrpcInstrumentation.middleware is not a function
Importing the default export instead of named import.
fix
Use '{ GrpcInstrumentation }' in the import statement.
Cannot find module 'sasdn-middleware-grpc-zipkin' or its corresponding type declarations.
Package not installed or missing types.
fix
Run 'npm install sasdn-middleware-grpc-zipkin' and ensure TypeScript can resolve the module.
Error: No tracer provided. Tracing disabled.
Calling middleware or proxyClient without a tracer or with undefined.
fix
Pass a valid 'zipkin.Tracer' instance in the options object.
TypeError: client.makeUnaryRequest is not a function
Using a gRPC client that is not a proper gRPC.Client instance from 'grpc' or '@grpc/grpc-js'.
fix
Instantiate the client correctly, e.g., 'new MyServiceClient('address', grpc.credentials.createInsecure())'.
Upgrade
Version history
0.1.5latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
7 hits · last 30 days
node
6
Resources
sasdn-middleware-grpc-zipkin — npm install sasdn-middleware-grpc-zipkin · libregistry