Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upSanity when working with relative paths in config #2247
Comments
msiebuhr
referenced this issue
Dec 3, 2016
Merged
web: Display current working directory on status-page #2248
This comment has been minimized.
This comment has been minimized.
|
For the record, I ended up just banging in the absolute path in the config. Ugly, but working. |
msiebuhr
changed the title
Hand out working directory in /status-page
Sanity when working with relative paths in config
Dec 3, 2016
This comment has been minimized.
This comment has been minimized.
That's intended behavior. We expect rule and target files to not necessarily exist at startup time. Generally, just using absolute paths in a production config is generally more sane but might indeed be ugly for longer paths. For rule files an API endpoint (and corresponding UI view) showing what files were discovered were could help. But exposing equally detailed runtime information on file SD etc. would be quite the maintenance burden. |
This comment has been minimized.
This comment has been minimized.
|
Right. I can see how it'll be difficult to expose meaningful info in such corner-cases. Wrt. the metrics, I did expect something to show up on how many targets each service-discovery mechanism coughs up with (might also be relevant in comparison w. number of scraped services). Another brainfart - expand relative paths to absolute ones when rendering the |
This comment has been minimized.
This comment has been minimized.
|
I'm not sure we should be munging paths in the config. I can imagine that catching users out where the base of the path is dynamic, and they want to do a straight config copy elsewhere. |
This comment has been minimized.
This comment has been minimized.
powerman
commented
Mar 1, 2017
|
Guys, do not go crazy, just resolve relative paths in config as relative to config file location - like everybody else does. Anything else is counter-intuitive and doesn't makes much sense. Another option is ban relative paths at all. But resolving relative paths in config as relative to directory where prometheus binary was executed - is just plain wrong because may result in undefined behaviour depending on subtle environment change. But, if you insist on current behaviour, then lifehack is:
|
brian-brazil
added this to the v2.x milestone
Mar 27, 2017
brian-brazil
referenced this issue
Apr 7, 2017
Closed
File-based service discovery doesn't accept relative paths to files #2603
This comment has been minimized.
This comment has been minimized.
|
So what's missing to resolve this is to apply the resolution of files paths relative to the config to file SD? (https://github.com/prometheus/prometheus/blob/dev-2.0/config/config.go#L248) |
This comment has been minimized.
This comment has been minimized.
|
That sounds about right to me. I think this should go in 2.0. |
fabxc
closed this
Jul 4, 2017
This comment has been minimized.
This comment has been minimized.
lock
bot
commented
Mar 23, 2019
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
msiebuhr commentedDec 3, 2016
What did you do?
Inserted a relative path in
prometheus.yml(see #2246 for some context).What did you expect to see?
That it resolved relative to the path of
prometheus.yml(element of least surprise and all), imported the service-definitions of the file and so on.What did you see instead? Under which circumstances?
Nothing. No errors, no internal metrics to indicate no files were found/imported.
Given I was working in an unfamiliar environment (FreeBSD jail; I'm a linux-guy), I couldn't readily find a way to find out what the working directory of the running prometheus server was (
/proc/$pid/cwddoesn't exist, norstrace. Some poking atktraceanddtracedidn't look promising without investing a lot of time in learning them, ...)Though I did expect the menu status → Runtime & Build information to show the CWD, it didn't.
Environment
System information:
FreeBSD 10.3-STABLE amd64
Prometheus version:
build user:
build date:
go version: go1.7.3