{"id":15282719,"url":"https://github.com/nioc/node-red-contrib-opentelemetry","last_synced_at":"2025-04-12T23:08:35.626Z","repository":{"id":131904292,"uuid":"611318044","full_name":"nioc/node-red-contrib-opentelemetry","owner":"nioc","description":"Node-red node for distributed tracing with OpenTelemetry SDK","archived":false,"fork":false,"pushed_at":"2025-03-16T13:53:11.000Z","size":628,"stargazers_count":9,"open_issues_count":2,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-12T23:08:22.799Z","etag":null,"topics":["node-red","node-red-contrib","opentelemetry","otel","prometheus-exporter"],"latest_commit_sha":null,"homepage":"https://flows.nodered.org/node/node-red-contrib-opentelemetry","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nioc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-08T15:22:24.000Z","updated_at":"2025-02-05T23:03:44.000Z","dependencies_parsed_at":"2023-11-30T00:25:13.267Z","dependency_job_id":"3e26c193-1fcd-41e4-952c-88076ef4a18b","html_url":"https://github.com/nioc/node-red-contrib-opentelemetry","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nioc%2Fnode-red-contrib-opentelemetry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nioc%2Fnode-red-contrib-opentelemetry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nioc%2Fnode-red-contrib-opentelemetry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nioc%2Fnode-red-contrib-opentelemetry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nioc","download_url":"https://codeload.github.com/nioc/node-red-contrib-opentelemetry/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248643004,"owners_count":21138355,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["node-red","node-red-contrib","opentelemetry","otel","prometheus-exporter"],"created_at":"2024-09-30T14:37:03.842Z","updated_at":"2025-04-12T23:08:35.607Z","avatar_url":"https://github.com/nioc.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Node-RED OpenTelemetry\n\n[![license: LGPLv3](https://img.shields.io/badge/license-LGPL--3.0--or--later-blue.svg)](https://www.gnu.org/licenses/lgpl-3.0)\n[![GitHub release](https://img.shields.io/github/release/nioc/node-red-contrib-opentelemetry.svg)](https://github.com/nioc/node-red-contrib-opentelemetry/releases/latest)\n[![GitHub Lint Workflow Status](https://img.shields.io/github/actions/workflow/status/nioc/node-red-contrib-opentelemetry/commit.yml?label=lint)](https://github.com/nioc/node-red-contrib-opentelemetry/actions/workflows/commit.yml)\n[![GitHub Publish Workflow Status](https://img.shields.io/github/actions/workflow/status/nioc/node-red-contrib-opentelemetry/publish.yml?label=publish)](https://github.com/nioc/node-red-contrib-opentelemetry/actions/workflows/publish.yml)\n[![npm](https://img.shields.io/npm/dt/node-red-contrib-opentelemetry)](https://www.npmjs.com/package/node-red-contrib-opentelemetry)\n\nDistributed tracing with OpenTelemetry SDK and Prometheus metrics exporter for Node-RED\n\n## Key features\n\n### Traces\n\n- based on [OpenTelemetry JavaScript framework](https://github.com/open-telemetry/opentelemetry-js) and [Node-RED messaging hooks](https://nodered.org/docs/api/hooks/messaging):\n  - create spans on `onSend(source)` and `postDeliver(destination)` events,\n  - end spans on `onComplete` and `postDeliver(source)` events.\n- trace includes:\n  - message id,\n  - flow id,\n  - node id,\n  - node type,\n  - node name (if filled),\n  - hostname,\n  - optional `http status code` (for request node type),\n  - optional `exception`,\n  - optional custom attributes based on message data.\n\n![Example spans in JaegerUI](https://raw.githubusercontent.com/nioc/node-red-contrib-opentelemetry/master/docs/Screenshot_01.png \"Example spans\")\n\n![Example spans to metrics in Grafana](https://raw.githubusercontent.com/nioc/node-red-contrib-opentelemetry/master/docs/Screenshot_02.png \"Example spans to metrics\")\n\n### Metrics\n\n- export of request metrics from `http in` nodes (for Prometheus scraping):\n  - method,\n  - route,\n  - status,\n  - ip\n  - duration.\n\n``` bash\ncurl http://localhost:1881/metrics\n# HELP target_info Target metadata\n# TYPE target_info gauge\ntarget_info{service_name=\"Node-RED\",telemetry_sdk_language=\"nodejs\",telemetry_sdk_name=\"opentelemetry\",telemetry_sdk_version=\"1.30.0\"} 1\n# HELP http_request_duration Response time for incoming http requests in milliseconds\n# UNIT http_request_duration ms\n# TYPE http_request_duration histogram\nhttp_request_duration_count{method=\"POST\",route=\"/api/test\",status=\"201\",ip=\"127.0.0.1\"} 5\nhttp_request_duration_sum{method=\"POST\",route=\"/api/test\",status=\"201\",ip=\"127.0.0.1\"} 620\nhttp_request_duration_bucket{method=\"POST\",route=\"/api/test\",status=\"201\",ip=\"127.0.0.1\",le=\"0\"} 0\nhttp_request_duration_bucket{method=\"POST\",route=\"/api/test\",status=\"201\",ip=\"127.0.0.1\",le=\"25\"} 0\nhttp_request_duration_bucket{method=\"POST\",route=\"/api/test\",status=\"201\",ip=\"127.0.0.1\",le=\"50\"} 4\nhttp_request_duration_bucket{method=\"POST\",route=\"/api/test\",status=\"201\",ip=\"127.0.0.1\",le=\"75\"} 4\nhttp_request_duration_bucket{method=\"POST\",route=\"/api/test\",status=\"201\",ip=\"127.0.0.1\",le=\"100\"} 4\nhttp_request_duration_bucket{method=\"POST\",route=\"/api/test\",status=\"201\",ip=\"127.0.0.1\",le=\"250\"} 4\nhttp_request_duration_bucket{method=\"POST\",route=\"/api/test\",status=\"201\",ip=\"127.0.0.1\",le=\"500\"} 4\nhttp_request_duration_bucket{method=\"POST\",route=\"/api/test\",status=\"201\",ip=\"127.0.0.1\",le=\"1000\"} 5\nhttp_request_duration_bucket{method=\"POST\",route=\"/api/test\",status=\"201\",ip=\"127.0.0.1\",le=\"2000\"} 5\nhttp_request_duration_bucket{method=\"POST\",route=\"/api/test\",status=\"201\",ip=\"127.0.0.1\",le=\"+Inf\"} 5\n```\n\n## Installation\n\nSearch `node-red-contrib-opentelemetry` within the palette manager or install with npm from the command-line (within your user data directory):\n``` bash\nnpm install node-red-contrib-opentelemetry\n```\n\nAs with every [node installation](https://nodered.org/docs/user-guide/runtime/adding-nodes), you will need to restart Node-RED for it to pick-up the new nodes.\n\n## Usage\n\n### Traces\n\n- Add OTEL node **once** (to any flow),\n- Setup the node:\n  - set OTEL [exporter](https://opentelemetry.io/docs/instrumentation/js/exporters/) url (example for Jaeger: `http://localhost:4318/v1/traces`),\n  - choose an OTLP transport protocol (`http/json` or `http/protobuf`),\n  - define a service name (will be displayed as span service),\n  - define an optional root span prefix (will be added in Node-RED root span name),\n  - define nodes that should not send traces (using comma-separated list like `debug,catch`),\n  - define nodes that should propagate [W3C trace context](https://www.w3.org/TR/trace-context/#design-overview) (in http request headers, using comma-separated list like `http request,my-custom-node`),\n  - define time in seconds after which an unmodified message will be ended and deleted,\n  - define custom attributes you want to send (optionally).\n\n### Metrics\n\n- Add Prometheus node **once** (to any flow),\n- Setup the node:\n  - set Prometheus export port and endpoint (example: `1881` and `/metrics`),\n  - define a service name (will be displayed in export),\n  - define a instrument name (will be displayed in export),\n- Add middleware to your `settings.js` file:\n  ``` js\n    // import the prometheus middleware\n    const { prometheusMiddleware } = require('node-red-contrib-opentelemetry/lib/prometheus-exporter.js')\n    // ...\n    // then add it to the existing httpNodeMiddleware attribute\n    httpNodeMiddleware: prometheusMiddleware,\n    // ...\n  ```\n\n## Versioning\n\nnode-red-contrib-opentelemetry is maintained under the [semantic versioning](https://semver.org/) guidelines.\n\nSee the [releases](https://github.com/nioc/node-red-contrib-opentelemetry/releases) on this repository for changelog.\n\n## Contributors\n\n- **[Nioc](https://github.com/nioc/)** - _Initial work_\n- **[Wodka](https://github.com/wodka/)** - _AMQP headers and `CompositePropagator` (Jaeger, W3C, B3)_\n- **[Akrpic77](https://github.com/akrpic77/)** - _MQTT v5 context fields_\n- **[joshendriks](https://github.com/joshendriks/)** - _Protobuf trace-exporter support_\n\nSee also the full list of [contributors](https://github.com/nioc/node-red-contrib-opentelemetry/graphs/contributors) to this project.\n\n## Direct dependencies\n\n- **[@opentelemetry](https://github.com/open-telemetry/opentelemetry-js)** (Apache-2.0)\n- **[jmespath](https://github.com/jmespath/jmespath.js)** (Apache-2.0)\n- **[on-finished](https://github.com/jshttp/on-finished)** (MIT)\n\n## License\n\nThis project is licensed under the GNU Lesser General Public License v3.0 - see the [LICENSE](LICENSE.md) file for details\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnioc%2Fnode-red-contrib-opentelemetry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnioc%2Fnode-red-contrib-opentelemetry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnioc%2Fnode-red-contrib-opentelemetry/lists"}