Skip to content

Commit

Permalink
saved changes
Browse files Browse the repository at this point in the history
  • Loading branch information
usmangt committed May 8, 2024
1 parent 15a8b3d commit 326da39
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 0 deletions.
13 changes: 13 additions & 0 deletions docs/sources/examples/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## Sample Dashboard

For documentation on importing dashboards, check out the documentation on [grafana.com](https://grafana.com/docs/grafana/latest/reference/export_import/#importing-a-dashboard)

The sample dashboard can be obtained from either of two places.

1. From the Grafana dashboards page [located here](https://grafana.com/grafana/dashboards/14000)

2. From the official [repository](https://github.com/grafana/github-datasource/)

If loading it from the official repository, open Grafana and click "Import Dashboard".

Copy the JSON in `./src/dashboards/dashboard.json`, and paste it into the "Import via panel json" box.
19 changes: 19 additions & 0 deletions docs/sources/setup/configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## Access Token Permissions

For all repositories:

- `public_repo`
- `repo:status`
- `repo_deployment`
- `read:packages`
- `read:user`
- `user:email`

For Github projects:

- `read:org`
- `read:project`

An extra setting is required for private repositories

- `repo (Full control of private repositories)`
17 changes: 17 additions & 0 deletions docs/sources/setup/provisioning.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
### Provisioning

[It’s possible to configure data sources using config files with Grafana’s provisioning system](https://grafana.com/docs/grafana/latest/administration/provisioning/#data-sources).

#### With the [prom-operator](https://github.com/prometheus-operator/prometheus-operator)

```yaml
promop:
grafana:
additionalDataSources:
- name: GitHub Repo Insights
type: grafana-github-datasource
jsonData:
owner: ''
repository: ''
secureJsonData:
accessToken: '<github api token>'
19 changes: 19 additions & 0 deletions docs/sources/variables-and-macros/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## Variables

[Variables](https://grafana.com/docs/grafana/latest/variables/) allow you to substitute values in a panel with pre-defined values.

![Creating Variables](https://github.com/grafana/github-datasource/raw/main/docs/screenshots/variables-create.png)

You can reference them inside queries, allowing users to configure parameters such as `Query` or `Repository`.

![Using Variables inside queries](https://github.com/grafana/github-datasource/raw/main/docs/screenshots/using-variables.png)

## Macros

You can use the following macros in your queries

| Macro Name | Syntax | Description | Example |
| ---------- | -------------------------- | ------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ |
| multiVar | `$__multiVar(prefix,$var)` | Expands a multi value variable into github query string | `$__multiVar(label,$labels)` will expand into `label:first-label label:second-label` |
| | | When using **all** in multi variable, use **\*** as custom all value | |
| day | `$__toDay(diff)` | Returns the day according to UTC time, a difference in days can be added | `created:$__toDay(-7)` on 2022-01-17 will expand into `created:2022-01-10` |

0 comments on commit 326da39

Please sign in to comment.