Skip to content

Commit 6ff6171

Browse files
authored
upgrade sdk (#9)
1 parent 40c92d9 commit 6ff6171

12 files changed

+1287
-1047
lines changed

.config/.cprc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"version": "5.5.3"
2+
"version": "5.12.4"
33
}

.config/.eslintrc

+6
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@
2020
"parserOptions": {
2121
"project": "./tsconfig.json"
2222
}
23+
},
24+
{
25+
"files": ["./tests/**/*"],
26+
"rules": {
27+
"react-hooks/rules-of-hooks": "off"
28+
}
2329
}
2430
]
2531
}

.config/Dockerfile

+8-7
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ ARG grafana_image=grafana-enterprise
33

44
FROM grafana/${grafana_image}:${grafana_version}
55

6+
ARG anonymous_auth_enabled=true
67
ARG development=false
78
ARG TARGETARCH
89

@@ -14,7 +15,7 @@ ENV DEV "${development}"
1415
# Make it as simple as possible to access the grafana instance for development purposes
1516
# Do NOT enable these settings in a public facing / production grafana instance
1617
ENV GF_AUTH_ANONYMOUS_ORG_ROLE "Admin"
17-
ENV GF_AUTH_ANONYMOUS_ENABLED "true"
18+
ENV GF_AUTH_ANONYMOUS_ENABLED "${anonymous_auth_enabled}"
1819
ENV GF_AUTH_BASIC_ENABLED "false"
1920
# Set development mode so plugins can be loaded without the need to sign
2021
ENV GF_DEFAULT_APP_MODE "development"
@@ -30,14 +31,14 @@ USER root
3031
# Installing supervisor and inotify-tools
3132
RUN if [ "${development}" = "true" ]; then \
3233
if grep -i -q alpine /etc/issue; then \
33-
apk add supervisor inotify-tools git; \
34+
apk add supervisor inotify-tools git; \
3435
elif grep -i -q ubuntu /etc/issue; then \
35-
DEBIAN_FRONTEND=noninteractive && \
36-
apt-get update && \
37-
apt-get install -y supervisor inotify-tools git && \
38-
rm -rf /var/lib/apt/lists/*; \
36+
DEBIAN_FRONTEND=noninteractive && \
37+
apt-get update && \
38+
apt-get install -y supervisor inotify-tools git && \
39+
rm -rf /var/lib/apt/lists/*; \
3940
else \
40-
echo 'ERROR: Unsupported base image' && /bin/false; \
41+
echo 'ERROR: Unsupported base image' && /bin/false; \
4142
fi \
4243
fi
4344

.config/supervisord/supervisord.conf

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ user=root
55
[program:grafana]
66
user=root
77
directory=/var/lib/grafana
8-
command=bash -c 'while [ ! -f /root/timeplus-timeplus-datasource/dist/gpx_timeplus* ]; do sleep 1; done; /run.sh'
8+
command=bash -c 'while [ ! -f /root/timeplus-proton-datasource/dist/gpx_timeplus* ]; do sleep 1; done; /run.sh'
99
stdout_logfile=/dev/fd/1
1010
stdout_logfile_maxbytes=0
1111
redirect_stderr=true
@@ -26,7 +26,7 @@ autorestart=true
2626

2727
[program:build-watcher]
2828
user=root
29-
command=/bin/bash -c 'while inotifywait -e modify,create,delete -r /var/lib/grafana/plugins/timeplus-timeplus-datasource; do echo "Change detected, restarting delve...";supervisorctl restart delve; done'
29+
command=/bin/bash -c 'while inotifywait -e modify,create,delete -r /var/lib/grafana/plugins/timeplus-proton-datasource; do echo "Change detected, restarting delve...";supervisorctl restart delve; done'
3030
stdout_logfile=/dev/fd/1
3131
stdout_logfile_maxbytes=0
3232
redirect_stderr=true
@@ -37,8 +37,8 @@ autostart=true
3737
[program:mage-watcher]
3838
user=root
3939
environment=PATH="/usr/local/go/bin:/root/go/bin:%(ENV_PATH)s"
40-
directory=/root/timeplus-timeplus-datasource
41-
command=/bin/bash -c 'git config --global --add safe.directory /root/timeplus-timeplus-datasource && mage -v watch'
40+
directory=/root/timeplus-proton-datasource
41+
command=/bin/bash -c 'git config --global --add safe.directory /root/timeplus-proton-datasource && mage -v watch'
4242
stdout_logfile=/dev/fd/1
4343
stdout_logfile_maxbytes=0
4444
redirect_stderr=true
+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import * as webpack from 'webpack';
2+
3+
const PLUGIN_NAME = 'BuildModeWebpack';
4+
5+
export class BuildModeWebpackPlugin {
6+
apply(compiler: webpack.Compiler) {
7+
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
8+
compilation.hooks.processAssets.tap(
9+
{
10+
name: PLUGIN_NAME,
11+
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS,
12+
},
13+
async () => {
14+
const assets = compilation.getAssets();
15+
for (const asset of assets) {
16+
if (asset.name.endsWith('plugin.json')) {
17+
const pluginJsonString = asset.source.source().toString();
18+
const pluginJsonWithBuildMode = JSON.stringify(
19+
{
20+
...JSON.parse(pluginJsonString),
21+
buildMode: compilation.options.mode,
22+
},
23+
null,
24+
4
25+
);
26+
compilation.updateAsset(asset.name, new webpack.sources.RawSource(pluginJsonWithBuildMode));
27+
}
28+
}
29+
}
30+
);
31+
});
32+
}
33+
}

.config/webpack/webpack.config.ts

+11-8
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { type Configuration, BannerPlugin } from 'webpack';
1616
import LiveReloadPlugin from 'webpack-livereload-plugin';
1717
import VirtualModulesPlugin from 'webpack-virtual-modules';
1818

19+
import { BuildModeWebpackPlugin } from './BuildModeWebpackPlugin';
1920
import { DIST_DIR, SOURCE_DIR } from './constants';
2021
import { getCPConfigVersion, getEntries, getPackageJson, getPluginJson, hasReadme, isWSL } from './utils';
2122

@@ -175,6 +176,7 @@ const config = async (env): Promise<Configuration> => {
175176
keep: new RegExp(`(.*?_(amd64|arm(64)?)(.exe)?|go_plugin_build_manifest)`),
176177
},
177178
filename: '[name].js',
179+
chunkFilename: env.production ? '[name].js?_cache=[contenthash]' : '[name].js',
178180
library: {
179181
type: 'amd',
180182
},
@@ -185,6 +187,7 @@ const config = async (env): Promise<Configuration> => {
185187
},
186188

187189
plugins: [
190+
new BuildModeWebpackPlugin(),
188191
virtualPublicPath,
189192
// Insert create plugin version information into the bundle
190193
new BannerPlugin({
@@ -200,14 +203,14 @@ const config = async (env): Promise<Configuration> => {
200203
{ from: 'plugin.json', to: '.' },
201204
{ from: '../LICENSE', to: '.' },
202205
{ from: '../CHANGELOG.md', to: '.', force: true },
203-
{ from: '**/*.json', to: '.' }, // TODO<Add an error for checking the basic structure of the repo>
204-
{ from: '**/*.svg', to: '.', noErrorOnMissing: true }, // Optional
205-
{ from: '**/*.png', to: '.', noErrorOnMissing: true }, // Optional
206-
{ from: '**/*.html', to: '.', noErrorOnMissing: true }, // Optional
207-
{ from: 'img/**/*', to: '.', noErrorOnMissing: true }, // Optional
208-
{ from: 'libs/**/*', to: '.', noErrorOnMissing: true }, // Optional
209-
{ from: 'static/**/*', to: '.', noErrorOnMissing: true }, // Optional
210-
{ from: '**/query_help.md', to: '.', noErrorOnMissing: true }, // Optional
206+
{ from: '**/*.json', to: '.' },
207+
{ from: '**/*.svg', to: '.', noErrorOnMissing: true },
208+
{ from: '**/*.png', to: '.', noErrorOnMissing: true },
209+
{ from: '**/*.html', to: '.', noErrorOnMissing: true },
210+
{ from: 'img/**/*', to: '.', noErrorOnMissing: true },
211+
{ from: 'libs/**/*', to: '.', noErrorOnMissing: true },
212+
{ from: 'static/**/*', to: '.', noErrorOnMissing: true },
213+
{ from: '**/query_help.md', to: '.', noErrorOnMissing: true },
211214
],
212215
}),
213216
// Replace certain template-variables in the README and plugin.json

docker-compose.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ services:
77
context: ./.config
88
args:
99
grafana_image: ${GRAFANA_IMAGE:-grafana-enterprise}
10-
grafana_version: ${GRAFANA_VERSION:-11.2.2}
10+
grafana_version: ${GRAFANA_VERSION:-11.3.1}
1111
development: ${DEVELOPMENT:-false}
1212
ports:
1313
- 3000:3000/tcp
@@ -35,7 +35,7 @@ services:
3535
ports:
3636
- 3218:3218 # HTTP Streaming
3737
- 8463:8463 # TCP Streaming
38-
38+
3939
carsharing_datagen:
4040
image: timeplus/cardemo:latest
4141
pull_policy: always
@@ -49,4 +49,4 @@ services:
4949
interval: 200
5050
host: proton
5151
depends_on:
52-
- proton
52+
- proton

go.mod

+39-39
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,56 @@
11
module github.com/timeplus-io/proton-grafana-source
22

3-
go 1.22
3+
go 1.22.7
44

55
toolchain go1.23.2
66

77
require (
88
github.com/google/uuid v1.6.0
9-
github.com/grafana/grafana-plugin-sdk-go v0.256.0
9+
github.com/grafana/grafana-plugin-sdk-go v0.261.0
1010
github.com/timeplus-io/proton-go-driver/v2 v2.0.17
1111
)
1212

1313
require (
1414
github.com/BurntSushi/toml v1.4.0 // indirect
15-
github.com/apache/arrow/go/v15 v15.0.2 // indirect
15+
github.com/apache/arrow-go/v18 v18.0.1-0.20241212180703-82be143d7c30 // indirect
1616
github.com/beorn7/perks v1.0.1 // indirect
1717
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
1818
github.com/cespare/xxhash/v2 v2.3.0 // indirect
1919
github.com/cheekybits/genny v1.0.0 // indirect
2020
github.com/chromedp/cdproto v0.0.0-20220208224320-6efb837e6bc2 // indirect
2121
github.com/cpuguy83/go-md2man/v2 v2.0.5 // indirect
22-
github.com/elazarl/goproxy v0.0.0-20230731152917-f99041a5c027 // indirect
22+
github.com/elazarl/goproxy v1.2.6 // indirect
2323
github.com/fatih/color v1.15.0 // indirect
24-
github.com/getkin/kin-openapi v0.124.0 // indirect
24+
github.com/getkin/kin-openapi v0.128.0 // indirect
2525
github.com/go-logr/logr v1.4.2 // indirect
2626
github.com/go-logr/stdr v1.2.2 // indirect
27-
github.com/go-openapi/jsonpointer v0.20.2 // indirect
28-
github.com/go-openapi/swag v0.22.8 // indirect
29-
github.com/goccy/go-json v0.10.2 // indirect
27+
github.com/go-openapi/jsonpointer v0.21.0 // indirect
28+
github.com/go-openapi/swag v0.23.0 // indirect
29+
github.com/goccy/go-json v0.10.4 // indirect
3030
github.com/gogo/protobuf v1.3.2 // indirect
3131
github.com/golang/protobuf v1.5.4 // indirect
32-
github.com/google/flatbuffers v23.5.26+incompatible // indirect
32+
github.com/google/flatbuffers v24.3.25+incompatible // indirect
3333
github.com/google/go-cmp v0.6.0 // indirect
3434
github.com/gorilla/mux v1.8.1 // indirect
3535
github.com/grafana/otel-profiling-go v0.5.1 // indirect
3636
github.com/grafana/pyroscope-go/godeltaprof v0.1.8 // indirect
3737
github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.1 // indirect
38-
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.1.0 // indirect
39-
github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 // indirect
38+
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.2.0 // indirect
39+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.24.0 // indirect
4040
github.com/hashicorp/go-hclog v1.6.3 // indirect
41-
github.com/hashicorp/go-plugin v1.6.1 // indirect
41+
github.com/hashicorp/go-plugin v1.6.2 // indirect
4242
github.com/hashicorp/yamux v0.1.1 // indirect
43-
github.com/invopop/yaml v0.2.0 // indirect
43+
github.com/invopop/yaml v0.3.1 // indirect
4444
github.com/josharian/intern v1.0.0 // indirect
4545
github.com/json-iterator/go v1.1.12 // indirect
46-
github.com/klauspost/compress v1.17.9 // indirect
47-
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
46+
github.com/klauspost/compress v1.17.11 // indirect
47+
github.com/klauspost/cpuid/v2 v2.2.9 // indirect
4848
github.com/magefile/mage v1.15.0 // indirect
4949
github.com/mailru/easyjson v0.7.7 // indirect
5050
github.com/mattetti/filebuffer v1.0.1 // indirect
5151
github.com/mattn/go-colorable v0.1.13 // indirect
5252
github.com/mattn/go-isatty v0.0.19 // indirect
5353
github.com/mattn/go-runewidth v0.0.9 // indirect
54-
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
5554
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
5655
github.com/modern-go/reflect2 v1.0.2 // indirect
5756
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
@@ -60,10 +59,10 @@ require (
6059
github.com/olekukonko/tablewriter v0.0.5 // indirect
6160
github.com/paulmach/orb v0.4.0 // indirect
6261
github.com/perimeterx/marshmallow v1.1.5 // indirect
63-
github.com/pierrec/lz4/v4 v4.1.18 // indirect
62+
github.com/pierrec/lz4/v4 v4.1.21 // indirect
6463
github.com/prometheus/client_golang v1.20.5 // indirect
6564
github.com/prometheus/client_model v0.6.1 // indirect
66-
github.com/prometheus/common v0.60.0 // indirect
65+
github.com/prometheus/common v0.61.0 // indirect
6766
github.com/prometheus/procfs v0.15.1 // indirect
6867
github.com/russross/blackfriday/v2 v2.1.0 // indirect
6968
github.com/shopspring/decimal v1.3.1 // indirect
@@ -72,28 +71,29 @@ require (
7271
github.com/unknwon/log v0.0.0-20150304194804-e617c87089d3 // indirect
7372
github.com/urfave/cli v1.22.16 // indirect
7473
github.com/zeebo/xxh3 v1.0.2 // indirect
75-
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 // indirect
76-
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.53.0 // indirect
77-
go.opentelemetry.io/contrib/propagators/jaeger v1.29.0 // indirect
78-
go.opentelemetry.io/contrib/samplers/jaegerremote v0.25.0 // indirect
79-
go.opentelemetry.io/otel v1.31.0 // indirect
80-
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0 // indirect
81-
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.31.0 // indirect
82-
go.opentelemetry.io/otel/metric v1.31.0 // indirect
83-
go.opentelemetry.io/otel/sdk v1.31.0 // indirect
84-
go.opentelemetry.io/otel/trace v1.31.0 // indirect
85-
go.opentelemetry.io/proto/otlp v1.3.1 // indirect
86-
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
87-
golang.org/x/mod v0.17.0 // indirect
88-
golang.org/x/net v0.30.0 // indirect
89-
golang.org/x/sync v0.8.0 // indirect
90-
golang.org/x/sys v0.26.0 // indirect
91-
golang.org/x/text v0.19.0 // indirect
92-
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
93-
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
74+
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
75+
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.58.0 // indirect
76+
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.57.0 // indirect
77+
go.opentelemetry.io/contrib/propagators/jaeger v1.33.0 // indirect
78+
go.opentelemetry.io/contrib/samplers/jaegerremote v0.27.0 // indirect
79+
go.opentelemetry.io/otel v1.33.0 // indirect
80+
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.33.0 // indirect
81+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.33.0 // indirect
82+
go.opentelemetry.io/otel/metric v1.33.0 // indirect
83+
go.opentelemetry.io/otel/sdk v1.33.0 // indirect
84+
go.opentelemetry.io/otel/trace v1.33.0 // indirect
85+
go.opentelemetry.io/proto/otlp v1.4.0 // indirect
86+
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect
87+
golang.org/x/mod v0.22.0 // indirect
88+
golang.org/x/net v0.33.0 // indirect
89+
golang.org/x/sync v0.10.0 // indirect
90+
golang.org/x/sys v0.28.0 // indirect
91+
golang.org/x/text v0.21.0 // indirect
92+
golang.org/x/tools v0.28.0 // indirect
93+
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
9494
google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 // indirect
95-
google.golang.org/grpc v1.67.1 // indirect
96-
google.golang.org/protobuf v1.35.1 // indirect
95+
google.golang.org/grpc v1.69.2 // indirect
96+
google.golang.org/protobuf v1.35.2 // indirect
9797
gopkg.in/fsnotify/fsnotify.v1 v1.4.7 // indirect
9898
gopkg.in/yaml.v3 v3.0.1 // indirect
9999
)

0 commit comments

Comments
 (0)