Skip to content

Commit c11488f

Browse files
authored
Add JSON field support (#55)
1 parent 4cb6e5e commit c11488f

33 files changed

+7387
-7888
lines changed

.bra.toml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# default configuration created by the `mage watch` command.
2+
# this file can be edited and should be checked into source control.
3+
# see https://github.com/unknwon/bra/blob/master/templates/default.bra.toml for more configuration options.
4+
[run]
5+
init_cmds = [
6+
["mage", "-v", "build:backend"],
7+
["mage", "-v" , "reloadPlugin"]
8+
]
9+
watch_all = true
10+
follow_symlinks = false
11+
ignore = [".git", "node_modules", "dist"]
12+
ignore_files = ["mage_output_file.go"]
13+
watch_dirs = [
14+
"pkg",
15+
"src",
16+
]
17+
watch_exts = [".go", ".json"]
18+
build_delay = 2000
19+
cmds = [
20+
["mage", "-v", "build:backend"],
21+
["mage", "-v" , "reloadPlugin"]
22+
]

README.md

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,8 @@ The MQTT data source has the following requirements:
1616
## Known limitations
1717

1818
- The plugin currently does not support all of the MQTT CONNECT packet options.
19-
- The plugin currently does not support TLS.
20-
- Including multiple topics in a panel is not yet well supported.
21-
- This plugin automatically supports topics publishing very simple JSON formatted messages. Note that only the following structure is supported as of now:
22-
```
23-
{
24-
"value1": 1.0,
25-
"value2": 2,
26-
"value3": 3.33,
27-
...
28-
}
29-
```
30-
We do plan to support more complex JSON data structures in the upcoming releases. Contributions are highly encouraged!
31-
- This plugin currently attaches timestamps to the messages when they are received, so there is no way to have custom timestamp for messages.
19+
- This plugin automatically supports topics publishing numbers, strings, booleans, and JSON formatted values. Nested object values can be extracted using the `Extract Fields` transformation.
20+
- This plugin automatically attaches timestamps to the messages when they are received. Timestamps included in the message body can be parsed using the `Convert field type` transformation.
3221
## Install the plugin
3322

3423
### Installation Pre-requisites

go.mod

Lines changed: 72 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,77 @@
11
module github.com/grafana/mqtt-datasource
22

3-
go 1.16
3+
go 1.19
44

55
require (
6-
github.com/eclipse/paho.mqtt.golang v1.3.4
7-
github.com/grafana/grafana-plugin-sdk-go v0.104.0
8-
github.com/stretchr/testify v1.7.0
6+
github.com/eclipse/paho.mqtt.golang v1.4.2
7+
github.com/grafana/grafana-plugin-sdk-go v0.144.0
8+
github.com/stretchr/testify v1.8.1
9+
)
10+
11+
require (
12+
github.com/BurntSushi/toml v0.3.1 // indirect
13+
github.com/apache/arrow/go/arrow v0.0.0-20211112161151-bc219186db40 // indirect
14+
github.com/beorn7/perks v1.0.1 // indirect
15+
github.com/cespare/xxhash/v2 v2.1.2 // indirect
16+
github.com/cheekybits/genny v1.0.0 // indirect
17+
github.com/chromedp/cdproto v0.0.0-20220208224320-6efb837e6bc2 // indirect
18+
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d // indirect
19+
github.com/davecgh/go-spew v1.1.1 // indirect
20+
github.com/elazarl/goproxy v0.0.0-20220115173737-adb46da277ac // indirect
21+
github.com/fatih/color v1.13.0 // indirect
22+
github.com/getkin/kin-openapi v0.94.0 // indirect
23+
github.com/ghodss/yaml v1.0.0 // indirect
24+
github.com/go-openapi/jsonpointer v0.19.5 // indirect
25+
github.com/go-openapi/swag v0.19.15 // indirect
26+
github.com/golang/protobuf v1.5.2 // indirect
27+
github.com/golang/snappy v0.0.3 // indirect
28+
github.com/google/flatbuffers v22.10.26+incompatible // indirect
29+
github.com/google/go-cmp v0.5.9 // indirect
30+
github.com/google/uuid v1.3.0 // indirect
31+
github.com/gorilla/mux v1.8.0 // indirect
32+
github.com/gorilla/websocket v1.5.0 // indirect
33+
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
34+
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
35+
github.com/hashicorp/go-hclog v1.3.1 // indirect
36+
github.com/hashicorp/go-plugin v1.4.6 // indirect
37+
github.com/hashicorp/yamux v0.1.1 // indirect
38+
github.com/josharian/intern v1.0.0 // indirect
39+
github.com/json-iterator/go v1.1.12 // indirect
40+
github.com/klauspost/compress v1.13.1 // indirect
41+
github.com/magefile/mage v1.14.0 // indirect
42+
github.com/mailru/easyjson v0.7.7 // indirect
43+
github.com/mattetti/filebuffer v1.0.1 // indirect
44+
github.com/mattn/go-colorable v0.1.12 // indirect
45+
github.com/mattn/go-isatty v0.0.14 // indirect
46+
github.com/mattn/go-runewidth v0.0.14 // indirect
47+
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
48+
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
49+
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
50+
github.com/modern-go/reflect2 v1.0.2 // indirect
51+
github.com/oklog/run v1.1.0 // indirect
52+
github.com/olekukonko/tablewriter v0.0.5 // indirect
53+
github.com/pierrec/lz4/v4 v4.1.8 // indirect
54+
github.com/pmezard/go-difflib v1.0.0 // indirect
55+
github.com/prometheus/client_golang v1.14.0 // indirect
56+
github.com/prometheus/client_model v0.3.0 // indirect
57+
github.com/prometheus/common v0.37.0 // indirect
58+
github.com/prometheus/procfs v0.8.0 // indirect
59+
github.com/rivo/uniseg v0.2.0 // indirect
60+
github.com/russross/blackfriday/v2 v2.0.1 // indirect
61+
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
62+
github.com/unknwon/bra v0.0.0-20200517080246-1e3013ecaff8 // indirect
63+
github.com/unknwon/com v1.0.1 // indirect
64+
github.com/unknwon/log v0.0.0-20150304194804-e617c87089d3 // indirect
65+
github.com/urfave/cli v1.22.1 // indirect
66+
golang.org/x/net v0.2.0 // indirect
67+
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect
68+
golang.org/x/sys v0.2.0 // indirect
69+
golang.org/x/text v0.4.0 // indirect
70+
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
71+
google.golang.org/genproto v0.0.0-20221114212237-e4508ebdbee1 // indirect
72+
google.golang.org/grpc v1.50.1 // indirect
73+
google.golang.org/protobuf v1.28.1 // indirect
74+
gopkg.in/fsnotify/fsnotify.v1 v1.4.7 // indirect
75+
gopkg.in/yaml.v2 v2.4.0 // indirect
76+
gopkg.in/yaml.v3 v3.0.1 // indirect
977
)

0 commit comments

Comments
 (0)