• Stars
    star
    152
  • Rank 244,685 (Top 5 %)
  • Language
    Shell
  • Created over 4 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Grafana plugin examples

This repository contains example plugins to showcase different use cases.

App plugins

Example Description
app-basic demonstrates how to build a basic app plugin that uses custom routing.
app-with-dashboards demonstrates how to include pre-built dashboards in an app plugin.
app-with-backend demonstrates how to build an app plugin with its own backend.
app-with-extensions demonstrates how to build an app plugin that extends the Grafana core ui.
app-with-extension-point demonstrates how to add an extension point in the plugin UI that can be extended by other plugins
app-with-scenes demonstrates how to build a basic app with @grafana/scenes

Panel plugins

Example Description
panel-flot demonstrates how to use the Flot plotting library in a panel plugin.
panel-frame-select demonstrates how to update panel options with values from a data query response.
panel-plotly demonstrates how to use the Plotly graphing library in a panel plugin.
panel-scatterplot demonstrates how to use D3 and SVG to create a scatter plot panel.
panel-visx demonstrates how to use visx to create a time series graph.
panel-basic demonstrates how to build a panel plugin that uses the time series graph from @grafana/ui to read and update the dashboard time range.
panel-datalinks demonstrates how to build a panel plugin that uses the datalinks functionality of Grafana.

Data source plugins

Example Description
datasource-http demonstrates how to query data from HTTP-based APIs. The HTTP call happens on the frontend.
datasource-http-backend demonstrates how to query data from HTTP-based APIs, where the HTTP calls happens on the backend. Supports alerting.
datasource-streaming-websocket demonstrates how to create an event-based data source plugin using RxJS and web sockets.
datasource-streaming-backend-websocket demonstrates how to create an event-based data source plugin using backend streams.
datasource-basic demonstrates how to build a basic data source plugin.

Integration tests

Some of the examples in this repository contain integration tests that make use of @grafana/e2e package. These tests can be run individually by navigating to the example plugin and running one of the following commands:

  • npm run e2e - run integration tests
  • npm run e2e:open - open cypress ui and run integration tests
  • npm run e2e:update - run integration tests and update any screenshots

Testing against latest versions of Grafana

There is a github workflow .github/workflows/integration-tests.yml which finds all plugin examples identified by the existence of src/plugin.json. For every example plugin build scripts will be run to confirm the plugins can be built against intended and canary npm packages. Any example plugin that has a cypress directory defined it will run the following:

  1. Build the plugin with the provided version of Grafana packages and test against the provided version of Grafana
    • asserting the plugin works with its expected versions
  2. Build the plugin with the provided version of Grafana packages and test against the latest version of Grafana
    • asserting the plugin can run with the packages provided by the latest Grafana core
  3. Upgrade all Grafana NPM packages to the latest version and test against latest version of Grafana
    • asserting the plugin can still build with the latest Grafana NPM packages

Using the examples as the base for your plugins

All of the examples use grafana/create-plugin instead of @grafana/toolkit.

You can read more about customizing and extending the base configuration here

API Compatibility

If your plugin uses typescript you can use @grafana/levitate to test if the Grafana APIs your plugin is using are compatible with a certain version of Grafana.

e.g. to see a compatibility report of your plugin code and the latest release of the grafana APIs

npx @grafana/levitate@latest is-compatible --path src/module.ts --target @grafana/data,@grafana/ui,@grafana/runtime

you may also specify a target version

npx @grafana/levitate@latest is-compatible --path src/module.ts --target @grafana/[email protected],@grafana/[email protected],@grafana/[email protected]

The following github workflow example can be used in your project to keep an eye on the compatibility of your plugin and the grafana API.

If you host your project in GitHub and want to use GitHub Actions. You could create a new file in your project in .github/workflows/levitate.yml and put the following content:

name: Compatibility check
on: [push]

jobs:
  compatibilitycheck:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: "16"
      - name: Install dependencies
        run: yarn install
      - name: Build plugin
        run: yarn build
      - name: Compatibility check
        uses: grafana/plugin-actions/is-compatible@v1
        with:
          module: "./src/module.ts"
          comment-pr: "yes"
          fail-if-incompatible: "no"

This will run a compatibility check for the latest release of grafana plugins API in your project everytime a new push or pull request is open. If it reports an error you will see a message indicating you have an incompatibility.

Sometimes incompatibilities are minor. e.g. a type changed but this doesn't affect your plugin. We advice you to upgrade your grafana dependencies if this is the case so you always use the latest API.

More Repositories

1

grafana

The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
TypeScript
64,527
star
2

k6

A modern load testing tool, using Go and JavaScript - https://k6.io
Go
24,182
star
3

loki

Like Prometheus, but for logs.
Go
23,635
star
4

pyroscope

Continuous Profiling Platform. Debug performance issues down to a single line of code
Go
9,970
star
5

mimir

Grafana Mimir provides horizontally scalable, highly available, multi-tenant, long-term storage for Prometheus.
Go
3,925
star
6

tempo

Grafana Tempo is a high volume, minimal dependency distributed tracing backend.
Go
3,866
star
7

oncall

Developer-friendly incident response with brilliant Slack integration
Python
3,275
star
8

tanka

Flexible, reusable and concise configuration for Kubernetes
Go
2,379
star
9

grafana-zabbix

Zabbix plugin for Grafana dashboard
TypeScript
2,066
star
10

phlare

πŸ”₯ horizontally-scalable, highly-available, multi-tenant continuous profiling aggregation system
Go
2,056
star
11

helm-charts

Smarty
1,627
star
12

agent

Vendor-neutral programmable observability pipelines.
Go
1,592
star
13

alloy

OpenTelemetry Collector distribution with programmable pipelines
Go
1,357
star
14

beyla

eBPF-based autoinstrumentation of web applications and network metrics
C
1,289
star
15

grafonnet-lib

Jsonnet library for generating Grafana dashboard files.
Jsonnet
1,079
star
16

grafana-operator

An operator for Grafana that installs and manages Grafana instances, Dashboards and Datasources through Kubernetes/OpenShift CRs
Go
861
star
17

faro-web-sdk

The Grafana Faro Web SDK, part of the Grafana Faro project, is a highly configurable web SDK for real user monitoring (RUM) that instruments browser frontend applications to capture observability signals. Frontend telemetry can then be correlated with backend and infrastructure data for full-stack observability.
TypeScript
751
star
18

grafana-infinity-datasource

CSV, JSON, GraphQL, XML and HTML datasource for grafana.
TypeScript
739
star
19

grafana-docker

Grafana docker container
Shell
638
star
20

metrictank

metrics2.0 based, multi-tenant timeseries store for Graphite and friends.
Go
622
star
21

k6-operator

An operator for running distributed k6 tests.
Go
586
star
22

awesome-k6

A curated list of awesome tools, content and projects using k6
566
star
23

jsonnet-libs

Grafana Labs' Jsonnet libraries
Jsonnet
516
star
24

grizzly

A utility for managing Jsonnet dashboards against the Grafana API
Go
513
star
25

simple-json-datasource

Datasource that sends generic http requests to give url
JavaScript
502
star
26

carbon-relay-ng

Fast carbon relay+aggregator with admin interfaces for making changes online - production ready
Go
455
star
27

terraform-provider-grafana

Terraform Grafana provider
Go
408
star
28

grafana-image-renderer

A Grafana backend plugin that handles rendering of panels & dashboards to PNGs using headless browser (Chromium/Chrome)
TypeScript
363
star
29

xk6-dashboard

A k6 extension that makes k6 metrics available on a web-based dashboard.
HTML
347
star
30

grafana-kiosk

Kiosk Utility for Grafana
Go
346
star
31

xk6-browser

k6 extension that adds support for browser automation and end-to-end web testing via the Chrome Devtools Protocol
Go
339
star
32

dskit

Distributed systems kit
Go
316
star
33

intro-to-mltp

Introduction to Metrics, Logs, Traces and Profiles session companion code.
JavaScript
312
star
34

k6-learn

JavaScript
309
star
35

worldmap-panel

Worldmap panel plugin for Grafana 3.0 that can be overlaid with circles for data points.
JavaScript
306
star
36

explore-logs

Repo for the Loki log exploration app
TypeScript
291
star
37

postman-to-k6

Converts Postman collections to k6 script code
JavaScript
287
star
38

k6-template-typescript

Template to use TypeScript with k6
TypeScript
275
star
39

grafana-json-datasource

A data source plugin for loading JSON APIs into Grafana.
TypeScript
269
star
40

docker-otel-lgtm

Dockerfile
242
star
41

grafonnet

Jsonnet library for generating Grafana dashboards.
Jsonnet
229
star
42

k8s-monitoring-helm

Smarty
204
star
43

xk6

Build k6 with extensions
Go
192
star
44

dashboard-linter

A tool to lint Grafana dashboards
Go
187
star
45

strava-datasource

Strava datasource for Grafana dashboard
TypeScript
185
star
46

django-saml2-auth

Django SAML2 Authentication Made Easy. Easily integrate with SAML2 SSO identity providers like Okta, Azure AD and others.
Python
185
star
47

thema

A CUE-based framework for portable, evolvable schema
Go
185
star
48

tns

Observability Demo App
Jsonnet
185
star
49

jsonnet-language-server

A Language Server Protocol (LSP) server for Jsonnet (https://jsonnet.org)
Go
171
star
50

github-datasource

Grafana data source plugin using the Github API to retrieve and visualize Github data.
Go
169
star
51

grafana-plugin-sdk-go

A Go SDK for building backend plugins for Grafana
Go
165
star
52

synthetic-monitoring-agent

Synthetic Monitoring Agent
Go
157
star
53

cortex-tools

If you're using this tool with Grafana Mimir, please switch to "mimirtool" instead: https://github.com/grafana/mimir
Go
156
star
54

xk6-output-prometheus-remote

k6 extension to output real-time test metrics using Prometheus Remote Write.
Go
156
star
55

piechart-panel

Pie Chart Panel Plugin
JavaScript
151
star
56

grafana-plugin-repository

The plugin repository for plugins that are published on grafana.com.
JavaScript
147
star
57

mqtt-datasource

MQTT Datasource for Grafana allows streaming data from any MQTT broker running either locally or remotely.
Go
143
star
58

pyroscope-rs

Pyroscope Profiler for Rust. Profile your Rust applications.
Rust
136
star
59

grafana-ansible-collection

grafana.grafana Ansible collection provides modules and roles for managing various resources on Grafana Cloud and roles to manage and deploy Grafana Agent and Grafana
Python
130
star
60

clickhouse-datasource

Grafana Plugin for ClickHouse
TypeScript
126
star
61

google-sheets-datasource

Load Google Sheets in grafana
Go
126
star
62

har-to-k6

JSON config representation of K6 script
JavaScript
124
star
63

scribe

A tool for building elaborate CI pipelines using a familiar programming language
Go
124
star
64

kubernetes-diff-logger

Logs updates to Kubernetes Objects for storing and querying with Loki
Go
123
star
65

k6-action

[Archived] Legacy k6 GitHub Action
JavaScript
122
star
66

scenes

Build Grafana dashboards directly in your Grafana app plugins.
TypeScript
114
star
67

faro

Grafana Faro is a project for frontend application observability. It includes a highly configurable web SDK that instruments browser frontend applications to capture observability signals.
113
star
68

tutorials

A series of tutorials for helping you make the most out of Grafana.
Makefile
111
star
69

synthetic-monitoring-app

Synthetic Monitoring frontend application
TypeScript
107
star
70

cuetsy

Experimental CUE->TypeScript exporter
Go
105
star
71

grafana-api-golang-client

Grafana HTTP API Client for Go
Go
105
star
72

rollout-operator

Kubernetes Rollout Operator
Go
96
star
73

pyroscope-go

This is the golang client integration for Pyroscope
Go
94
star
74

grafana-polystat-panel

D3-Based hexagon layout multi-stat panel
TypeScript
93
star
75

xk6-disruptor

Extension for injecting faults into k6 tests
Go
93
star
76

azure-monitor-datasource

Grafana data source for Azure Monitor/Application Insights (deprecated - now included in core Grafana)
TypeScript
92
star
77

dashboard-spec

Go
91
star
78

clock-panel

Clock Panel Plugin for Grafana
TypeScript
88
star
79

k6-studio

Desktop application for Mac and Windows (Linux coming soon) designed to help you generate k6 test scripts
TypeScript
87
star
80

k6-docs

The k6 documentation website.
JavaScript
84
star
81

k6-template-es6

Template using Webpack and Babel to enable ES6 features in k6 tests
JavaScript
84
star
82

otel-profiling-go

Open Telemetry integration for Grafana Pyroscope and tracing solutions such as Grafana Tempo, Honeycomb, or Jaeger
Go
76
star
83

doom-datasource

Hackathon project
C
75
star
84

pyroscope-java

pyroscope java integration
Java
74
star
85

cortex-jsonnet

Deprecated: see https://github.com/grafana/mimir/tree/main/operations/mimir instead
Jsonnet
74
star
86

grafana-csv-datasource

A data source for loading CSV data into Grafana.
TypeScript
73
star
87

tutorial-environment

Environment for tutorial excercises
Go
70
star
88

JPProf

Go Pprof but for Java runtime.
Java
68
star
89

database-migrator

Code to export grafana.db (sqlite) to MySQL-compatible SQL file, to assist in migration of Grafana data to MySQL-compatible DB.
Shell
67
star
90

memo

easily save grafana annotations from slack mentions and the cli
Go
67
star
91

jmeter-to-k6

Converts JMeter .jmx files to k6 JS code
JavaScript
67
star
92

grafana-starter-panel

A starter for Grafana panel plugins
TypeScript
66
star
93

mimir-proxies

Proxies to help you ingest your metrics into Grafana Mimir.
Go
65
star
94

vscode-jsonnet

Full code support (formatting, highlighting, navigation, etc) for Jsonnet
JavaScript
65
star
95

xk6-sql

k6 extension to load test RDBMSs (PostgreSQL, MySQL, MS SQL and SQLite3)
Go
64
star
96

xk6-distributed-tracing

A k6 extension for distributed tracing.
Go
63
star
97

xk6-kubernetes

Client extension for interacting with Kubernetes clusters from your k6 tests.
Go
62
star
98

grafana-plugin-sdk-rust

Grafana Plugin SDK for Rust
Rust
60
star
99

regexp

Faster version of the Go regexp package
Go
60
star
100

quickpizza

Pizza, pizza, pizza!
Go
58
star