|
1 | | -# Grafana data source plugin template |
| 1 | +# openGemini data source plugin |
2 | 2 |
|
3 | | -This template is a starting point for building a Data Source Plugin for Grafana. |
| 3 | +OpenGemini is a global open-source cloud-native distributed time series database. It provides standalone and distributed versions with excellent read and write performance and efficient data analysis capabilities. Supports mainstream development languages and multi-form deployment (such as cloud, Docker, and physical machine), integrates storage and analysis, and is easy to expand. It is dedicated to efficiently storing and analyzing massive time series data in IoT and O&M monitoring scenarios to further reduce enterprise operation and O&M costs and improve product quality and production efficiency. |
4 | 4 |
|
5 | | -## What are Grafana data source plugins? |
| 5 | +## Configure the data source |
6 | 6 |
|
7 | | -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. |
| 7 | +To configure basic settings for the data source, complete the following steps: |
8 | 8 |
|
9 | | -## Getting started |
| 9 | +1. Click **Connections** in the left-side menu. |
| 10 | +1. Under Your connections, click **Data sources**. |
| 11 | +1. Enter `openGemini` in the search bar. |
| 12 | +1. Select **openGemini**. |
10 | 13 |
|
11 | | -### Frontend |
| 14 | + The **Settings** tab of the data source is displayed. |
12 | 15 |
|
13 | | -1. Install dependencies |
| 16 | +1. Set the data source's basic configuration options carefully |
14 | 17 |
|
15 | | - ```bash |
16 | | - npm install |
17 | | - ``` |
| 18 | +| Name | Description | |
| 19 | +| --------------------- | ------------------------------------------------------------------------------------------------------ | |
| 20 | +| **Name** | Sets the name you use to refer to the data source in panels and queries. | |
| 21 | +| **Default** | Sets whether the data source is pre-selected for new panels. | |
| 22 | +| **URL** | The HTTP protocol, IP address, and port of your openGemini API. openGemini's default API port is 8086. | |
| 23 | +| **Min time interval** | _(Optional)_ Refer to [Min time interval](#configure-min-time-interval). | |
| 24 | +| **Database** | Sets the database name to query | |
18 | 25 |
|
19 | | -2. Build plugin in development mode and run in watch mode |
| 26 | +1. network settings |
20 | 27 |
|
21 | | - ```bash |
22 | | - npm run dev |
23 | | - ``` |
| 28 | +| Name | Description | |
| 29 | +| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | |
| 30 | +| **Access** | Only Server access mode is functional. Direct browser access is deprecated. | |
| 31 | +| **Allowed cookies** | Defines which cookies are forwarded to the data source.All other cookies are deleted | |
| 32 | +| **User** | Sets the username to sign into openGemini | |
| 33 | +| **Password** | Sets the password to sign into openGemini | |
| 34 | +| **HTTP mode** | Sets the HTTP method used to query your data source.The POST verb allows for larger queries that would return an error using the GET verb.Defaults to GET. | |
24 | 35 |
|
25 | | -3. Build plugin in production mode |
| 36 | +## Min time interval |
26 | 37 |
|
27 | | - ```bash |
28 | | - npm run build |
29 | | - ``` |
| 38 | +The **Min time interval** setting defines a lower limit for the auto group-by time interval. |
30 | 39 |
|
31 | | -4. Run the tests (using Jest) |
| 40 | +This value must be formatted as a number followed by a valid time identifier: |
32 | 41 |
|
33 | | - ```bash |
34 | | - # Runs the tests and watches for changes, requires git init first |
35 | | - npm run test |
36 | | - |
37 | | - # Exits after running all the tests |
38 | | - npm run test:ci |
39 | | - ``` |
40 | | - |
41 | | -5. Spin up a Grafana instance and run the plugin inside it (using Docker) |
42 | | - |
43 | | - ```bash |
44 | | - npm run server |
45 | | - ``` |
46 | | - |
47 | | -6. Run the E2E tests (using Cypress) |
48 | | - |
49 | | - ```bash |
50 | | - # Spins up a Grafana instance first that we tests against |
51 | | - npm run server |
52 | | - |
53 | | - # Starts the tests |
54 | | - npm run e2e |
55 | | - ``` |
56 | | - |
57 | | -7. Run the linter |
58 | | - |
59 | | - ```bash |
60 | | - npm run lint |
61 | | - |
62 | | - # or |
63 | | - |
64 | | - npm run lint:fix |
65 | | - ``` |
66 | | - |
67 | | -# Distributing your plugin |
68 | | - |
69 | | -When distributing a Grafana plugin either within the community or privately the plugin must be signed so the Grafana application can verify its authenticity. This can be done with the `@grafana/sign-plugin` package. |
70 | | - |
71 | | -_Note: It's not necessary to sign a plugin during development. The docker development environment that is scaffolded with `@grafana/create-plugin` caters for running the plugin without a signature._ |
72 | | - |
73 | | -## Initial steps |
74 | | - |
75 | | -Before signing a plugin please read the Grafana [plugin publishing and signing criteria](https://grafana.com/docs/grafana/latest/developers/plugins/publishing-and-signing-criteria/) documentation carefully. |
76 | | - |
77 | | -`@grafana/create-plugin` has added the necessary commands and workflows to make signing and distributing a plugin via the grafana plugins catalog as straightforward as possible. |
78 | | - |
79 | | -Before signing a plugin for the first time please consult the Grafana [plugin signature levels](https://grafana.com/docs/grafana/latest/developers/plugins/sign-a-plugin/#plugin-signature-levels) documentation to understand the differences between the types of signature level. |
80 | | - |
81 | | -1. Create a [Grafana Cloud account](https://grafana.com/signup). |
82 | | -2. Make sure that the first part of the plugin ID matches the slug of your Grafana Cloud account. |
83 | | - - _You can find the plugin ID in the plugin.json file inside your plugin directory. For example, if your account slug is `acmecorp`, you need to prefix the plugin ID with `acmecorp-`._ |
84 | | -3. Create a Grafana Cloud API key with the `PluginPublisher` role. |
85 | | -4. Keep a record of this API key as it will be required for signing a plugin |
86 | | - |
87 | | -## Signing a plugin |
88 | | - |
89 | | -### Using Github actions release workflow |
90 | | - |
91 | | -If the plugin is using the github actions supplied with `@grafana/create-plugin` signing a plugin is included out of the box. The [release workflow](./.github/workflows/release.yml) can prepare everything to make submitting your plugin to Grafana as easy as possible. Before being able to sign the plugin however a secret needs adding to the Github repository. |
92 | | - |
93 | | -1. Please navigate to "settings > secrets > actions" within your repo to create secrets. |
94 | | -2. Click "New repository secret" |
95 | | -3. Name the secret "GRAFANA_API_KEY" |
96 | | -4. Paste your Grafana Cloud API key in the Secret field |
97 | | -5. Click "Add secret" |
98 | | - |
99 | | -#### Push a version tag |
100 | | - |
101 | | -To trigger the workflow we need to push a version tag to github. This can be achieved with the following steps: |
102 | | - |
103 | | -1. Run `npm version <major|minor|patch>` |
104 | | -2. Run `git push origin main --follow-tags` |
105 | | - |
106 | | -## Learn more |
107 | | - |
108 | | -Below you can find source code for existing app plugins and other related documentation. |
109 | | - |
110 | | -- [Basic data source plugin example](https://github.com/grafana/grafana-plugin-examples/tree/master/examples/datasource-basic#readme) |
111 | | -- [Plugin.json documentation](https://grafana.com/docs/grafana/latest/developers/plugins/metadata/) |
112 | | -- [How to sign a plugin?](https://grafana.com/docs/grafana/latest/developers/plugins/sign-a-plugin/) |
| 42 | +| Identifier | Description | |
| 43 | +| ---------- | ----------- | |
| 44 | +| `y` | year | |
| 45 | +| `M` | month | |
| 46 | +| `w` | week | |
| 47 | +| `d` | day | |
| 48 | +| `h` | hour | |
| 49 | +| `m` | minute | |
| 50 | +| `s` | second | |
| 51 | +| `ms` | millisecond | |
0 commit comments