{"id":14976042,"url":"https://github.com/fifemon/graphql-datasource","last_synced_at":"2025-10-27T17:30:40.939Z","repository":{"id":42173875,"uuid":"220501969","full_name":"fifemon/graphql-datasource","owner":"fifemon","description":"Grafana datasource plugin to query data from a GraphQL API","archived":false,"fork":false,"pushed_at":"2024-02-02T11:52:03.000Z","size":2359,"stargazers_count":63,"open_issues_count":38,"forks_count":33,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-09-28T21:40:23.327Z","etag":null,"topics":["datasource-plugin","grafana","graphql-api"],"latest_commit_sha":null,"homepage":"https://grafana.com/grafana/plugins/fifemon-graphql-datasource","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fifemon.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":"2019-11-08T16:04:41.000Z","updated_at":"2023-08-08T12:00:13.000Z","dependencies_parsed_at":"2023-01-26T05:16:12.436Z","dependency_job_id":null,"html_url":"https://github.com/fifemon/graphql-datasource","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fifemon%2Fgraphql-datasource","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fifemon%2Fgraphql-datasource/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fifemon%2Fgraphql-datasource/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fifemon%2Fgraphql-datasource/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fifemon","download_url":"https://codeload.github.com/fifemon/graphql-datasource/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219860931,"owners_count":16556009,"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":["datasource-plugin","grafana","graphql-api"],"created_at":"2024-09-24T13:53:12.335Z","updated_at":"2025-10-27T17:30:40.453Z","avatar_url":"https://github.com/fifemon.png","language":"TypeScript","readme":"# GraphQL Data Source\n\n![CI](https://github.com/fifemon/graphql-datasource/workflows/CI/badge.svg)\n\n[Grafana](https://grafana.com) datasource plugin that provides access to a\nGraphQL API for numerical timeseries data, general/tabular data,\nannotations, and dashboard variables.\n\n- The GraphQL query must be structured so that the data of interest is returned\n  under the configurable data path (default `data`) in the response. If the\n  object at that path is an array it will be iterated over, with each object added\n  as a row in the data frame, otherwise the result object will be the only row.\n  - Can be separated by commas to use multiple data paths\n- Timeseries data must include a timestamp field under the data path, default\n  `Time`, in [ISO8601](https://momentjs.com/docs/#/parsing/string/) or a\n  configurable [custom\n  format](https://momentjs.com/docs/#/parsing/string-format/).\n- Nested types will be flattened into dot-delimited fields.\n- Grafana variables should be substituted directly in the query (instead of\n  using GraphQL variables). The dashboard time ranges are available in the\n  [global variables](https://grafana.com/docs/grafana/latest/variables/variable-types/global-variables/)\n  `$__from` and `$__to` as millisecond epoch (or in whatever format is needed by the API\n  in Grafana 7.1.2 or later).\n- Group by can be used to group elements into multiple data points.\n- Alias by is used to alter the name of the field displayed in the legend.\n  `$field_\u003cfield.name\u003e` is substituted with the values of the field and\n  `$fieldName` is substituted with the name of the field.\n\n# Screenshots\n\n![DeutscheBahn Arrivals Table](https://user-images.githubusercontent.com/1627510/90258294-f1bf2b00-de0d-11ea-8768-34b4ef37c125.png)\n![DeutscheBahn Arrivals Annotations](https://user-images.githubusercontent.com/1627510/90258316-f8e63900-de0d-11ea-91eb-d40532d5b768.png)\n![GitHub Security Advisories](https://user-images.githubusercontent.com/1627510/90258319-fbe12980-de0d-11ea-8ea2-c97bbc398aa4.png)\n![DeutscheBahn Station Variable](https://user-images.githubusercontent.com/1627510/110505565-e1c9aa00-80c3-11eb-85bb-10e5471fb151.png)\n\n# Examples\n\nBelow are some example queries demonstrating how to use the plugin, using the\n[FIFEMon GraphQL test source\nserver](https://github.com/fifemon/graphql-test-source/), which also includes a\n[dashboard](https://raw.githubusercontent.com/fifemon/graphql-test-source/master/doc/graphql-test-dashboard.json)\ndemonstrating these queries.\n\n## Basic timeseries\n\n```graphql\nquery {\n  data: simple_series(from: \"${__from:date:iso}\", to: \"${__to:date:iso}\", interval_ms: $__interval_ms) {\n    Time: timestamp\n    value\n  }\n}\n```\n\nNote the use of the global `$__from` and `$__to` variables to insert the\ndashboard time range into the query and the use of `$__interval_ms` to specify\nthe appropriate time interval for the graph.\n\n## Custom time format\n\n```graphql\nquery {\n  simple_series(\n    from: \"${__from:date:iso}\"\n    to: \"${__to:date:iso}\"\n    interval_ms: $__interval_ms\n    format: \"MM.dd.uuuu HHmmss\"\n  ) {\n    timestamp\n    value\n  }\n}\n```\n\n- Data path: `simple_series`\n- Time path: `timestamp`\n- Time format: `MM.DD.YYYY HHmmss`\n\n## Alias and group by\n\n```graphql\nquery {\n  complex_series(from: \"${__from:date:iso}\", to: \"${__to:date:iso}\", interval_ms: $__interval_ms) {\n    time {\n      timestamp\n    }\n    value\n    group {\n      id\n      name\n    }\n  }\n}\n```\n\n- Data path: `complex_series`\n- Time path: `time.timestamp`\n- Group by: `group.id`\n- Alias by: `$field_group.name`\n\nIn the above example, \"Group by\" and \"Alias by\" are defined. \"Group by\" allows\nyou to split up an array of data into multiple data points. \"Alias by\" is used\nas the name of the data point. You can make alias use text from the query or\neven the field name by using `$field_\u003cyour.field.name\u003e` for the value of the\nfield, or `$fieldName` for the name of the field. If `$fieldName` was used, it\nwould be replaced by \"value\" because that's the name of the field. If\n`$field_group.name` was used, it would be replaced with the value\nof `name`. Using `$fieldName` can be useful if you're querying multiple\nnumeric fields that you want displayed in your graph.\n\n## Annotations\n\n```graphql\nquery {\n  events(from: \"${__from:date:iso}\", to: \"${__to:date:iso}\", end: true) {\n    timestamp\n    end_timestamp\n    name\n    description\n    tags\n  }\n}\n```\n\n- Data path: `events`\n- Time path: `timestamp`\n- End time path: `end_timestamp`\n- Title: `$field_name`\n- Text: `$field_description`\n- Tags: `tag1, tag2`\n\nThe above annotation example is similar to regular queries. You are able to\ndefine a data path, time path, and time format. Similar to the last example, you\ncan also substitute values into the title, text, and tags by using\n`$field_\u003cfield name\u003e`. Tags are separated by commas. The above example has two\ntags: \"tag1\" and \"tag2\".\n\nIf the optional end time field is defined and present, the annotation will be\nshown over a period of time.\n\n## Dashboard Variable Queries\n\nDashboard variables can be populated by a GraphQL query that returns an array of\nobjects. If the objects contain both `__text` and `__value` fields then they\nwill be used (the `__text` field will be displayed, the `__value` field will be\nused in substitutions). Otherwise the values of all fields will be appended to\nthe variable value list.\n\n```graphql\nquery {\n  groups {\n    __value: id\n    __text: name\n  }\n}\n```\n\n- Data path: `groups`\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffifemon%2Fgraphql-datasource","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffifemon%2Fgraphql-datasource","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffifemon%2Fgraphql-datasource/lists"}