Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including @opentelemetry/propagator-grpc-census-binary with all npm packages installed. Try it out:

var propagatorGrpcCensusBinary = require("@opentelemetry/propagator-grpc-census-binary")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

@opentelemetry/propagator-grpc-census-binary v0.9.0

OpenTelemetry gRPC Census propagator provides a context propagator for OpenTelemetry that can use the gRPC binary header: 'grpc-trace-bin' for interoperability with OpenCensus

OpenTelemetry Propagator gRPC Census

Gitter chat NPM Published Version dependencies devDependencies Apache License

OpenTelemetry gRPC Census propagator provides gRPC header propagation for systems that use the OpenCensus 'grpc-trace-bin' binary header format. This allows for context propagation when either:

  • incoming gRPC calls come from services already instrumented using OpenCensus
  • outgoing gRPC calls go to services already instrumented using OpenCensus

This propagator works in conjunction with the OpenTelemetry gRPC plugin.

Example of usage:

const { NodeTracerProvider } = require('@opentelemetry/node');
const { GrpcCensusPropagator } = require("@opentelemetry/propagator-grpc-census-binary");

const provider = new NodeTracerProvider({
  plugins: {
    grpc: {
      enabled: true,
      path: '@opentelemetry/plugin-grpc',

// Register GrpcCensusPropagator so we can propagate content using
// the 'grpc-trace-bin' header in our incoming/outgoing gRPC calls.
  propagator: new GrpcCensusPropagator()

Also, see examples/grpc-census-prop for a worked example that shows when this propagator can be useful.

Implementation Details

See binary-format.ts for equivalent encoding/decoding of the format in OpenCensus. Note: the author of the OpenCensus binary format, @mayurkale22, also created BinaryTraceContext.ts in opentelemetry-core but that was subsequently removed as part of PR #804. The implementation of GrpcCensusPropagator in this module uses a version of BinaryTraceContext.ts inspired by Mayur's previous work (with minor modifications e.g. there is no longer a BinaryFormat interface to implement).

Useful links


Apache 2.0 - See LICENSE for more information.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free