3 Commits

Author SHA1 Message Date
Jeffrey Smith II
f34e6a888f
feat: add username and password login (#418)
* feat: add username and password login

* fix: make sure cookie is not empty

* chore: go mod tidy

* fix: prevent local config from influencing tests

* fix: small cleanup on error handling

* fix: remove unnecessary trim
2022-07-28 10:53:19 -04:00
Marko Mikulicic
becbe8f7b8
fix: Use influx-debug-id header (#338)
Influxdata cloud2 uses a different mechanism to enable tracing.
You need to pass a `influx-debug-id` header (the value is ignored) and if the response contains
`trace-sampled: true` then the response's `trace-id` header contains a valid trace ID that can be
used to jump to the trace in jaeger.

If the request has been sampled, we print the trace-id to stderr.

Since modern terminals allow to click on hyperlinks, we could avoid a copy&paste of the trace id
if the `influx` binary wrote a the link to the jeager trace.
However, we don't want to hardcode the URL of the internal jaeger endpoint in the binary.

I tried adding a wrapper script on my machine that would just capture the trace-id and render it, but it's
hard to do without messing with the ordering of the stderr and stdout lines.
Thus I preferred adding a secret env var that controls the formatting of the trace-id and can be used
by our devs to generate links to our internal jaeger instance.

```console
$ export INFLUX_CLI_TRACE_PRINT_PREFIX="Trace: https://jaeger.my.cloud/trace/"
$ influx query --trace-debug-id 123 -f query.flux
Trace: https://jaeger.my.cloud/trace/f39a69354a3acca6
Result: _result
Table: keys: [_measurement]
...
```
2021-12-03 17:54:47 +01:00
Daniel Moran
1dad2f5f72
refactor: move things around to make building a client easier from other projects (#123)
* refactor: split logic for building API config into public func
* refactor: move config code out of internal/
2021-06-16 11:09:26 -04:00