{"name":"@opentelemetry/exporter-metrics-otlp-grpc","version":"0.56.0","keywords":["opentelemetry","nodejs","grpc","tracing","profiling","metrics","stats"],"author":{"name":"OpenTelemetry Authors"},"license":"Apache-2.0","_id":"@opentelemetry/exporter-metrics-otlp-grpc@0.56.0","maintainers":[{"name":"bogdandrutu","email":"bogdandrutu@gmail.com"},{"name":"dyladan","email":"dyladan@gmail.com"},{"name":"pichlermarc","email":"marc.pichler@dynatrace.com"}],"homepage":"https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc","bugs":{"url":"https://github.com/open-telemetry/opentelemetry-js/issues"},"dist":{"shasum":"7bbd650b507e834846d1f4b0e0f1b0c1bc258fb8","tarball":"http://registry-npm.ywwl.com/@opentelemetry/exporter-metrics-otlp-grpc/download/@opentelemetry/exporter-metrics-otlp-grpc-0.56.0.tgz","fileCount":12,"integrity":"sha512-yqxN9UiIu020XYX/vny06VdQIQ7/f7f+z0xEL8QGbrO9fZB8lRMvea2pxbjqW9mzZ5m7kV6t3zsOALcEg5ky1w==","signatures":[{"sig":"MEYCIQDGtmxU1Aun9k/HpHuyOv0rRhhChXU+BScMK99Sy2tJ/QIhAJGwaRSwbi41wrux/4HByo/Wcnc8rhtrJRQ69OKVSAnR","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@opentelemetry%2fexporter-metrics-otlp-grpc@0.56.0","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":29346,"size":8885,"noattachment":false,"key":"/@opentelemetry/exporter-metrics-otlp-grpc/-/@opentelemetry/exporter-metrics-otlp-grpc-0.56.0.tgz"},"main":"build/src/index.js","types":"build/src/index.d.ts","engines":{"node":">=14"},"gitHead":"85dcbc7c55f002837f1bf1bf01145dbb34a55b40","scripts":{"tdd":"npm run test -- --watch-extensions ts --watch","lint":"eslint . --ext .ts","test":"nyc mocha 'test/**/*.test.ts'","clean":"tsc --build --clean","watch":"tsc -w","compile":"tsc --build","version":"node ../../../scripts/version-update.js","lint:fix":"eslint . --ext .ts --fix","prewatch":"npm run precompile","precompile":"cross-var lerna run version --scope $npm_package_name --include-dependencies","align-api-deps":"node ../../../scripts/align-api-deps.js","peer-api-check":"node ../../../scripts/peer-api-check.js","prepublishOnly":"npm run compile"},"_npmUser":{"name":"dyladan","email":"dyladan@gmail.com"},"repository":{"url":"git+https://github.com/open-telemetry/opentelemetry-js.git","type":"git"},"_npmVersion":"lerna/6.6.2/node@v18.20.5+x64 (linux)","description":"OpenTelemetry Collector Metrics Exporter allows user to send collected metrics to the OpenTelemetry Collector","directories":{},"sideEffects":false,"_nodeVersion":"18.20.5","dependencies":{"@grpc/grpc-js":"^1.7.1","@opentelemetry/core":"1.29.0","@opentelemetry/resources":"1.29.0","@opentelemetry/sdk-metrics":"1.29.0","@opentelemetry/otlp-transformer":"0.56.0","@opentelemetry/otlp-exporter-base":"0.56.0","@opentelemetry/otlp-grpc-exporter-base":"0.56.0","@opentelemetry/exporter-metrics-otlp-http":"0.56.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"nyc":"15.1.0","lerna":"6.6.2","mocha":"10.8.2","sinon":"15.1.2","cross-var":"1.1.0","ts-loader":"9.5.1","typescript":"4.4.4","@types/node":"18.6.5","@types/mocha":"10.0.10","@types/sinon":"17.0.3","@grpc/proto-loader":"^0.7.10","@opentelemetry/api":"1.9.0"},"peerDependencies":{"@opentelemetry/api":"^1.3.0"},"_npmOperationalInternal":{"tmp":"tmp/exporter-metrics-otlp-grpc_0.56.0_1733330033945_0.42129972786337655","host":"s3://npm-registry-packages"},"readme":"# OpenTelemetry Collector Metrics Exporter for node with grpc\n\n[![NPM Published Version][npm-img]][npm-url]\n[![Apache License][license-image]][license-image]\n\n**Note: This is an experimental package under active development. New releases may include breaking changes.**\n\nThis module provides a metrics-exporter for OTLP (gRPC) using protocol version `v1.7.0`.\n\n## Installation\n\n```bash\nnpm install --save @opentelemetry/exporter-metrics-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\nthe [OpenTelemetry Resource Semantic Conventions][semconv-resource-service-name].\nTo see sample code and documentation for the traces exporter, as well as instructions for using TLS, visit\nthe [Collector Trace Exporter for web and node][trace-exporter-url].\n\n## Metrics in Node - GRPC\n\nThe OTLPMetricsExporter in Node expects the URL to only be the hostname. It will not work with `/v1/metrics`. All\noptions that work with trace also work with metrics.\n\n```js\nconst { MeterProvider, PeriodicExportingMetricReader } = require('@opentelemetry/sdk-metrics');\nconst { OTLPMetricExporter } = require('@opentelemetry/exporter-metrics-otlp-grpc');\nconst collectorOptions = {\n  // url is optional and can be omitted - default is http://localhost:4317\n  // Unix domain sockets are also supported: 'unix:///path/to/socket.sock'\n  url: 'http://<collector-hostname>:<port>',\n};\n\nconst metricExporter = new OTLPMetricExporter(collectorOptions);\nconst meterProvider = new MeterProvider({\n  readers: [\n    new PeriodicExportingMetricReader({\n      exporter: metricExporter,\n      exportIntervalMillis: 1000,\n    }),\n  ],\n});\n\n['SIGINT', 'SIGTERM'].forEach(signal => {\n  process.on(signal, () => meterProvider.shutdown().catch(console.error));\n});\n\n// Now, start recording data\nconst meter = meterProvider.getMeter('example-meter');\nconst counter = meter.createCounter('metric_name');\ncounter.add(10, { 'key': 'value' });\n```\n\nBy default, the exporter creates a secure (TLS) connection. When connecting to a local development collector without TLS, you can use an insecure connection by specifying the `http://` scheme in the URL:\n\n```js\nconst { MeterProvider, PeriodicExportingMetricReader } = require('@opentelemetry/sdk-metrics');\nconst { OTLPMetricExporter } = require('@opentelemetry/exporter-metrics-otlp-grpc');\n\nconst collectorOptions = {\n  url: 'http://localhost:4317',  // http:// creates an insecure connection\n};\n\nconst metricExporter = new OTLPMetricExporter(collectorOptions);\nconst meterProvider = new MeterProvider({\n  readers: [\n    new PeriodicExportingMetricReader({\n      exporter: metricExporter,\n      exportIntervalMillis: 1000,\n    }),\n  ],\n});\n```\n\nAlternatively, you can explicitly configure insecure credentials:\n\n```js\nconst grpc = require('@grpc/grpc-js');\nconst { MeterProvider, PeriodicExportingMetricReader } = require('@opentelemetry/sdk-metrics');\nconst { OTLPMetricExporter } = require('@opentelemetry/exporter-metrics-otlp-grpc');\n\nconst collectorOptions = {\n  url: 'localhost:4317',\n  credentials: grpc.credentials.createInsecure(),\n};\n\nconst metricExporter = new OTLPMetricExporter(collectorOptions);\nconst meterProvider = new MeterProvider({\n  readers: [\n    new PeriodicExportingMetricReader({\n      exporter: metricExporter,\n      exportIntervalMillis: 1000,\n    }),\n  ],\n});\n```\n\n## Environment Variable Configuration\n\nIn addition to settings passed to the constructor, the exporter also supports configuration via environment variables:\n\n| Environment variable                              | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |\n| ------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| OTEL_EXPORTER_OTLP_ENDPOINT                       | The endpoint to send metrics to. This will also be used for the traces exporter if `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` is not configured. By default `localhost:4317` will be used.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |\n| OTEL_EXPORTER_OTLP_METRICS_ENDPOINT               | The endpoint to send metrics to. By default `localhost:4317` will be used.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |\n| OTEL_EXPORTER_OTLP_COMPRESSION                    | The compression type to use on OTLP trace, metric, and log requests. Options include gzip. By default no compression will be used.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |\n| OTEL_EXPORTER_OTLP_METRICS_INSECURE               | Whether to enable client transport security for the exporter's gRPC connection for metric requests. This option only applies to OTLP/gRPC when an endpoint is provided without the http or https scheme. Options include true or false. By default insecure is false which creates a secure connection.                                                                                                                                                                                                                                                                                                                                                                                  |\n| OTEL_EXPORTER_OTLP_INSECURE                       | Whether to enable client transport security for the exporter's gRPC connection for trace, metric and log requests. This option only applies to OTLP/gRPC when an endpoint is provided without the http or https scheme. Options include true or false. By default insecure is false which creates a secure connection.                                                                                                                                                                                                                                                                                                                                                                   |\n| OTEL_EXPORTER_OTLP_METRICS_CERTIFICATE            | The path to the file containing trusted root certificate to use when verifying an OTLP metric server's TLS credentials. By default the host platform's trusted root certificate is used.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |\n| OTEL_EXPORTER_OTLP_CERTIFICATE                    | The path to the file containing trusted root certificate to use when verifying an OTLP trace, metric, or log server's TLS credentials. By default the host platform's trusted root certificate is used.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |\n| OTEL_EXPORTER_OTLP_METRICS_CLIENT_KEY             | The path to the file containing private client key to use when verifying an OTLP metric client's TLS credentials. Must provide a client certificate/chain when providing a private client key. By default no client key file is used.                                                                                                                                                                                                                                                                                                                                                                                                                                                    |\n| OTEL_EXPORTER_OTLP_CLIENT_KEY                     | The path to the file containing private client key to use when verifying an OTLP trace, metric or log client's TLS credentials. Must provide a client certificate/chain when providing a private client key. By default no client key file is used.                                                                                                                                                                                                                                                                                                                                                                                                                                      |\n| OTEL_EXPORTER_OTLP_METRICS_CLIENT_CERTIFICATE     | The path to the file containing trusted client certificate/chain for clients private key to use when verifying an OTLP metric server's TLS credentials. Must provide a private client key when providing a certificate/chain. By default no chain file is used.                                                                                                                                                                                                                                                                                                                                                                                                                          |\n| OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE             | The path to the file containing trusted client certificate/chain for clients private key to use when verifying an OTLP trace, metric and log server's TLS credentials. Must provide a private client key when providing a certificate/chain. By default no chain file is used.                                                                                                                                                                                                                                                                                                                                                                                                           |\n| OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE | The exporters aggregation temporality preference. Valid values are `cumulative`, `delta`, and `lowmemory`. `cumulative` selects cumulative temporality for all instrument kinds. `delta` selects delta aggregation temporality for Counter, Asynchronous Counter and Histogram instrument kinds, and selects cumulative aggregation for UpDownCounter and Asynchronous UpDownCounter instrument kinds. `lowmemory` select delta aggregation temporality for Synchronous Counter and Histogram instrument kinds, and selects cumulative aggregation for Synchronous UpDownCounter, Asynchronous Counter and Asynchronous UpDownCounter instrument kinds. By default `cumulative` is used. |\n\n> Settings configured programmatically take precedence over environment variables. Per-signal environment variables take precedence over non-per-signal environment variables.\n\n## Running opentelemetry-collector locally to see the metrics\n\n1. Go to `examples/otlp-exporter-node`\n2. Follow the instructions there to observe the metrics.\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-metrics-otlp-grpc\n[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fexporter-metrics-otlp-grpc.svg\n[semconv-resource-service-name]: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/semantic_conventions/README.md#service\n[trace-exporter-url]: https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/exporter-trace-otlp-grpc\n","publish_time":1733330034141,"_cnpm_publish_time":1733330034141,"dist-tags":{"canary":"0.300.0-rc.0","latest":"0.301.0","next":"0.34.0"}}