influxdata / docs-v2

InfluxData Documentation that covers InfluxDB Cloud, InfluxDB OSS 2.x, InfluxDB OSS 1.x, InfluxDB Enterprise, Telegraf, Chronograf, Kapacitor, and Flux.
https://docs.influxdata.com
MIT License
72 stars 268 forks source link

"host" is repeatedly used as questionable descriptor for full url aka "http://localhost:8086" #5644

Open wolfgangr opened 6 days ago

wolfgangr commented 6 days ago

Describe the issue here.

complicated description arising from backup error here:
https://github.com/influxdata/influxdb/issues/25460

simple root cause: influx ping --host localhost does not work influx ping --host "http://localhost:8086" works

I'd consider it as an documentation issue.
There are loads of web articles from people trapped by this.
"host" in my mental dictionary is just the "host" part of an URL, while in influx world, obviously it refers to a complete url:
"protocol://host:port"

I know that any influx pro is just rofl on this case.
But climbing up the learning curve this are silly issues costing you hours of work.

Relevant URLs
jstirnaman commented 6 days ago

@wolfgangr Thanks for raising this. I agree that the naming of the --host flag and the corresponding env variable can be misleading for the reason you describe. For that reason, in the CLI reference we use phrasing like the following:

HTTP address of InfluxDB (default: http://localhost:8086)

Do you have an example in the docs web site that isn't clear about this or are you referring to the Usage docs in the CLI itself? The URL that you listed (https://docs.influxdata.com/influxdb/v2/admin/backup-restore/backup/) doesn't include the use of --host.

wolfgangr commented 5 days ago

The URL that you listed (https://docs.influxdata.com/influxdb/v2/admin/backup-restore/backup/) doesn't include the use of --host.

Sure? :see_no_evil: :speak_no_evil: :grin:

The superficial answer might be:
"Well, that's the mistake then"

But we don't spend our time on deciding who is right and wrong, but on assisting other people not to fall in the same trap - OK?
So let me try to step down the rabitt hole of causality

I try to remember:

What could the influx development team do to avoid people get trapped?

Envrionment variables

Of course, this is a matter of habit and taste. But those have reasons, too:

From https://peps.python.org/pep-0020/#the-zen-of-python

Namespaces are one honking great idea -- let's do more of those!

...and the cmd line env is a namespace with quite a laaaarge scope.

I know that many projects - Python itself among them - don't care about this wisdom and release uncooperative Software.
And then end up in requiring virtual environments, docker images and whatever kind of sanboxing to manage even simple task.

Sure, you may add your veryveryvery secret token to your .bashrc, if you're on a docker jail or development-dont-care-box.

But on a headless production machine, when I administer dozens of services from parallel ssh sessions maybe from different clients, that's not the way to go. OK, may be, in fine crafted skripted shell pipelines, environment variables have their place, too. But the maturing path from development to deployment leads through the quagmire of interactive trial, testing, and hands-on quick fixes, which quite often are performed on an interactive command line.

Anyway, essence: May be you don't implicitly assume that people keep their config in environment variables when you write your documentation

Misleading error messages

Having understood my mistake, it was immediately obvious that the "version mismatch" did not come from influxdb <-> influx cmd line, but from apache <-> influx cmd line, sitting at the default http port.

The developer may say "so, look, not my fault".
But the user feels "but still my problem".

Essence: since the web is full of similiar case report, may be it is worth to consider to catch this case (reporting server seems not to be an influxDB) and report a proper error message aka "host may not be a influxd, please check your host URL . format http://hostname:port"

Organisation of documentation

To admit, I find the structure of Influx documentation rather confusing.
I have at least three windows of firefox open, each with a dozen or so Influx/telegraf documentation, and some web searches and strayed forum threads to geht ahead.
I'm sure, you are aware of that and work on that issue, right?

If you think my input may help you in your strive to improve documentation, we may try to dig further.

If you think that's OK rihgt now or even I'm stealing your valuable time, simply close the issue.

wolfgangr commented 5 days ago

just cleaning up and found the files I think yo might think "why didn't he look there":

https://docs.influxdata.com/influxdb/v2/reference/cli/influx/backup/

Indeed is refered to by the issue's starting page in a Link quite at the bottom. In the example section, there is no full URL as required.

The option flag enty reads
--host HTTP address of InfluxDB (default: http://localhost:8086)

I can remeber having seen this before.
And at superficial reading, I'd understand: "when no --host is provided, it defaults to this setting"
and (... implicitly, false...): "if only hostname ist given, protocol will default to http and port to 8086"

For protocol, the guess was right, for port is was wrong. Presumably, with some clue I might have startet looking closer there and might even had found the solution.

Howerver the message presented didn't provide any clue that I was talking to the wrong server.

influx backup: Error: API compatibility check failed: Get "/health": unsupported protocol scheme

It was only when I got the second line of the message with a influx ping and did a web search on that, when I found the solution.

May be even the first line (presumably added by the backup code?) was even intended to provide assisting information.
Maybe, for a developer or influx professional, it does.
For the casual admin, it is even more distracting.


the other one is
https://docs.influxdata.com/influxdb/v2/reference/urls/
Even there it reads Default port: 8086

jstirnaman commented 7 hours ago

I understand and apologize for the confusion. I see your point about the language used to describe the InfluxDB default URL in the influx CLI (and that may exist in other clients).

I'll keep this ticket open with this list of suggested improvements:

I'm sure I missed some finer points, so please list them if you can.

To admit, I find the structure of Influx documentation rather confusing.

If you have specific suggestions where we can improve, please add them. We have many docs improvements we want to make, but, like you, limited time and resources. This will help us prioritize.

FWIW, reliance on environment variables is also my pet peeve and I wish our documentation and tooling didn't rely on or assume them so often. I'm also a JS/UI developer and I get the dangers and annoyances of polluting the namespace. In newer examples, I lean more toward using explicit config and parameters, but that hasn't historically been the case for the docs and the clients. I'll keep fighting the fight.

We truly appreciate the patience and the feedback.