Coder Social home page Coder Social logo

grafana-starter-datasource-backend's Introduction

⚠️ Deprecated!

This repository is deprecated.
A more up-to-date version of examples is available here: https://github.com/grafana/grafana-plugin-examples

Available examples:


Grafana Data Source Backend Plugin Template

Build

This template is a starting point for building Grafana Data Source Backend Plugins

What is Grafana Data Source Backend Plugin?

Grafana supports a wide range of data sources, including Prometheus, MySQL, and even Datadog. There’s a good chance you can already visualize metrics from the systems you have set up. In some cases, though, you already have an in-house metrics solution that you’d like to add to your Grafana dashboards. Grafana Data Source Plugins enables integrating such solutions with Grafana.

For more information about backend plugins, refer to the documentation on Backend plugins.

Getting started

A data source backend plugin consists of both frontend and backend components.

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

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

Learn more

grafana-starter-datasource-backend's People

Contributors

andresmgot avatar bergquist avatar dependabot[bot] avatar dprokop avatar fzambia avatar hugohaggmark avatar jackw avatar kylebrandt avatar leventebalogh avatar marcusolsson avatar marefr avatar masslessparticle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

grafana-starter-datasource-backend's Issues

not work with Macbook M1 chip

the template includes dependency node-sass, but it won't work on Macbook M1 chip. Please remove node-sass and replace it with dart-sass

Can't install the plugin in a Grafana Docker container

I'm completely unable to install the plugin in a Grafana 7.0.1 container of Docker. I cloned the repository into the plugins folder and ran all build commands with no errors.

In a Docker shell, when I run grafana-cli plugins ls, I see that the plugin is technically installed, but I don't see it as a Data Source or Plugin option in the Grafana web interface. As an extra test, I added a bit of code to the Go backend which writes a simple message to a text file. Restarting Grafana didn't make the text file appear, but manually calling the executable did make it appear.

What can I do? Is there any other information I can provide that could be of help?

How to implement metricFindQuery for variables

Hello,

Thank you for the Datasource backend plugin. Do you have any examples of how to implement metricFindQuery using query POST request which returns DataFrames?
My query returns an array of strings, but I can't find how to get those values from chunk's valuesOffsets inside DataQueryResponse?

  /**
   * Variable query action.
   */
  async metricFindQuery?(query: string, options?: any): Promise<MetricFindValue[]> {
    if (!query || !options.variable.datasource) {
      return Promise.resolve([]);
    }

    const body: any = {
      queries: [
        {
          query,
          datasource: options.variable.datasource,
          datasourceId: this.id,
        },
      ],
    };

    const dqs = await getBackendSrv()
      .datasourceRequest({
        url: '/api/ds/query',
        method: 'POST',
        data: body,
        requestId: 'HOW TO GENERATE IT?',
      })
      .then((rsp: any) => {
        return toDataQueryResponse(rsp);
      })
      .catch(err => {
        // Avoid extra popup warning
        err.isHandled = true;
        return toDataQueryResponse(err);
      });

    console.log(dqs);

    return Promise.resolve([]);
  }

Thank you.

Please add variable support sample code or doc

Backend datasource plugin is very useful, great job! Thanks.

I’m developing a backend data source plugins according to the tutorial on offical tutorial build-a-data-source-backend-plugin

everything is ok, thanks the tutorial, but I have no idea how to add variables support for backend data source plugins, i found this official doc add-support-for-variables, but i don't know how to use, can you add sample code or doc in this simple-datasource-backend project?

thanks.

Add query options to backend datasource plugin

Hi, Can I get more information on how to implement query options with variable type "Query" in the backend data source plugin using Go. I am having trouble finding the documentation. I got the other variable types working using applyTemplateVariables but couldn't get much information on implementing metricFindQuery function.
Right now when I select my plugin under data source, the query field is not populating. Only the regex field shows up.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.