-
Notifications
You must be signed in to change notification settings - Fork 80
Added support for token auth #89
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
Conversation
f3b54f5
to
f804efe
Compare
@sunng87 Thanks for this contribution! 🚀 What's your plan to get this merged? Is there anything I can help you with? |
Hello, I just did tests with InfluxQL in cURL in terminal and it works very fast (milliseconds), now the same query takes up to 19 seconds in influxdb-rust. Any idea what the problem may be? |
@moisesdelacruz Could you open a separate issue with the curl command you're using and the code snippet which is taking so long? Thanks! |
@Empty2k12 Thanks for answering, comment here, because the test was done with Influxdb v2 and the branch of this PR. But I will open the new Issue. |
@moisesdelacruz Sorry for misunderstanding, thought you were having an issue with the released library. If it's caused by this PR, here's the right place. |
In this case it is bringing a month of data, where in every second there is at least one record.
Steps to Reproduce: #[tokio::main]
async fn main() {
// Connect to db `test` on `http://localhost:8086`
let client = Client::new("https://influxdb-host", "example_db")
.with_token("jwt");
// Let's see if the data we wrote is there
let read_query = Query::raw_read_query("SELECT * FROM example_db.example_rp.history WHERE tag='example'");
let start = Time::now();
let result = client
.query(&read_query)
.await;
let end = Time::now();
println!("{}", result.unwrap());
println!("{:?}", end - start); // Duration { seconds: 16, nanoseconds: 823561000 }
} VS curl --get https://influxdb-host/query?db=example_db \
--header "Authorization: Token jwt" \
--data-urlencode "q=SELECT * FROM example_db.example_rp.history WHERE tag='example'"
# took miliseconds |
@Empty2k12 Sorry for late response. I have been pretty busy these days. Most work should have been done. I'm going to setup CI to verify the lib on both InfluxDB 1.x and 2.0 |
Hello @Empty2k12 and @sunng87, I have already checked this PR on several occasions, and I think that the performance problem comes from before and not from this feature, unfortunately, all my data is in Influxdb v2 and I cannot test with the published version of this module. This PR looks good, I think we should look for the problem in another issue. Issue: #91 |
6472f84
to
8ab0cbf
Compare
What's the status on this PR? |
@msrd0 I was not able to test this on influxdb 2.0 over the CI. Its setup process is a little bit confusing. Help is welcomed. |
is there an update here? |
Any update? I was hoping to use the rust client in a project, seems like I'm blocked atm. |
@fredrik-jansson-se If there were any updates, they would be posted here. Someone needs to rebase these changes onto the main branch and setup CI to test with influxdb v2.0. |
This change has been merged as part of #118 |
Description
This patch adds support for token auth to make it easier to use backward compatibility API of influxdb 2.0
Checklist
cargo fmt --all
cargo clippy --all-targets --all-features -- -D warnings
cargo readme -r influxdb -t ../README.tpl > README.md
TODO items
username
/password
auth is not compatible with 1.x so you can only use token auth on 2.0.