Skip to content

Commit

Permalink
issue-156: change plugin id to Grafana naming convention
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitryk-dk committed Dec 16, 2024
1 parent efcbc6b commit c26e6c5
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .config/webpack/constants.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export const SOURCE_DIR = 'src';
export const DIST_DIR = 'plugins/victorialogs-datasource';
export const DIST_DIR = 'plugins/victoriametrics-logs-datasource';
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ ifeq ($(PKG_TAG),)
PKG_TAG := $(BUILDINFO_TAG)
endif

PLUGIN_ID=victorialogs-datasource
APP_NAME=victorialogs_backend_plugin
PLUGIN_ID=victoriametrics-logs-datasource
APP_NAME=victoriametrics_logs_backend_plugin

GO_BUILDINFO = -X 'github.com/grafana/grafana-plugin-sdk-go/build.buildInfoJSON={\"time\":${DATEINFO_TAG},\"id\":\"${PLUGIN_ID}\",\"version\":\"${BUILDINFO_TAG}\",\"branch\":\"${PKG_TAG}\"}'

Expand Down Expand Up @@ -74,7 +74,7 @@ vl-plugin-pack: vl-plugin-build
sha256sum dist/$(PACKAGE_NAME).tar.gz > dist/$(PACKAGE_NAME)_checksums_tar.gz.txt

vl-plugin-cleanup:
rm -rf ./victorialogs-datasource plugins
rm -rf ./victoriametrics-logs-datasource plugins

vl-plugin-release: \
vl-plugin-pack \
Expand Down
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ the following changes to Grafana's `grafana.ini` config:

``` ini
[plugins]
allow_loading_unsigned_plugins = victorialogs-datasource
allow_loading_unsigned_plugins = victoriametrics-logs-datasource
```

If using `grafana-operator`, adjust `config` section in your `kind=Grafana` resource as below:

```
config:
plugins:
allow_loading_unsigned_plugins: "victorialogs-datasource"
allow_loading_unsigned_plugins: "victoriametrics-logs-datasource"
```

For detailed instructions on how to install the plugin in Grafana Cloud or locally,
Expand All @@ -43,7 +43,7 @@ datasources:
# displayed in Grafana panels and queries.
- name: VictoriaLogs
# <string, required> Sets the data source type.
type: victorialogs-datasource
type: victoriametrics-logs-datasource
# <string, required> Sets the access mode, either
# proxy or direct (Server or Browser in the UI).
access: proxy
Expand All @@ -67,8 +67,8 @@ Please find the example of provisioning Grafana instance with VictoriaLogs datas
grafana:
image: grafana/grafana:11.0.0
environment:
- GF_INSTALL_PLUGINS=https://github.com/VictoriaMetrics/victorialogs-datasource/releases/download/v0.12.0/victorialogs-datasource-v0.12.0.zip;victorialogs-datasource
- GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=victorialogs-datasource
- GF_INSTALL_PLUGINS=https://github.com/VictoriaMetrics/victorialogs-datasource/releases/download/v0.12.0/victoriametrics-logs-datasource-v0.12.0.zip;victoriametrics-logs-datasource
- GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=victoriametrics-logs-datasource
ports:
- 3000:3000/tcp
volumes:
Expand All @@ -95,15 +95,15 @@ Option 1. Using Grafana provisioning:

``` yaml
env:
GF_INSTALL_PLUGINS: "https://github.com/VictoriaMetrics/victorialogs-datasource/releases/download/v0.12.0/victorialogs-datasource-v0.12.0.zip;victorialogs-datasource"
GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS: "victorialogs-datasource"
GF_INSTALL_PLUGINS: "https://github.com/VictoriaMetrics/victorialogs-datasource/releases/download/v0.12.0/victoriametrics-logs-datasource-v0.12.0.zip;victoriametrics-logs-datasource"
GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS: "victoriametrics-logs-datasource"
```

Option 2. Using Grafana plugins section in `values.yaml`:

``` yaml
plugins:
- https://github.com/VictoriaMetrics/victorialogs-datasource/releases/download/v0.12.0/victorialogs-datasource-v0.12.0.zip;victorialogs-datasource
- https://github.com/VictoriaMetrics/victorialogs-datasource/releases/download/v0.12.0/victoriametrics-logs-datasource-v0.12.0.zip;victoriametrics-logs-datasource
```

Option 3. Using init container:
Expand All @@ -124,7 +124,7 @@ extraInitContainers:
set -ex
mkdir -p /var/lib/grafana/plugins/
ver=$(curl -s -L https://api.github.com/repos/VictoriaMetrics/victorialogs-datasource/releases/latest | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+' | head -1)
curl -L https://github.com/VictoriaMetrics/victorialogs-datasource/releases/download/$ver/victorialogs-datasource-$ver.tar.gz -o /var/lib/grafana/plugins/vl-plugin.tar.gz
curl -L https://github.com/VictoriaMetrics/victorialogs-datasource/releases/download/$ver/victoriametrics-logs-datasource-$ver.tar.gz -o /var/lib/grafana/plugins/vl-plugin.tar.gz
tar -xf /var/lib/grafana/plugins/vl-plugin.tar.gz -C /var/lib/grafana/plugins/
rm /var/lib/grafana/plugins/vl-plugin.tar.gz
volumeMounts:
Expand Down Expand Up @@ -184,15 +184,15 @@ spec:
set -ex
mkdir -p /var/lib/grafana/plugins/
ver=$(curl -s https://api.github.com/repos/VictoriaMetrics/victorialogs-datasource/releases/latest | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+' | head -1)
curl -L https://github.com/VictoriaMetrics/victorialogs-datasource/releases/download/$ver/victorialogs-datasource-$ver.tar.gz -o /var/lib/grafana/plugins/vl-plugin.tar.gz
curl -L https://github.com/VictoriaMetrics/victorialogs-datasource/releases/download/$ver/victoriametrics-logs-datasource-$ver.tar.gz -o /var/lib/grafana/plugins/vl-plugin.tar.gz
tar -xf /var/lib/grafana/plugins/vl-plugin.tar.gz -C /var/lib/grafana/plugins/
rm /var/lib/grafana/plugins/vl-plugin.tar.gz
volumeMounts:
- name: grafana-data
mountPath: /var/lib/grafana
config:
plugins:
allow_loading_unsigned_plugins: victorialogs-datasource
allow_loading_unsigned_plugins: victoriametrics-logs-datasource
```

See [Grafana operator reference](https://grafana-operator.github.io/grafana-operator/docs/grafana/) to find more about Grafana operator.
Expand All @@ -204,7 +204,7 @@ This example uses init container to download and install plugin.

``` bash
ver=$(curl -s https://api.github.com/repos/VictoriaMetrics/victorialogs-datasource/releases/latest | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+' | head -1)
curl -L https://github.com/VictoriaMetrics/victorialogs-datasource/releases/download/$ver/victorialogs-datasource-$ver.tar.gz -o /var/lib/grafana/plugins/vl-plugin.tar.gz
curl -L https://github.com/VictoriaMetrics/victorialogs-datasource/releases/download/$ver/victoriametrics-logs-datasource-$ver.tar.gz -o /var/lib/grafana/plugins/vl-plugin.tar.gz
tar -xf /var/lib/grafana/plugins/vl-plugin.tar.gz -C /var/lib/grafana/plugins/
rm /var/lib/grafana/plugins/vl-plugin.tar.gz
```
Expand All @@ -224,7 +224,7 @@ plugins = {{path to directory with plugin}}

``` ini
[plugins]
allow_loading_unsigned_plugins = victorialogs-datasource
allow_loading_unsigned_plugins = victoriametrics-logs-datasource
```

### 2. Run the plugin
Expand All @@ -238,7 +238,7 @@ yarn install
# run the app in the development mode
yarn dev
# build the plugin for production to the `victorialogs-datasource` folder and zip build
# build the plugin for production to the `victoriametrics-logs-datasource` folder and zip build
yarn build:zip
```

Expand All @@ -250,7 +250,7 @@ From the root folder of the project run the following command:
make vl-backend-plugin-build
```

This command will build executable multi-platform files to the `victorialogs-datasource` folder for the following platforms:
This command will build executable multi-platform files to the `victoriametrics-logs-datasource` folder for the following platforms:

* linux/amd64
* linux/arm64
Expand All @@ -268,7 +268,7 @@ From the root folder of the project run the following command:
make vl-frontend-plugin-build
```

This command will build all frontend app into `victorialogs-datasource` folder.
This command will build all frontend app into `victoriametrics-logs-datasource` folder.

### 5. How to build frontend and backend parts of the plugin:

Expand All @@ -278,7 +278,7 @@ When frontend and backend parts of the plugin is required, run the following com
make vl-plugin-build
```

This command will build frontend part and backend part or the plugin and locate both parts into `victorialogs-datasource` folder.
This command will build frontend part and backend part or the plugin and locate both parts into `victoriametrics-logs-datasource` folder.

## How to make new release

Expand Down
2 changes: 1 addition & 1 deletion compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ services:
GF_AUTH_BASIC_ENABLED: "false"
GF_DEFAULT_APP_MODE: development
volumes:
- ./plugins/victorialogs-datasource:/var/lib/grafana/plugins/victorialogs-datasource
- ./plugins/victoriametrics-logs-datasource:/var/lib/grafana/plugins/victoriametrics-logs-datasource
- ./provisioning:/etc/grafana/provisioning
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "victorialogs-datasource",
"name": "victoriametrics-logs-datasource",
"version": "0.12.0",
"description": "VictoriaLogs datasource plugin for grafana",
"scripts": {
Expand Down
21 changes: 17 additions & 4 deletions src/plugin.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"type": "datasource",
"name": "VictoriaLogs",
"id": "victorialogs-datasource",
"id": "victoriametrics-logs-datasource",
"category": "logging",
"logs": true,
"metrics": true,
"alerting": true,
"annotations": true,
"streaming": true,
"backend": true,
"executable": "victorialogs_backend_plugin",
"executable": "victoriametrics_logs_backend_plugin",
"queryOptions": {
"maxDataPoints": true
},
Expand All @@ -19,12 +19,25 @@
"name": "VictoriaLogs",
"url": "https://victoriametrics.com/"
},
"keywords": ["datasource"],
"keywords": ["logs", "log analytics", "observability", "victoriametrics", "victorialogs", "datasource"],
"logos": {
"small": "img/logo.svg",
"large": "img/logo.svg"
},
"links": [],
"links": [
{
"name": "Learn more",
"url": "https://docs.victoriametrics.com/victorialogs/"
},
{
"name": "LogsQL",
"url": "https://docs.victoriametrics.com/victorialogs/logsql/"
},
{
"name": "GitHub Project",
"url": "https://github.com/VictoriaMetrics/victorialogs-datasource"
}
],
"screenshots": [],
"version": "%VERSION%",
"updated": "%TODAY%"
Expand Down

0 comments on commit c26e6c5

Please sign in to comment.