-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Switch to the InfluxDB 2 Go client library #1730
Comments
Looking at the new and old it looks like there seems to be very little reason to upgrade, unless someone has multiple orgs ... We could also drop the dependency and just do the requests on our own, we do 2 requests that are pure HTTP and will let us try to optimize the marshaling or anything else depending on our types. And also we won't wait on the dependency to add basic functionality .. that then I forgot to use it 🤦 |
From my tests with v2 a few months ago we weren't able to write to it, though I forget the exact reason... The line protocol format seems to have remained backwards compatible, but there are some conceptual differences with org support and more robust auth in v2 that make it incompatible with v1 clients. Plus the switch from InfluxQL to Flux which shouldn't matter for us, but it hints that they're fundamentally different. |
I'd live to see InfluxDB v2 support as well. It's a big upgrade, and has the data explorer & dashboard built-in so no need for Grafana. It would make consuming k6.io data much easier |
I saw that authentication is different in v2, it would be awesome to have InfluxDB v2 support and take advantage of flux features |
We are already using influxdb v2, and building a new v1 environment for k6 reporting is a pain in the ass for us, while the v2 integrated panel is sufficient for us. |
I think this is something we should be able to do for k6 v0.32.0. We refactored the output interface recently (#1869), to fix a bunch of issues and to make writing new outputs easier and output extensions possible. So far, only the In any case, support for output extensions with https://github.com/k6io/xk6 for sure will be released in k6 v0.31.0 next week. This should allow anyone to make an extensions with influxdb2 support almost immediately. And I am not promising anything for sure, but when we're moving the influxdb output from the old |
This is fantastic, will there be a guide to using xk6 for creating an output extension, even if it's a simple example? |
There probably will be a page in the docs or maybe a blog post after we release k6 v0.31.0 (hopefully next week). For now, even this guide for JS extensions should suffice with a bit of work: https://k6.io/blog/extending-k6-with-xk6 For output extensions, instead of calling Where This is a complete example of an output that implements the new interface, though as I linked above, the |
As a workaround for this I can recommend using telegraf with a config like:
Obviously, URL/ports, the token, organization, and the bucket need to be configured. With the added bonus that the |
I tried to develop an extension based on the above information to write the output of k6 into the v2 version of influxDB, which should solve the problem If there is any help, please help me with a star, thanks! |
In addition, for go, I am a newbie, any suggestions and improvements are welcome |
Awesome 🎉 I was about to point out that you shouldn't make network requests in |
Thank you very much for the suggestion, @na-- . |
Ah, sorry, I didn't mean that you had to change your code. From what I can see, it would work alright, because the InfluxDB v2 SDK batches the metrics and sends them in the background, asynchronously. So your code should be fine as it is. The v1 SDK didn't have such capabilities, so we had to implement them ourselves, on the k6 side. We have to do them for other output types as well, for example see the JSON output. That's why I created the |
Thanks again for your reply, I have figured out what you want to say. Go's chan is very cool and I can already feel its power by simply reading your code. The mechanism of message communication to avoid race conditions is a bit similar to AKKA's Actor pattern. Have a great time! |
Has there been any timeline decision on when influxdb 2 support will be added? |
@thecodejunkie, sorry, we didn't manage to get this in k6 v0.32.0. We thought it wasn't very urgent, since it seemed @li-zhixin had a workable extension, but that seems to have disappeared 😕 We'll try to fix it later in the v0.33.0 cycle, but if anyone wants to tackle it sooner, please say so and feel free to make a k6 PR ( |
For those who'd like to use the Telegraf config from @mstoykov in #1730 (comment), I've got it working with this setup: docker-compose.yml version: '3.8'
services:
influxdb:
image: influxdb:2.0.6-alpine
environment:
DOCKER_INFLUXDB_INIT_MODE: setup
DOCKER_INFLUXDB_INIT_USERNAME: username
DOCKER_INFLUXDB_INIT_PASSWORD: password
DOCKER_INFLUXDB_INIT_ORG: org
DOCKER_INFLUXDB_INIT_BUCKET: data
DOCKER_INFLUXDB_INIT_ADMIN_TOKEN: very-secret-token
volumes:
- influxdb-config:/etc/influxdb2
- influxdb-data:/var/lib/influxdb2
networks:
- data
telegraf:
image: telegraf:1.18.2-alpine
volumes:
- ./docker/telegraf/telegraf.conf:/etc/telegraf/telegraf.conf
networks:
- data
volumes:
influxdb-config:
influxdb-data:
networks:
data:
driver: bridge ./docker/telegraf/telegraf.conf
|
Sorry about this, the repository is now back |
@li-zhixin for some reason I can't get your extension to work. I just get this error:
When I try to run a workflow with the |
… version. When this enhancement is added to K6, we can go back to using :latest : grafana/k6#1730 (comment) Closes #2
Using the extension provided by @li-zhixin fixed my issues with k6 disconnecting from telegraf influx listener when the number of vus increases. Really looking forward to official support. |
We have a PR that adds support for InfluxDB v2 natively in k6, if someone wants to try it: #2110 Unfortunately, we didn't have enough time to test and benchmark it properly for it to go in k6 v0.34.0, so we won't merge it right now... 😞 We'll instead make it into an "official" xk6 extension in the coming days, so it's more easily usable right now and so we get some feedback from the community, and merge it to |
Hi @BrynCooke, can you add more details about the experienced issues? We would identify and check if they are still available in the upcoming release and in the new InfluxDB v2 PR. |
The setup was a gke cluster with separate nodes for k6 and the server under test. Telegraf is configured to send to grafana-cloud and also provide nodestats. The test was a stress test where the number of vus would increase over time. When running the test it would get to a certain number of vus (300 in my case) and then print something like: The cluster nodes didn't look under stress at all. |
Hello, As you can see from some previous activities in this issue, we explored the original plan to include this feature directly in the k6 OSS core, however, it turns out that there were some critical issues from k6’s perspective:
Considering those topics we decided that including the Currently, we don’t have a concrete future plan for integrating the InfluxDBv2 extension in the K6 OSS core, but we are not excluding it either. We will analyze the impact and feedback that we will get from the community and we will prioritize the future development accordingly to it. For this reason, we are keeping this issue open. Feel free to try the extension and open feature requests or bug issues directly in the extension’s repository. Please, don’t use this issue for reporting problems with the extension. |
+1 to integrate it into CORE K6:
|
Reported in grafana/k6#1883, this fix should suffice until we get around to grafana/k6#1730 and/or grafana/k6#1614
…ble with InfluxDB 1.8 and K6 has still not added support for InfluxDB 2: grafana/k6#1730
InfluxDB3.0 is out and much faster and k6 is still hanging on the 1.8... |
Hello, We're not planning to switch to InfluxDB v2 client because it does not have support for v1 (as expected), and doing such thing would represent a breaking change for all the existing users. Also, because we don't have capacity to keep that support as part of the core of k6 (and keep track with all new releases), and we prefer to prioritize standards like Open Telemetry instead. For those users looking for support for v2, there's an available extension:
For those users looking for support for v3, contributions (in form of extensions as well), are welcome! 😄 So, with all that being said, I proceed to close this issue, as I think there's no remaining action or pending work to do. Thanks! |
Prompted by this community forum question, I noticed that we're currently using the old InlfuxDB library (notice
influxdb1-client
): https://github.com/loadimpact/k6/blob/6081e6a3ff488990aab3fa349a84521cd495a1b3/stats/influxdb/collector.go#L30https://github.com/influxdata/influxdb-client-go appears to be the new version, from its readme:
InfluxDB v1.8.0 seems to have been released on 2020-04-13, so it might be a bit too early to switch to the new Go library, considering that InfluxDB 2 should be somewhat backwards compatible, but in a few months it will probably be fine.
The text was updated successfully, but these errors were encountered: