'Not implemented' error while using awsds

Hi dear people,

I’m struggling while implementing an own data source plugin for an AWS service, which should be very similar to the Redshift data source and the Athena data source (async implementation). That’s why my plugin is mostly a copy & past from those two plugins, which use the grafana-aws-sdk.

However, as soon as I query the backend plugin, I get as response from /query:

{"message":"Not implemented","messageId":"plugin.notImplemented","statusCode":501,"traceID":""}

I read that this means (usually?) that the QueryData method is not implemented, as clearly stated in the generated datasource.go. Indeed, I did not implement this, but it should be inherited from grafana-aws-sdk’s asyncDatasource.go.

But maybe, exactly this is not the case? I would very much appreciate your help - my Go experience is rather limited. My code is here.

  • What Grafana version and what operating system are you using?
    10.1 on MacOS

  • What are you trying to achieve?
    Implement a data source plugin for AWS CloudTrail Lake

  • How are you trying to achieve it?
    Copy & Paste from Athena and Redshift data sources

  • What happened?
    I messed it up

  • What did you expect to happen?
    Would be optimistic to say that it should work.

  • Can you copy/paste the configuration(s) that you are having problems with?
    GitHub StephenKing/grafana-cloudtraillake-datasource

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.

logger=context userId=0 orgId=1 uname= t=2023-10-21T20:17:36.877627012Z level=debug msg="Not implemented" error="[plugin.notImplemented] method not implemented" remote_addr= traceID=
logger=context userId=0 orgId=1 uname= t=2023-10-21T20:17:36.877713679Z level=error msg="Request Completed" method=POST path=/api/ds/query status=501 remote_addr= time_ms=8 duration=8.280622ms size=95 referer="http://localhost:3000/explore?left=%7B%22datasource%22%3A%22d10f5f20-4590-4eb1-9326-04643eb911d2%22%2C%22queries%22%3A%5B%7B%22format%22%3A1%2C%22rawSQL%22%3A%22asdasdasd%22%2C%22connectionArgs%22%3A%7B%22region%22%3A%22__default%22%7D%2C%22refId%22%3A%22A%22%2C%22datasource%22%3A%7B%22type%22%3A%22emnify-cloudtraillake-datasource%22%2C%22uid%22%3A%22d10f5f20-4590-4eb1-9326-04643eb911d2%22%7D%7D%5D%2C%22range%22%3A%7B%22from%22%3A%22now-1h%22%2C%22to%22%3A%22now%22%7D%7D&orgId=1" handler=/api/ds/query
  • Did you follow any online instructions? If so, what is the URL?

Build a data source backend plugin | Grafana Plugin Tools

P.S: sorry that I’m not properly linking resources, but as (rather) new user, I can only include 2 links in my posting.

Here are the links that I could not include for your convenience

Hey @stephenking! I couldn’t access the repo with your code https://github.com/StephenKing/grafana-cloudtraillake-datasource
Would you double check the link or let me know if I missed something?

d’oh… fixed.

1 Like

So I’m just trying to build your plugin locally as well and debug from there.
When you mentioned “as soon as I query the backend plugin” how did you query it? Through the frontend?
I ask because I ran into a problem building the frontend with yarn dev. There are some build errors and I’m seeing references to some Athena types that don’t seem to exist in your code. Did you see that?

Thanks for checking!

I used npm run server successfully. I add the connection and issue queries. That’s where I then get the errors.

Indeed, I also see errors when using yarn dev. Those come from the tests, but, who needs tests… upps. Yes I did not touch them, yet after copying from Athena plugin.

I’ve now fixed the tests, was easier than expected (even without deleting all of them).

1 Like

I think one issue is that on this line https://github.com/StephenKing/grafana-cloudtraillake-datasource/blob/9d679e6ea81f9679086b355cc900431e5ec5af48/pkg/main.go#L28 it should be ds.NewDatasource instead of plugin.NewDatasouce.

At least the error is quite different with this change!

1 Like

yeah, nice. Thanks a lot!
I see my plugin being called now

I treat the following error as a (preliminary) success :wink:

level=error msg=“Internal server error” error=“[plugin.downstreamError] failed to query data: Failed to query data: rpc error: code = Unknown desc = did not expect to call Connect method”

1 Like