Skip to content

Grafana Datasource Plugin for querying data from Neo4j with cypher

License

Notifications You must be signed in to change notification settings

b509/grafana-datasource-plugin-neo4j

 
 

Repository files navigation

CI GitHub release (latest SemVer)

Neo4j DataSource for Grafana

Allows Neo4j to be used as a DataSource for Grafana

Showcase/Quickstart

Starts preprovisioned Grafana and Neo4j

sudo docker-compose up

Screenshots and Plugin Manual

Plugin Manual

Changelog

Installation

Development - Getting started

Frontend

Optional: Use Docker for building with yarn

sudo docker run --rm -w /app -it -v $(pwd):/app node:14.17.3-alpine ash

Change into plugin directory

cd neo4j-datasource-plugin

Install dependencies

yarn install

Build Plugin in development mode

yarn dev

Build Plugin in watch mode (development mode with auto build on change) You need to hit refresh in browser to load the changes!

yarn watch

Build plugin in production mode

yarn build

Execute Prettier

yarn prettier --write .

Backend

NOTE: Depending on your version of go you might need go get -u instead of go install.

Optional: Use Docker for building with go

sudo docker run --rm -w /app -it -v $(pwd):/app golang:1.16 bash
go install github.com/magefile/mage
  1. Update Grafana plugin SDK for Go dependency to the latest minor version:

    go install github.com/grafana/grafana-plugin-sdk-go
    go mod tidy
  2. Build with go:

    go install ./...
    go build ./...
  3. Build backend plugin binaries for Linux, Windows and Darwin:

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

    mage -l
  5. Run all tests & coverage:

    Important: Start Docker-Compose environment first!

    sudo docker-compose -f docker-compose.dev.yaml up
    mage coverage
  6. Run tests which are independet of Docker-Compose environment

    mage coverageShort

Test with Grafana

Starts preprovisioned Grafana and Neo4J for development

sudo docker-compose -f docker-compose.dev.yaml up

Grafana: http://localhost:3000

Neo4J: http://localhost:7474

Grafana is started by docker-compose in development mode therefore no restart of grafana is required when source code changed.

Run example queries

Nodes

Match(m:Movie) return m

Tabledata

Match(m:Movie) return m.title, m.tagline

Timeseriesdata

return datetime() - duration({minutes: 1})  as Time, 99 as Test
UNION ALL
return datetime() - duration({minutes: 2})  as Time, 85 as Test
UNION ALL
return datetime() - duration({minutes: 3})  as Time, 86 as Test
UNION ALL
return datetime() - duration({minutes: 4})  as Time, 100 as Test
UNION ALL
return datetime() - duration({minutes: 5})  as Time, 32 as Test

Signing

Sign plugin as private

cd neo4j-datasource-plugin
export GRAFANA_API_KEY=<GRAFANA_API_KEY>
yarn sign --rootUrls http://localhost:3000/

Sign plugin as community

cd neo4j-datasource-plugin
export GRAFANA_API_KEY=<GRAFANA_API_KEY>
yarn sign

Learn more

About

Grafana Datasource Plugin for querying data from Neo4j with cypher

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 64.9%
  • TypeScript 22.5%
  • Shell 11.3%
  • JavaScript 1.3%