Skip to content

HarperFast/grafana-datasource

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

440 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Grafana data source plugin for Harper

Getting started

Requires Grafana 11.6.11 or higher (specifically 11.6.11+, 12.0.10+, 12.1.7+, or 12.2.5+), including Grafana 13.x (React 19).

  1. The Harper plug-in is published in Grafana’s catalog and can be installed from there.
  2. Once installed, create a new Grafana Data Source using the plugin.
  3. Configure the full URL to your Harper cluster's operations API (defaults to port 9925)
  4. By default a data source returns analytics only for the single node it targets. To get cluster-wide analytics there are two options:
    • (Recommended) Enable "Aggregate analytics across cluster nodes" in the data source settings. Point the data source at any single node; it fans get_analytics queries out to that node's peers and merges the results, splitting series by the originating node. This requires Harper 5.1.13 or later (the release that fixed cluster-wide get_analytics fan-out — the option exists from 5.1.0 but did not return peers' rows until 5.1.13) and does not require analytics replication to be enabled. On earlier Harper you simply get the queried node's own analytics — not an error, just not cluster-wide.
    • Or enable analytics replication by setting ANALYTICS_REPLICATE=true on all nodes in the cluster (it is off by default), then target the GTM URL.
  5. Configure a Harper username and password that has permission to use the analytics ops in the Operations API.
  6. Dashboards can be created using same data source (one very basic example dashboard included with plugin)
  7. Please refer to the analytics Operations API docs for detailed information on what’s available to query.

Development

Backend

  1. Update Grafana plugin SDK for Go dependency to the latest minor version:

    go get -u github.com/grafana/grafana-plugin-sdk-go
    go mod tidy
  2. Build backend plugin binaries for Linux, Windows and Darwin:

    mage -v
  3. List all available Mage targets for additional commands:

    mage -l

Frontend

  1. Install dependencies

    npm install
  2. Build plugin in development mode and run in watch mode

    npm run dev
  3. Build plugin in production mode

    npm run build
  4. Run the tests (using Jest)

    # Runs the tests and watches for changes, requires git init first
    npm run test
    
    # Exits after running all the tests
    npm run test:ci
  5. Spin up a Grafana instance and run the plugin inside it (using Docker)

    npm run server
  6. Run the E2E tests (using Playwright)

    # Spins up a Grafana instance first that we tests against
    npm run server
    
    # Starts the tests
    npm run e2e
  7. Run the linter

    npm run lint
    
    # or
    
    npm run lint:fix

Dev workflow

  1. Run npm run dev in one terminal
    • This will watch your frontend code for changes
  2. Build the backend: mage -v build:linuxARM64
    • Because this will run in a Docker container, you should always build it for Linux
    • You will have to manually rerun this when the backend code changes
  3. Run docker compose up in another terminal
    • This will need to be restarted when the backend is rebuilt
  4. Access Grafana at http://localhost:3000/

About

Grafana datasource plugin for Harper

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages