{"name":"@opentelemetry/exporter-trace-otlp-grpc","version":"0.28.0","description":"OpenTelemetry Collector Exporter allows user to send collected traces to the OpenTelemetry Collector","main":"build/src/index.js","types":"build/src/index.d.ts","repository":{"type":"git","url":"git+https://github.com/open-telemetry/opentelemetry-js.git"},"scripts":{"prepublishOnly":"npm run compile","compile":"tsc --build","clean":"tsc --build --clean","lint":"eslint . --ext .ts","lint:fix":"eslint . --ext .ts --fix","tdd":"npm run test -- --watch-extensions ts --watch","test":"nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'","version":"node ../../../scripts/version-update.js","watch":"tsc -w","precompile":"lerna run version --scope $(npm pkg get name) --include-dependencies","prewatch":"npm run precompile","peer-api-check":"node ../../../scripts/peer-api-check.js","codecov":"nyc report --reporter=json && codecov -f coverage/*.json -p ../../../"},"keywords":["opentelemetry","nodejs","grpc","tracing","profiling","metrics","stats"],"author":{"name":"OpenTelemetry Authors"},"license":"Apache-2.0","engines":{"node":">=8.12.0"},"publishConfig":{"access":"public"},"devDependencies":{"@babel/core":"7.16.0","@opentelemetry/api":"^1.0.0","@opentelemetry/otlp-exporter-base":"0.28.0","@types/mocha":"8.2.3","@types/node":"14.17.33","@types/sinon":"10.0.6","codecov":"3.8.3","cpx":"1.5.0","mocha":"7.2.0","nyc":"15.1.0","rimraf":"3.0.2","sinon":"12.0.1","ts-loader":"8.3.0","ts-mocha":"8.0.0","typescript":"4.4.4"},"peerDependencies":{"@opentelemetry/api":"^1.0.0"},"dependencies":{"@grpc/grpc-js":"^1.5.9","@grpc/proto-loader":"^0.6.9","@opentelemetry/core":"1.2.0","@opentelemetry/exporter-trace-otlp-http":"0.28.0","@opentelemetry/otlp-grpc-exporter-base":"0.28.0","@opentelemetry/resources":"1.2.0","@opentelemetry/sdk-trace-base":"1.2.0"},"gitHead":"a0a670a03fd35b0799bee8cc466f79e93b5b6dd2","readme":"# OpenTelemetry Collector Exporter for node with grpc\n\n[![NPM Published Version][npm-img]][npm-url]\n[![Apache License][license-image]][license-image]\n\nThis module provides exporter for web and node to be used with [opentelemetry-collector][opentelemetry-collector-url] - last tested with version **0.25.0**.\n\n## Installation\n\n```bash\nnpm install --save @opentelemetry/exporter-trace-otlp-grpc\n```\n\n## Service Name\n\nThe OpenTelemetry Collector Exporter does not have a service name configuration.\nIn order to set the service name, use the `service.name` resource attribute as prescribed in the [OpenTelemetry Resource Semantic Conventions][semconv-resource-service-name].\nTo see documentation and sample code for the metric exporter, see the [exporter-metrics-otlp-grpc package][metrics-exporter-url]\n\n## Traces in Node - GRPC\n\nThe OTLPTraceExporter in Node expects the URL to only be the hostname. It will not work with `/v1/traces`.\n\n```js\nconst { BasicTracerProvider, SimpleSpanProcessor } = require('@opentelemetry/sdk-trace-base');\nconst { OTLPTraceExporter } =  require('@opentelemetry/exporter-trace-otlp-grpc');\n\nconst collectorOptions = {\n  // url is optional and can be omitted - default is localhost:4317\n  url: '<collector-hostname>:<port>',\n};\n\nconst provider = new BasicTracerProvider();\nconst exporter = new OTLPTraceExporter(collectorOptions);\nprovider.addSpanProcessor(new SimpleSpanProcessor(exporter));\n\nprovider.register();\n['SIGINT', 'SIGTERM'].forEach(signal => {\n  process.on(signal, () => provider.shutdown().catch(console.error));\n});\n```\n\nBy default, plaintext connection is used. In order to use TLS in Node.js, provide `credentials` option like so:\n\n```js\nconst fs = require('fs');\nconst grpc = require('@grpc/grpc-js');\n\nconst { BasicTracerProvider, SimpleSpanProcessor } = require('@opentelemetry/sdk-trace-base');\nconst { OTLPTraceExporter } =  require('@opentelemetry/exporter-trace-otlp-grpc');\n\nconst collectorOptions = {\n  // url is optional and can be omitted - default is localhost:4317\n  url: '<collector-hostname>:<port>',\n  credentials: grpc.credentials.createSsl(),\n};\n\nconst provider = new BasicTracerProvider();\nconst exporter = new OTLPTraceExporter(collectorOptions);\nprovider.addSpanProcessor(new SimpleSpanProcessor(exporter));\n\nprovider.register();\n['SIGINT', 'SIGTERM'].forEach(signal => {\n  process.on(signal, () => provider.shutdown().catch(console.error));\n});\n```\n\nTo use mutual authentication, pass to the `createSsl()` constructor:\n\n```js\n  credentials: grpc.credentials.createSsl(\n    fs.readFileSync('./ca.crt'),\n    fs.readFileSync('./client.key'),\n    fs.readFileSync('./client.crt')\n  ),\n```\n\nTo generate credentials for mutual authentication, you can refer to the script used to generate certificates for tests [here](./test/certs/regenerate.sh)\n\nThe exporter can be configured to send custom metadata with each request as in the example below:\n\n```js\nconst grpc = require('@grpc/grpc-js');\n\nconst { BasicTracerProvider, SimpleSpanProcessor } = require('@opentelemetry/sdk-trace-base');\nconst { OTLPTraceExporter } =  require('@opentelemetry/exporter-trace-otlp-grpc');\n\nconst metadata = new grpc.Metadata();\n// For instance, an API key or access token might go here.\nmetadata.set('k', 'v');\n\nconst collectorOptions = {\n  // url is optional and can be omitted - default is localhost:4317\n  url: '<collector-hostname>:<port>',\n  metadata, // // an optional grpc.Metadata object to be sent with each request\n};\n\nconst provider = new BasicTracerProvider();\nconst exporter = new OTLPTraceExporter(collectorOptions);\nprovider.addSpanProcessor(new SimpleSpanProcessor(exporter));\n\nprovider.register();\n['SIGINT', 'SIGTERM'].forEach(signal => {\n  process.on(signal, () => provider.shutdown().catch(console.error));\n});\n```\n\nNote, that this will only work if TLS is also configured on the server.\n\nBy default no compression will be used. To use compression, set it programmatically in `collectorOptions` or with environment variables. Supported compression options: `gzip` and `none`.\n\n```js\nconst { CompressionAlgorithm } = require('@opentelemetry/exporter-trace-otlp-grpc');\n\nconst collectorOptions = {\n  // url is optional and can be omitted - default is localhost:4317\n  url: '<collector-hostname>:<port>',\n  metadata, // // an optional grpc.Metadata object to be sent with each request\n  compression: CompressionAlgorithm.GZIP,\n};\nconst exporter = new OTLPTraceExporter(collectorOptions);\n```\n\n > Providing `compression` with `collectorOptions` takes precedence and overrides compression set with environment variables.\n\n## Environment Variable Configuration\n\nSet compression with environment variables.\n\n```shell\nOTEL_EXPORTER_OTLP_TRACES_COMPRESSION=gzip\n```\n\n > Compression set programatically in `collectorOptions` takes precedence over compression set with environment variables. `OTEL_EXPORTER_OTLP_TRACES_COMPRESSION` takes precedence and overrides `OTEL_EXPORTER_OTLP_COMPRESSION`.\n\n## Running opentelemetry-collector locally to see the traces\n\n1. Go to examples/otlp-exporter-node\n2. run `npm run docker:start`\n3. Open page at `http://localhost:9411/zipkin/` to observe the traces\n\n## Useful links\n\n- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>\n- For more about OpenTelemetry JavaScript: <https://github.com/open-telemetry/opentelemetry-js>\n- For help or feedback on this project, join us in [GitHub Discussions][discussions-url]\n\n## License\n\nApache 2.0 - See [LICENSE][license-url] for more information.\n\n[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions\n[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/main/LICENSE\n[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat\n[npm-url]: https://www.npmjs.com/package/@opentelemetry/exporter-trace-otlp-grpc\n[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fexporter-trace-otlp-grpc.svg\n[opentelemetry-collector-url]: https://github.com/open-telemetry/opentelemetry-collector\n[semconv-resource-service-name]: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/semantic_conventions/README.md#service\n[metrics-exporter-url]: https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/open-telemetry/opentelemetry-js/issues"},"homepage":"https://github.com/open-telemetry/opentelemetry-js#readme","_id":"@opentelemetry/exporter-trace-otlp-grpc@0.28.0","_nodeVersion":"14.18.1","_npmVersion":"lerna/3.22.1/node@v14.18.1+x64 (darwin)","dist":{"integrity":"sha512-Addr65x7rmumw7awXGH/OTTx/EFHEZ7usZ3SmMlMmvnEmBjbG+k/fwIDMw1MyGl6CGcx4Wj+IqJJSMzG0n22kw==","shasum":"c1221b843149cf39917eae9f0f0efc2bade8480d","tarball":"http://registry-npm.ywwl.com/@opentelemetry/exporter-trace-otlp-grpc/download/@opentelemetry/exporter-trace-otlp-grpc-0.28.0.tgz","fileCount":12,"unpackedSize":31297,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFjKCd3SN+vQHMSWL0xVLOhEC2S7rcfLTegNtkYilhdsAiEAy/iCu/bzM547U1c3I9oq5o3IlcUuH6zK2hzc9jKYN10="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiYsJCACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqTqQ//cHgbug3KaTnNV9JAlNSY/L3XOOzoL8+mfFCXIY8EVEJ9Y+4J\r\nnbeFrte2cKGNJWPIu1hsWNtl9wo6h9+ohejjN0dnu1O9c1VJsLWrOOv+GXhj\r\n6SyjYk10qLdg2kukQsBYjnrXqoUnrUyYhoEW+SZ+tTvFnpSDOtyeyvEXQShI\r\nh7OXOb0JA0ZXZ5JcOdrcXdf94rHgVpoh7ERXELCZPOWnP08DmWnhLHQrSTsy\r\n3NAmfWGGA2sETxREMVxZSOC/Br+dnZ2wCXHor1bJuuMavJ9XGlW5aIwl14pl\r\ni1tol3vvqZ18XJ3emlK+KS6y2K+Ua8tLlUBLvqxXEJvya8fTvTjzVytogMZm\r\nKdRv5LiPoEgomm8vNJMR/+FgODzHcl/jZPq0wolVMfGcw5Fam98E+KfQnGA8\r\n9k/nok8nVnsf7+BAxNr8oqnhMTyNn97ES6r5oUkI4gpbNGEMylTr//us1/wJ\r\nUW12MjWcLGTXMH7g75O4O//ysNpI2XbcTE7nexY9IngOtzMjjTnBaL/udnbo\r\n/8hOtiOYsBGlJTuUPsZ8IShz8dIejLf4PafNtb54jTqgyoq+JeiPI9sNXzaN\r\niFec3AflKGsu9s2xTg1ZD45hHa2Rk8oSS2R7/pt4HAbxKu1C9HIbdL8oLRjy\r\nAthSaJ/+ar8VTcNV5v4/RTuRCS2hweE2EeI=\r\n=r4TP\r\n-----END PGP SIGNATURE-----\r\n","size":9100,"noattachment":false,"key":"/@opentelemetry/exporter-trace-otlp-grpc/-/@opentelemetry/exporter-trace-otlp-grpc-0.28.0.tgz"},"_npmUser":{"name":"dyladan","email":"dyladan@gmail.com"},"directories":{},"maintainers":[{"name":"bogdandrutu","email":"bogdandrutu@gmail.com"},{"name":"dyladan","email":"dyladan@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/exporter-trace-otlp-grpc_0.28.0_1650639426471_0.9270018586410593"},"_hasShrinkwrap":false,"publish_time":1650639426631,"_cnpm_publish_time":1650639426631,"dist-tags":{"canary":"0.300.0-rc.0","latest":"0.301.0","next":"0.34.0"}}