{"id":15286498,"url":"https://github.com/spoof/go-grafana","last_synced_at":"2025-10-07T01:30:55.766Z","repository":{"id":57526431,"uuid":"98539932","full_name":"spoof/go-grafana","owner":"spoof","description":"Go client library for Grafana API (https://godoc.org/github.com/spoof/go-grafana/client)","archived":true,"fork":false,"pushed_at":"2018-06-21T14:24:12.000Z","size":97,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-19T20:37:49.191Z","etag":null,"topics":["client","golang","grafana","grafana-client","library"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spoof.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-27T13:36:47.000Z","updated_at":"2023-01-28T16:31:21.000Z","dependencies_parsed_at":"2022-09-07T05:30:35.712Z","dependency_job_id":null,"html_url":"https://github.com/spoof/go-grafana","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spoof%2Fgo-grafana","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spoof%2Fgo-grafana/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spoof%2Fgo-grafana/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spoof%2Fgo-grafana/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spoof","download_url":"https://codeload.github.com/spoof/go-grafana/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235575693,"owners_count":19012156,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["client","golang","grafana","grafana-client","library"],"created_at":"2024-09-30T15:15:11.665Z","updated_at":"2025-10-07T01:30:55.430Z","avatar_url":"https://github.com/spoof.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-grafana [![GoDoc](https://godoc.org/github.com/spoof/go-grafana?status.svg)](https://godoc.org/github.com/spoof/go-grafana) [![Go Report Card](https://goreportcard.com/badge/github.com/spoof/go-grafana)](https://goreportcard.com/report/github.com/spoof/go-grafana) [![Build Status](https://travis-ci.org/spoof/go-grafana.svg?branch=master)](https://travis-ci.org/spoof/go-grafana)\ngo-grafana is a Go client library for [Grafana API](http://docs.grafana.org/http_api/)\n\n## Installation\n```\ngo get -u github.com/spoof/go-grafana\n```\n\n## Usage\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"net/url\"\n\n\t\"github.com/spoof/go-grafana/client\"\n\t\"github.com/spoof/go-grafana/grafana\"\n\t\"github.com/spoof/go-grafana/grafana/panel\"\n\t\"github.com/spoof/go-grafana/grafana/query\"\n)\n\nfunc main() {\n\tconst token = \"\u003ctoken\u003e\"\n\turl, _ := url.Parse(\"http://localhost:3000/\")\n\tclient := client.NewClient(url, token, nil)\n\tctx := context.Background()\n\n\t// Create dashboard\n\td := grafana.NewDashboard(\"Title Demo\")\n\td.Tags.Set(\"tag1\", \"tag2\")\n\n\t// Add row\n\trow := grafana.NewRow()\n\trow.Title = \"Row\"\n\trow.ShowTitle = true\n \n \t// Add Graph panel\n\tp := panel.NewGraph()\n\tp.GeneralOptions().Height = \"250px\"\n\tp.GeneralOptions().Span = 2\n\tp.XAxis.Show = true\n\tp.YAxes.Left.Format = \"short\"\n\tp.YAxes.Left.Show = true\n\n\t// Graph panel with query to Prometheus datasource\n\tq := query.NewPrometheus(\"Prometheus\")\n\tq.Expression = `up{job=\"job\"}`\n\tq.Interval = \"1\"\n\tq.LegendFormat = \"{{ instance }}\"\n\n\tqueries := p.Queries()\n\t*queries = []panel.Query{q}\n\n\trow.Panels = append(row.Panels, p)\n\td.Rows = append(d.Rows, row)\n\n\toverwrite := true\n\tif err := client.Dashboards.Save(ctx, d, overwrite); err != nil {\n\t\tlog.Fatalf(\"Error while saving dashboard %s\", err)\n\t}\n\n}\n```\n\n## Current Status\n\nProject is under active development. It's not ready for production use due to high risk of API changes.\nPlease checkout out [TODO](./TODO.md) for more information what's done and what's going to be done.\n\n\n## License ##\n\nThis library is distributed under the Apache 2.0 license found in the [LICENSE](./LICENSE)\nfile.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspoof%2Fgo-grafana","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspoof%2Fgo-grafana","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspoof%2Fgo-grafana/lists"}