Giter VIP home page Giter VIP logo

grafana-app-sdk's Introduction

grafana-app-sdk

Build Status Release Status


This repository is currently experimental, which means that interfaces and behavior may change as it evolves.


The grafana-app-sdk is an SDK used for developing apps/extensions for grafana. It encompasses the following:

  • Code generation and project boilerplate generation from a CLI
  • Storage and version management of unique schemas (kinds)
  • An reconciler/event-based model for handling changes to data
  • Both simple building blocks and opinionated solutions for building operators and plugins
  • An interface layer over your storage system, allowing any compatible API-server-like system to be plugged in

Quickstart

If you want to try out using the SDK, there is a tutorial to build a simple issue tracker which starts you from zero and brings you through to deploying a simple app built using the SDK.

Installation of the CLI

go install

The simplest way to install the CLI is with go install. To get the latest version, use:

go install github.com/grafana/grafana-app-sdk/cmd/grafana-app-sdk@latest

(ensure that your GOPATH/bin (typically $HOME/go/bin) is in your PATH)

Binary

If you prefer to download a binary and add it to your PATH, you can install a binary from the releases page:

  1. Visit the latest release page
  2. Find the appropriate artifact for your OS and architecture
  3. Download the artifact and untar it into your PATH

Once you have a version of the CLI installed, you can test it with:

grafana-app-sdk version

Which will print the version of the CLI which you have installed.

App Design

An agnotic view of an app using the SDK looks like:

Application Using SDK Diagram

The SDK handles interaction with the storage system, and surfacing simple interfaces for performing normal operations on resources in storage, as well as creating controller/operator loops that react to changes in the resources in the storage system.

A typical grafana app deployment might look more like:

Application Using SDK Diagram

For more details on application design, see App Design.

CLI Usage

Full CLI usage is covered in CLI docs page, but for a brief overview of the commands:

Command Description
version Prints the version (use -v for a verbose print)
generate Generates code from your CUE kinds (defaults to CUE in schemas, use -c/--cuepath to speficy a different CUE path)
project init <module name> Creates a project template, including directory structure, go module, CUE module, and Makefile
project component add <component> Add boilerplate code for a component to your project. <component> options are frontend, backend, and operator
project local init Initialize the ./local directory for a local development environment (done automatically by project init)
project local generate Generate a YAML bundle for local deployment, based on your CUE kinds and ./local/config.yaml

Library Usage

Read more about the library usage in the docs directory.

resource

Package exposing interfaces for resources and client, and the various kind of Store objects, which allow you to use key/value store-like objects for handling your data.

See Resource Objects and Resource Stores for more information on how to work with resource Objects and use Store objects.

operator

Package containing operator code, for building out event-based and/or reconciler-based operators.

See Operators & Event-Based Design for more details on building operators.

k8s

Implementation of a storage layer using a kubernetes-compatible API server.

plugin

Wrapper for the grafana backend plugin go SDK which adds layers on top for dealing with lazy-loading, encoding kube configs in secure JSON data, and HTTP-like routing.

See Writing Back-End Plugins for more details on using the plugin package.

Dependencies

The grafana-app-sdk code generation uses kindsys for it's CUE kind definitions, and thema for the generated code's unmarshaling.

If you use the generated code, you must take a project dependency on thema, as it is used as a depndency in the generated code (kindsys is only used in the generation process, and is not needed in your project).

Further Reading

Please see the /docs directory for full documentation, or take a look at the Design Patterns, Kubernetes Concepts, or the tutorial.

The examples directory contains runnable example projects that use different SDK components.

Each package also contains a README.md detailing package usage and simple examples.

Contributing

See our contributing guide for instructions on how to contribute to the development of the SDK.

grafana-app-sdk's People

Contributors

dependabot[bot] avatar ifsentient avatar radiohead avatar

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.