Skip to content

Commit bbf65b9

Browse files
committed
feat: Add InfluxDB support
Signed-off-by: Pascal Zimmermann <[email protected]>
1 parent b129c72 commit bbf65b9

32 files changed

Lines changed: 1230 additions & 0 deletions

influxdb/cue.mod/module.cue

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module: "github.com/perses/plugins/influxdb@v0"
2+
language: {
3+
version: "v0.8.0"
4+
}
5+
source: {
6+
kind: "git"
7+
}
8+
deps: {
9+
"github.com/perses/perses/cue@v0": {
10+
v: "v0.53.0-rc.0"
11+
default: true
12+
}
13+
}

influxdb/go.mod

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
module github.com/perses/plugins/influxdb
2+
3+
go 1.25.5
4+
5+
require (
6+
github.com/perses/perses v0.53.0-rc.0
7+
github.com/stretchr/testify v1.11.1
8+
)
9+
10+
require (
11+
github.com/beorn7/perks v1.0.1 // indirect
12+
github.com/cespare/xxhash/v2 v2.3.0 // indirect
13+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
14+
github.com/go-jose/go-jose/v4 v4.1.3 // indirect
15+
github.com/golang-jwt/jwt/v5 v5.3.0 // indirect
16+
github.com/google/uuid v1.6.0 // indirect
17+
github.com/jpillora/backoff v1.0.0 // indirect
18+
github.com/kr/text v0.2.0 // indirect
19+
github.com/muhlemmer/gu v0.3.1 // indirect
20+
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
21+
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
22+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
23+
github.com/prometheus/client_golang v1.23.2 // indirect
24+
github.com/prometheus/client_model v0.6.2 // indirect
25+
github.com/prometheus/common v0.67.4 // indirect
26+
github.com/prometheus/procfs v0.17.0 // indirect
27+
github.com/zitadel/oidc/v3 v3.45.1 // indirect
28+
github.com/zitadel/schema v1.3.1 // indirect
29+
go.yaml.in/yaml/v2 v2.4.3 // indirect
30+
golang.org/x/net v0.48.0 // indirect
31+
golang.org/x/oauth2 v0.34.0 // indirect
32+
golang.org/x/sys v0.39.0 // indirect
33+
golang.org/x/text v0.32.0 // indirect
34+
google.golang.org/protobuf v1.36.10 // indirect
35+
gopkg.in/yaml.v3 v3.0.1 // indirect
36+
)

influxdb/go.sum

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
2+
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
3+
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
4+
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
5+
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
6+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
7+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
8+
github.com/go-jose/go-jose/v4 v4.1.3 h1:CVLmWDhDVRa6Mi/IgCgaopNosCaHz7zrMeF9MlZRkrs=
9+
github.com/go-jose/go-jose/v4 v4.1.3/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08=
10+
github.com/golang-jwt/jwt/v5 v5.3.0 h1:pv4AsKCKKZuqlgs5sUmn4x8UlGa0kEVt/puTpKx9vvo=
11+
github.com/golang-jwt/jwt/v5 v5.3.0/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE=
12+
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
13+
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
14+
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
15+
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
16+
github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA=
17+
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
18+
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
19+
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
20+
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
21+
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
22+
github.com/muhlemmer/gu v0.3.1 h1:7EAqmFrW7n3hETvuAdmFmn4hS8W+z3LgKtrnow+YzNM=
23+
github.com/muhlemmer/gu v0.3.1/go.mod h1:YHtHR+gxM+bKEIIs7Hmi9sPT3ZDUvTN/i88wQpZkrdM=
24+
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
25+
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
26+
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU=
27+
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
28+
github.com/nexucis/lamenv v0.5.2 h1:tK/u3XGhCq9qIoVNcXsK9LZb8fKopm0A5weqSRvHd7M=
29+
github.com/nexucis/lamenv v0.5.2/go.mod h1:HusJm6ltmmT7FMG8A750mOLuME6SHCsr2iFYxp5fFi0=
30+
github.com/perses/perses v0.53.0-rc.0 h1:f3V1j6EqnKyXUY0mNt4Zp/T6+5U/5SjtCzLHxj9sJDQ=
31+
github.com/perses/perses v0.53.0-rc.0/go.mod h1:q+gB4M2yT//cO6GlCjhOTJLDoSrqtkMLul72Z0WOueI=
32+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
33+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
34+
github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o=
35+
github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg=
36+
github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk=
37+
github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE=
38+
github.com/prometheus/common v0.67.4 h1:yR3NqWO1/UyO1w2PhUvXlGQs/PtFmoveVO0KZ4+Lvsc=
39+
github.com/prometheus/common v0.67.4/go.mod h1:gP0fq6YjjNCLssJCQp0yk4M8W6ikLURwkdd/YKtTbyI=
40+
github.com/prometheus/procfs v0.17.0 h1:FuLQ+05u4ZI+SS/w9+BWEM2TXiHKsUQ9TADiRH7DuK0=
41+
github.com/prometheus/procfs v0.17.0/go.mod h1:oPQLaDAMRbA+u8H5Pbfq+dl3VDAvHxMUOVhe0wYB2zw=
42+
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
43+
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
44+
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
45+
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
46+
github.com/zitadel/oidc/v3 v3.45.1 h1:x7J8NywTUtLR9T5uu2dufae3gJrl6VVpIfvGZy+kzJg=
47+
github.com/zitadel/oidc/v3 v3.45.1/go.mod h1:oFArtAPTXEA4ajkIe/JfBjv7hhlD0kr///UqaO3Uzd0=
48+
github.com/zitadel/schema v1.3.1 h1:QT3kwiRIRXXLVAs6gCK/u044WmUVh6IlbLXUsn6yRQU=
49+
github.com/zitadel/schema v1.3.1/go.mod h1:071u7D2LQacy1HAN+YnMd/mx1qVE2isb0Mjeqg46xnU=
50+
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
51+
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
52+
go.yaml.in/yaml/v2 v2.4.3 h1:6gvOSjQoTB3vt1l+CU+tSyi/HOjfOjRLJ4YwYZGwRO0=
53+
go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8=
54+
golang.org/x/net v0.48.0 h1:zyQRTTrjc33Lhh0fBgT/H3oZq9WuvRR5gPC70xpDiQU=
55+
golang.org/x/net v0.48.0/go.mod h1:+ndRgGjkh8FGtu1w1FGbEC31if4VrNVMuKTgcAAnQRY=
56+
golang.org/x/oauth2 v0.34.0 h1:hqK/t4AKgbqWkdkcAeI8XLmbK+4m4G5YeQRrmiotGlw=
57+
golang.org/x/oauth2 v0.34.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA=
58+
golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk=
59+
golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
60+
golang.org/x/text v0.32.0 h1:ZD01bjUt1FQ9WJ0ClOL5vxgxOI/sVCNgX1YtKwcY0mU=
61+
golang.org/x/text v0.32.0/go.mod h1:o/rUWzghvpD5TXrTIBuJU77MTaN0ljMWE47kxGJQ7jY=
62+
google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE=
63+
google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
64+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
65+
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
66+
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
67+
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
68+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

influxdb/jest.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import type { Config } from 'jest';
2+
import sharedConfig from '../jest.shared';
3+
const config: Config = {
4+
...sharedConfig,
5+
displayName: 'influxdb',
6+
};
7+
export default config;

influxdb/package.json

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{
2+
"name": "@perses-dev/influxdb-plugin",
3+
"version": "0.1.0-rc.0",
4+
"homepage": "https://github.com/perses/plugins/blob/main/README.md",
5+
"repository": {
6+
"type": "git",
7+
"url": "git+https://github.com/perses/plugins.git"
8+
},
9+
"bugs": {
10+
"url": "https://github.com/perses/plugins/issues"
11+
},
12+
"scripts": {
13+
"dev": "rsbuild dev",
14+
"build": "npm run build-mf && concurrently \"npm:build:*\"",
15+
"build-mf": "rsbuild build",
16+
"build:cjs": "swc ./src -d dist/lib/cjs --strip-leading-paths --config-file ../.cjs.swcrc",
17+
"build:esm": "swc ./src -d dist/lib --strip-leading-paths --config-file ../.swcrc",
18+
"build:types": "tsc --project tsconfig.build.json",
19+
"lint": "eslint src --ext .ts,.tsx",
20+
"test": "cross-env LC_ALL=C TZ=UTC jest",
21+
"type-check": "tsc --noEmit"
22+
},
23+
"main": "lib/cjs/index.js",
24+
"module": "lib/index.js",
25+
"types": "lib/index.d.ts",
26+
"dependencies": {},
27+
"peerDependencies": {
28+
"@emotion/react": "^11.7.1",
29+
"@emotion/styled": "^11.6.0",
30+
"@mui/material": "^5.0.0",
31+
"@hookform/resolvers": "^3.2.0",
32+
"@perses-dev/components": "^0.53.0-rc.1",
33+
"@perses-dev/core": "^0.53.0-beta.4",
34+
"@perses-dev/dashboards": "^0.53.0-rc.1",
35+
"@perses-dev/explore": "^0.53.0-rc.1",
36+
"@perses-dev/plugin-system": "^0.53.0-rc.1",
37+
"@tanstack/react-query": "^4.39.1",
38+
"date-fns": "^4.1.0",
39+
"date-fns-tz": "^3.2.0",
40+
"echarts": "5.5.0",
41+
"immer": "^10.1.1",
42+
"lodash": "^4.17.21",
43+
"react": "^17.0.2 || ^18.0.0",
44+
"react-dom": "^17.0.2 || ^18.0.0",
45+
"react-hook-form": "^7.52.2",
46+
"react-router-dom": "^6.27.0",
47+
"zod": "^3.22.4"
48+
},
49+
"devDependencies": {
50+
"@swc/cli": "^0.4.1-nightly.20240914",
51+
"@swc/core": "^1.7.28",
52+
"@testing-library/jest-dom": "^6.6.3",
53+
"@testing-library/react": "^12.1.4",
54+
"@testing-library/user-event": "^14.5.2",
55+
"@types/color-hash": "^2.0.0",
56+
"@types/jest": "^29.5.14",
57+
"@types/lodash": "^4.17.13",
58+
"@types/react": "^18.3.12",
59+
"concurrently": "^8.2.2",
60+
"cross-env": "^7.0.3",
61+
"jest": "^29.7.0",
62+
"jest-environment-jsdom": "^29.7.0",
63+
"typescript": "^5.6.3"
64+
},
65+
"files": [
66+
"dist",
67+
"README.md"
68+
]
69+
}

influxdb/rsbuild.config.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { pluginReact } from '@rsbuild/plugin-react';
2+
import { ModuleFederationPlugin } from '@module-federation/enhanced/rspack';
3+
export default {
4+
plugins: [pluginReact()],
5+
tools: {
6+
rspack: {
7+
plugins: [
8+
new ModuleFederationPlugin({
9+
name: 'influxdb',
10+
filename: 'remoteEntry.js',
11+
exposes: {
12+
'./plugin': './src/getPluginModule.ts',
13+
},
14+
shared: {
15+
react: { singleton: true, requiredVersion: false },
16+
'react-dom': { singleton: true, requiredVersion: false },
17+
'@perses-dev/core': { singleton: true, requiredVersion: false },
18+
'@perses-dev/plugin-system': { singleton: true, requiredVersion: false },
19+
'@perses-dev/components': { singleton: true, requiredVersion: false },
20+
},
21+
}),
22+
],
23+
},
24+
},
25+
};
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
kind: GlobalDatasource
2+
metadata:
3+
name: influxdb-v1-demo
4+
spec:
5+
default: false
6+
plugin:
7+
kind: InfluxDBV1Datasource
8+
spec:
9+
directUrl: http://localhost:8086
10+
version: v1
11+
database: mydb
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
kind: GlobalDatasource
2+
metadata:
3+
name: influxdb-v1-proxy
4+
spec:
5+
default: false
6+
plugin:
7+
kind: InfluxDBV1Datasource
8+
spec:
9+
version: v1
10+
database: mydb
11+
proxy:
12+
kind: HTTPProxy
13+
spec:
14+
url: http://localhost:8086
15+
allowedEndpoints:
16+
- endpointPattern: /query
17+
method: GET
18+
- endpointPattern: /query
19+
method: POST
20+
- endpointPattern: /write
21+
method: POST
22+
secret: influxdb-secret
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
kind: GlobalDatasource
2+
metadata:
3+
name: influxdb-v3-demo
4+
spec:
5+
default: false
6+
plugin:
7+
kind: InfluxDBV3Datasource
8+
spec:
9+
directUrl: http://localhost:8086
10+
version: v3
11+
organization: myorg
12+
bucket: mybucket
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
kind: GlobalDatasource
2+
metadata:
3+
name: influxdb-v3-proxy
4+
spec:
5+
default: false
6+
plugin:
7+
kind: InfluxDBV3Datasource
8+
spec:
9+
version: v3
10+
organization: myorg
11+
bucket: mybucket
12+
proxy:
13+
kind: HTTPProxy
14+
spec:
15+
url: http://localhost:8086
16+
allowedEndpoints:
17+
- endpointPattern: /api/v3/query_sql
18+
method: POST
19+
- endpointPattern: /api/v3/query_influxql
20+
method: POST
21+
secret: influxdb-secret

0 commit comments

Comments
 (0)