Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updates for grafana 6.6.x #2

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

kyleboyle
Copy link

@kyleboyle kyleboyle commented Jan 30, 2020

  • backend dep updates
  • go grafana package dep updated
  • gofmt golang backend
  • suggested kairosdb url in grafana datasource
  • grafana-kairosdb docker image with kairosdb datasouce installed
  • updated readme with current build instructions

Screen Shot 2020-01-29 at 9 52 56 PM

Screen Shot 2020-01-29 at 9 55 33 PM

- backend dep updates
- go package updates
- gofmt bakend
- suggested kairosdb url in grafana datasource
- grafana-kairosdb docker image with kairosdb datasouce installed
- updated readme with current build instructions
@brianhks
Copy link
Member

Nice work. I'll likely branch the current code to keep it for grafana 5 compatibility and then merge this one to master.

@kyleboyle
Copy link
Author

@brianhks I noticed that the plugin does not currently implement a testDatasource() verification function which is suppose to test the validity of the ds connection configuration. Do you think a good verification procedure would be to to get the metric names or is there a no-op query that could be executed to test?

@brianhks
Copy link
Member

Yes that is a good idea. I'd call /api/v1/health/check

It returns a 204 if healthy and 500 if not. I think we added it specifically for load balancers to detect if Kairos is up and happy.

@kyleboyle
Copy link
Author

Updated. I didn't make it verify specifically 204 vs 200 but that probably doesn't matter.

@kyleboyle
Copy link
Author

@brianhks What else do I need to do to get this merged. It seems people are starting using my branch instead off official, which is bad.

@kyleboyle kyleboyle changed the title updates for grafana 6.6.0 updates for grafana 6.6.x Feb 21, 2020
@mr-yaky
Copy link

mr-yaky commented Feb 26, 2020

Hi @kyleboyle,

I tried to build kairosdb-datasource plugin from your branch but got this error:

# make backend
env GOOS=darwin GOARCH=amd64 go build -o ./dist/grafana-kairosdb-datasource_darwin_amd64 ./pkg
# github.com/grafana/kairosdb-datasource/pkg
pkg/plugin.go:41:5: cannot use "github.com/kyleboyle/kairosdb-datasource/pkg/datasource".NewKairosDBDatasource(kairosClient, metricQueryConverter) (type *"github.com/kyleboyle/kairosdb-datasource/pkg/datasource".KairosDBDatasource) as type "github.com/grafana/kairosdb-datasource/vendor/github.com/grafana/grafana_plugin_model/go/datasource".DatasourcePlugin in field value:
	*"github.com/kyleboyle/kairosdb-datasource/pkg/datasource".KairosDBDatasource does not implement "github.com/grafana/kairosdb-datasource/vendor/github.com/grafana/grafana_plugin_model/go/datasource".DatasourcePlugin (wrong type for Query method)
		have Query(context.Context, *"github.com/kyleboyle/kairosdb-datasource/vendor/github.com/grafana/grafana_plugin_model/go/datasource".DatasourceRequest) (*"github.com/kyleboyle/kairosdb-datasource/vendor/github.com/grafana/grafana_plugin_model/go/datasource".DatasourceResponse, error)
		want Query(context.Context, *"github.com/grafana/kairosdb-datasource/vendor/github.com/grafana/grafana_plugin_model/go/datasource".DatasourceRequest) (*"github.com/grafana/kairosdb-datasource/vendor/github.com/grafana/grafana_plugin_model/go/datasource".DatasourceResponse, error)
pkg/plugin.go:44:3: cannot use logger (type "github.com/kyleboyle/kairosdb-datasource/vendor/github.com/hashicorp/go-hclog".Logger) as type "github.com/grafana/kairosdb-datasource/vendor/github.com/hashicorp/go-hclog".Logger in field value:
	"github.com/kyleboyle/kairosdb-datasource/vendor/github.com/hashicorp/go-hclog".Logger does not implement "github.com/grafana/kairosdb-datasource/vendor/github.com/hashicorp/go-hclog".Logger (wrong type for Named method)
		have Named(string) "github.com/kyleboyle/kairosdb-datasource/vendor/github.com/hashicorp/go-hclog".Logger
		want Named(string) "github.com/grafana/kairosdb-datasource/vendor/github.com/hashicorp/go-hclog".Logger
make: *** [Makefile:8: backend] Error 2

I have followed steps from ReadMe file but can't build backend yet.

ENV info:

# cat /etc/debian_version 
10.2
# go version
go version go1.13.8 linux/amd64
# node --version
v10.15.2

Can you check it, please ?

@mr-yaky
Copy link

mr-yaky commented Feb 26, 2020

Found the problem. After installing dep tool and using it for installing all dependencies I could compile backend. Anyway I can't use it yet with my Grafana 6.4.x. I get following in Grafana Web UI:

Error: Unexpected token '<' Evaluating http://localhost:8080/public/app/plugins/datasource/grafana-kairosdb-datasource/module Loading app/plugins/datasource/grafana-kairosdb-datasource/module
Data Source Error

As I understood it's limited to 6.6.x as minimal supported version. So, I'll upgrade Grafana to latest and then will test again. Hope this will work finally because we really need KairosDB as datastore for Grafana.

@kyleboyle
Copy link
Author

kyleboyle commented Feb 27, 2020

@mr-yaky If you are just looking to use it, everything is already compiled and committed under "dist". I'm hoping my branch will be merged soon so that these source path issues are not confusing.

@mr-yaky
Copy link

mr-yaky commented Feb 27, 2020

Yes, thank you. But I was need to compile backend for using on Alpine Linux (musl library). So, because that I have recompiled it.

@kyleboyle
Copy link
Author

Ok sounds good. Based on your error message I think you should have cloned it to a go path .../grafana/kairosdb-datasource/ and not .../kyleboyle/kairosdb-datasource

@mr-yaky
Copy link

mr-yaky commented Mar 3, 2020

Hi @kyleboyle, I have updated to 6.6.1 Grafana version but still get the same problem:
Screenshot from 2020-03-03 14-05-16

I use official grafana docker image and put plugin to following directory:

/usr/share/grafana $ ls -l public/app/plugins/datasource/grafana-kairosdb-datasource/
total 14328
-rw-r--r--    1 root     root          2621 Feb 27 17:40 README.md
drwxr-xr-x    1 root     root             6 Mar  3 12:40 beans
drwxr-xr-x    1 root     root             4 Mar  3 12:40 controllers
drwxr-xr-x    1 root     root            18 Mar  3 12:40 core
drwxr-xr-x    1 root     root             1 Mar  3 12:40 css
drwxr-xr-x    1 root     root            29 Mar  3 12:40 directives
drwxr-xr-x    1 root     root             0 Feb 27 17:41 etc
-rwxr-xr-x    1 root     root      14657179 Feb 27 17:43 grafana-kairosdb-datasource_linux_amd64
drwxr-xr-x    1 root     root             2 Mar  3 12:40 img
-rw-r--r--    1 root     root           480 Feb 27 17:41 module.d.ts
-rw-r--r--    1 root     root          3593 Feb 27 17:41 module.js
-rw-r--r--    1 root     root           762 Feb 27 17:41 module.js.map
-rw-r--r--    1 root     root          1680 Feb 27 17:40 module.ts
-rw-r--r--    1 root     root          1886 Feb 27 17:41 package.json
drwxr-xr-x    1 root     root            16 Mar  3 12:40 partials
-rw-r--r--    1 root     root           865 Feb 27 17:40 plugin.json
drwxr-xr-x    1 root     root            16 Mar  3 12:40 utils

I tried also to copy already compiled dist files from your git repo but unfortunately got the same.
Any ideas why it's not working ?

@kyleboyle
Copy link
Author

kyleboyle commented Mar 3, 2020

@mr-yaky Here is a baseline test that works:

git clone https://github.com/kyleboyle/kairosdb-datasource.git
cd kairosdb-datasource
docker run -d -p 3000:3000 -v $(pwd)/dist:/var/lib/grafana/plugins/grafana-kairosdb-datasource --name grafana grafana/grafana:6.6.1

@mr-yaky
Copy link

mr-yaky commented Mar 6, 2020

@kyleboyle Yes, you are right. I have tried to use other path and when I put this plugin exactly to /var/lib/grafana/plugins it has started working.

Thank you! I hope this PR will be merged finally.

@kopens-lsb
Copy link

Start with setting up the go workspace and provide detailed installation procedures. I am having difficulty installing with a wiki manual. I need your help.

-- my env--
o/s : centos 7
grafana install dir : /home/kopens/plantpulse/grafana

@kyleboyle
Copy link
Author

@kopenslsb If you are just looking to use it, everything is already compiled and committed under "dist". There is no reason to build the go plugin. If you are looking to make changes to the go plugin you should already know how to set up a working build env.

@kopens-lsb
Copy link

My grapana is installed somewhere other than the default installation directory.
For example, if it is installed in /home/kopens/plantpulse-timeseries/grafna/..,
how should it be solved?

@kyleboyle
Copy link
Author

@kopenslsb grafana loads plugins from its plugin directory. You will need to copy this plugin to that location.

@djzort
Copy link

djzort commented Jun 11, 2020

Any update on this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants