Skip to content

pgollangi/firestore-grafana-datasource

Repository files navigation

CI Release

firestore-grafana-datasource

Google Firestore Data Source Plugin for Grafana.

Grafana Firestore Data Source Plugin enables integrating data on Firestore into Grafana dashboards.

It uses FireQL to capture user query that translated to issue queries on Firestore and construct results.

FireQL is a Go library to query Google Firestore database using SQL syntax.

Features

  • Use Google Firestore as a data source for Grafana dashboards
  • Configure Firestore data source with GCP Project Id and Service Account for authentication
  • Store Service Account data source configuration in Grafana encrypted storage Secure JSON Data
  • Query Firestore collections and path to collections
  • Auto detect data types: string, number, boolean, json, time.Time
  • Query selected fields from the collection
  • Order query results
  • Limit query results
  • Query Collection Groups
  • Count query results
  • Use of Grafafa global variables in queries.

Firestore data source configuration

Using datasource

Getting started

Frontend

  1. Install dependencies

    yarn install
  2. Build plugin in development mode or run in watch mode

    yarn dev
    
    # or
    
    yarn watch
  3. Build plugin in production mode

    yarn build
  4. Run the tests (using Jest)

    # Runs the tests and watches for changes
    yarn test
    
    # Exists after running all the tests
    yarn lint:ci
  5. Spin up a Grafana instance and run the plugin inside it (using Docker)

    yarn server
  6. Run the E2E tests (using Cypress)

    # Spin up a Grafana instance first that we tests against 
    yarn server
    
    # Start the tests
    yarn e2e
  7. Run the linter

    yarn lint
    
    # or
    
    yarn lint:fix

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

Push a version tag

To trigger the workflow we need to push a version tag to github. This can be achieved with the following steps:

  1. Run npm version <major|minor|patch>
  2. Run git push origin main --follow-tags

Contributing

Thanks for considering contributing to this project!

Please read the Contributions and Code of conduct.

Feel free to open an issue or submit a pull request!

License

MIT