{"id":18872273,"url":"https://github.com/hoptical/nodegraph-api-plugin","last_synced_at":"2025-04-14T15:33:17.137Z","repository":{"id":38472374,"uuid":"415001894","full_name":"hoptical/nodegraph-api-plugin","owner":"hoptical","description":"A data source plugin for nodegraph panel in grafana","archived":false,"fork":false,"pushed_at":"2022-12-02T13:54:11.000Z","size":538,"stargazers_count":73,"open_issues_count":6,"forks_count":14,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-28T04:41:52.384Z","etag":null,"topics":["grafana","monitoring","nodegraph","rest-api"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hoptical.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-08T13:41:02.000Z","updated_at":"2025-01-26T23:57:14.000Z","dependencies_parsed_at":"2023-01-22T22:30:44.419Z","dependency_job_id":null,"html_url":"https://github.com/hoptical/nodegraph-api-plugin","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoptical%2Fnodegraph-api-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoptical%2Fnodegraph-api-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoptical%2Fnodegraph-api-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoptical%2Fnodegraph-api-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hoptical","download_url":"https://codeload.github.com/hoptical/nodegraph-api-plugin/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248906788,"owners_count":21181217,"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":["grafana","monitoring","nodegraph","rest-api"],"created_at":"2024-11-08T05:29:20.810Z","updated_at":"2025-04-14T15:33:16.558Z","avatar_url":"https://github.com/hoptical.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Nodegraph API Plugin for Grafana\n\n[![License](https://img.shields.io/github/license/hoptical/nodegraph-api-plugin)](LICENSE)\n[![CI](https://github.com/hoptical/nodegraph-api-plugin/actions/workflows/ci.yml/badge.svg)](https://github.com/hoptical/nodegraph-api-plugin/actions/workflows/ci.yml)\n[![Release](https://github.com/hoptical/nodegraph-api-plugin/actions/workflows/release.yml/badge.svg)](https://github.com/hoptical/nodegraph-api-plugin/actions/workflows/release.yml)\n\nThis plugin provides a data source to connect a REST API to [nodegraph](https://grafana.com/docs/grafana/latest/visualizations/node-graph/) panel of Grafana. It is [signed and published by Grafana](https://grafana.com/grafana/plugins/hamedkarbasi93-nodegraphapi-datasource/).\n\n![Graph Example](https://raw.githubusercontent.com/hoptical/nodegraph-api-plugin/f447b74ecefd827b388e791a34792730e9a9a11d/src/img/graph-example.png)\n\n## Requirements\n- **Grafana 7.5+**\n\n## Getting started\n\n### Installation via grafana-cli tool\n\nUse the grafana-cli tool to install Node Graph API from the commandline:\n\n```bash\ngrafana-cli plugins install hamedkarbasi93-nodegraphapi-datasource\n```\n\nThe plugin will be installed into your grafana plugins directory; the default is `/var/lib/grafana/plugins`. [More information on the cli tool](https://grafana.com/docs/grafana/latest/administration/cli/#plugins-commands).\n\n### Installation via zip file\n\nAlternatively, you can manually download the [latest](https://github.com/hoptical/nodegraph-api-plugin/releases/latest) release .zip file and unpack it into your grafana plugins directory; the default is `/var/lib/grafana/plugins`.\n\n### Plugin Configuration\n\nYou can now add the data source. Just enter the URL of your API app and push \"Save \u0026 Test.\" You will get an error in case of connection failure.\n\n![Add Datasource](https://raw.githubusercontent.com/hoptical/nodegraph-api-plugin/f447b74ecefd827b388e791a34792730e9a9a11d/src/img/add-datasource.png)\n\nIn the Grafana dashboard, pick the Nodegraph panel and visualize the graph.\n\n\u003e Note on Application Access: \n\u003e - Versions 0.x.x work in *direct* mode. i.e., The browser must have access to the API application.\n\u003e - Versions 1.x.x+ work in *proxy* mode. i.e., The Grafana server should have access to the API application.\n\n## API Configuration\n\nThe REST API application should handle three requests: *fields*, *data*, and *health*. They are described below.\n\n### Fetch Graph Fields\n\nThis route returns the nodes and edges fields defined in the [parameter tables](https://grafana.com/docs/grafana/latest/visualizations/node-graph/#data-api).\nIt would help the plugin to create desired parameters for the graph.\nFor nodes, `id` and for edges, `id`, `source`, and `target` fields are required. Other fields are optional.\n\nendpoint: `/api/graph/fields`\n\nmethod: `GET`\n\ncontent type: `application/json`\n\ncontent format example:\n\n```json\n{\n  \"edges_fields\": [\n    {\n      \"field_name\": \"id\",\n      \"type\": \"string\"\n    },\n    {\n      \"field_name\": \"source\",\n      \"type\": \"string\"\n    },\n    {\n      \"field_name\": \"target\",\n      \"type\": \"string\"\n    },\n    {\n      \"field_name\": \"mainStat\",\n      \"type\": \"number\"\n    }\n  ],\n  \"nodes_fields\": [\n    {\n      \"field_name\": \"id\",\n      \"type\": \"string\"\n    },\n    {\n      \"field_name\": \"title\",\n      \"type\": \"string\"\n    },\n    {\n      \"field_name\": \"mainStat\",\n      \"type\": \"string\"\n    },\n    {\n      \"field_name\": \"secondaryStat\",\n      \"type\": \"number\"\n    },\n    {\n      \"color\": \"red\",\n      \"field_name\": \"arc__failed\",\n      \"type\": \"number\"\n    },\n    {\n      \"color\": \"green\",\n      \"field_name\": \"arc__passed\",\n      \"type\": \"number\"\n    },\n    {\n      \"displayName\": \"Role\",\n      \"field_name\": \"detail__role\",\n      \"type\": \"string\"\n    }\n  ]\n}\n```\n\n### Fetch Graph Data\n\nThis route returns the graph data, which is intended to visualize.\n\nendpoint: `/api/graph/data`\n\nmethod: `GET`\n\ncontent type: `application/json`\n\nData Format example:\n\n```json\n{\n    \"edges\": [\n        {\n            \"id\": \"1\",\n            \"mainStat\": \"53/s\",\n            \"source\": \"1\",\n            \"target\": \"2\"\n        }\n    ],\n    \"nodes\": [\n        {\n            \"arc__failed\": 0.7,\n            \"arc__passed\": 0.3,\n            \"detail__zone\": \"load\",\n            \"id\": \"1\",\n            \"subTitle\": \"instance:#2\",\n            \"title\": \"Service1\"\n        },\n        {\n            \"arc__failed\": 0.5,\n            \"arc__passed\": 0.5,\n            \"detail__zone\": \"transform\",\n            \"id\": \"2\",\n            \"subTitle\": \"instance:#3\",\n            \"title\": \"Service2\"\n        }\n    ]\n}\n```\n\nFor more detail of the variables, please visit [here](https://grafana.com/docs/grafana/latest/visualizations/node-graph/#data-api).\n\n### Health\n\nThis route is for testing the health of the API, which is used by the *Save \u0026 Test* action while adding the plugin.[(Part 2 of the Getting Started Section)](#getting-started).\nCurrently, it only needs to return the `200` status code in case of a successful connection.\n\nendpoint: `/api/health`\n\nmethod: `GET`\n\nsuccess status code: `200`\n\n## API Example\n\nIn the `example` folder, you can find a simple API application in Python Flask.\n\n### Requirements:\n\n- flask\n\n### Run\n\n```bash\npython run.py\n```\nThe application will be started on `http://localhost:5000`\n\n## Query Configuration\nYou can pass a query string to apply for the data endpoint of the graph via *Query String*. Like any other query, you can utilize variables too:\n\n ![Add Datasource](https://raw.githubusercontent.com/hoptical/nodegraph-api-plugin/22a1933b1e012602c817817f4583697e25028382/src/img/query-string.png)\n\n With variable `$service` defined as `processors`, above query will produce this endpoint:\n `/api/graph/data?query=text1\u0026service=processors`\n## Compiling the data source by yourself\n\n1. Install dependencies\n\n   ```bash\n   yarn install\n   ```\n\n2. Build plugin in development mode or run in watch mode\n\n   ```bash\n   yarn dev\n   ```\n\n   or\n\n   ```bash\n   yarn watch\n   ```\n\n3. Build plugin in production mode\n\n   ```bash\n   yarn build\n   ```\n\n## Roadmap\n\n- [x] Utilize BackenSrv in proxy mode. This will prevent the client browser necessity to connect to the API server.\n- [ ] Write unit tests.\n\n## Learn more\n\n- [Build a data source plugin tutorial](https://grafana.com/tutorials/build-a-data-source-plugin)\n- [Grafana documentation](https://grafana.com/docs/)\n- [Grafana Tutorials](https://grafana.com/tutorials/) - Grafana Tutorials are step-by-step guides that help you make the most of Grafana\n- [Grafana UI Library](https://developers.grafana.com/ui) - UI components to help you build interfaces using Grafana Design System\n\n## Contributing\n\nThank you for considering contributing! If you find an issue or have a better way to do something, feel free to open an issue or a PR.\n\n## License\n\nThis repository is open-sourced software licensed under the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoptical%2Fnodegraph-api-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhoptical%2Fnodegraph-api-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoptical%2Fnodegraph-api-plugin/lists"}