# @opentelemetry/propagator-grpc-census-binary

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

Latest version **0.27.2** (published 2024-04-25) · Apache-2.0 license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @opentelemetry/propagator-grpc-census-binary
pnpm add @opentelemetry/propagator-grpc-census-binary
yarn add @opentelemetry/propagator-grpc-census-binary
bun add @opentelemetry/propagator-grpc-census-binary
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.27.2 |
| Published | 2024-04-25 |
| First published | 2020-06-02 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=14 |
| Dependencies | 0 |
| Unpacked size | 46.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 928 |
| Author | OpenTelemetry Authors |
| Maintainers | pichlermarc, bogdandrutu, dyladan |
| Keywords | opentelemetry, nodejs, tracing, grpc, opencensus |

## Links

- npm: https://www.npmjs.com/package/@opentelemetry/propagator-grpc-census-binary
- Repository: https://github.com/open-telemetry/opentelemetry-js-contrib
- Homepage: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/propagators/opentelemetry-propagator-grpc-census-binary#readme
- Issues: https://github.com/open-telemetry/opentelemetry-js-contrib/issues
- npm.io page: https://npm.io/package/@opentelemetry/propagator-grpc-census-binary

## Recent versions

- 0.27.2 (latest) — 2024-04-25
- 0.27.1 — 2023-08-14
- 0.27.0 — 2023-07-12
- 0.26.1 — 2023-05-16
- 0.26.0 — 2022-05-24
- 0.25.1 — 2022-01-24
- 0.25.0 — 2021-09-15
- 0.24.0 — 2021-07-29
- 0.23.0 — 2021-07-02
- 0.22.0 — 2021-06-23
- 0.21.0 — 2021-06-16
- 0.20.0 — 2021-06-04
- 0.16.0 — 2021-04-26
- 0.15.0 — 2021-04-05
- 0.14.0 — 2021-03-05
- … 8 more at https://npm.io/package/@opentelemetry/propagator-grpc-census-binary/versions

## README

# OpenTelemetry Propagator gRPC Census

[![NPM Published Version][npm-img]][npm-url]
[![Apache License][license-image]][license-image]

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](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/exporter-trace-otlp-grpc).

Example of usage:

```javascript
const { NodeTracerProvider } = require('@opentelemetry/sdk-trace-node');
const { GrpcCensusPropagator } = require('@opentelemetry/propagator-grpc-census-binary');
const { registerInstrumentations } = require('@opentelemetry/instrumentation');
const { GrpcInstrumentation } = require('opentelemetry/instrumentation-grpc');

const provider = new NodeTracerProvider();

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

registerInstrumentations({
  instrumentations: [
    new GrpcInstrumentation(),
  ],
});

```

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

## Implementation Details

See [binary-format.ts](https://github.com/census-instrumentation/opencensus-node/blob/master/packages/opencensus-propagation-binaryformat/src/binary-format.ts) for equivalent encoding/decoding of the format in OpenCensus. Note: the author of the OpenCensus binary format, [@mayurkale22](https://github.com/mayurkale22), also created BinaryTraceContext.ts in [opentelemetry-core](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-core) but that was subsequently removed as part of PR [#804](https://github.com/open-telemetry/opentelemetry-js/pull/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

* For more information on OpenTelemetry, visit: <https://opentelemetry.io/>
* For more about OpenTelemetry JavaScript: <https://github.com/open-telemetry/opentelemetry-js>
* For help or feedback on this project, join us in [GitHub Discussions][discussions-url]

## License

Apache 2.0 - See [LICENSE][license-url] for more information.

[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions
[license-url]: https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/LICENSE
[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
[npm-url]: https://www.npmjs.com/package/@opentelemetry/propagator-grpc-census-binary
[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fpropagator-grpc-census-binary.svg

---
_Source: https://npm.io/package/@opentelemetry/propagator-grpc-census-binary · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
