Comments (5)
Thank you for the information. Though surprising behavior, it is working now, so I’ll close this.
from sql_exporter.
Hmm, surprisingly, not urlencoding the socket path works, e.g. data_source_name: 'postgres://app_sql_exporter@/run/postgresql:5432/postgres'
from sql_exporter.
Hi @caseyandgina,
There's no need to encode the DSN as it needs to be parsed by dburl library.
We only might need to encode the password if it contains special characters.
from sql_exporter.
I was thinking it was due to the dburl library, but this is nonstandard behavior. Usually, the extra unescaped slashes in the hostname portion of the URI break things, so I’ve long been accustomed to having to escape these in postgres://
URIs.
For example:
$ psql "postgres://postgres@/run/postgresql/postgres"
psql: error: connection to server on socket "/run/postgresql/.s.PGSQL.5432" failed: FATAL: database "run/postgresql/postgres" does not exist
$ psql "postgres://postgres@%2Frun%2Fpostgresql/postgres"
psql (16.3 (Ubuntu 16.3-1.pgdg24.04+1))
Type "help" for help.
postgres=#
It also makes reading the URI's unclear. I'd rather be able to specify all the connection parameters separately in the YML rather than using a URI, but that doesn't seem to be a possibility presently. Or keyword/value syntax like this, which would require specifying the driver as a separate parameter:
$ psql "user=postgres host=/run/postgresql dbname=postgres"
psql (16.3 (Ubuntu 16.3-1.pgdg24.04+1))
Type "help" for help.
postgres=#
from sql_exporter.
As mentioned above, this project historically relies on DSN and lately 'dburl' (https://github.com/xo/dburl) parsing library to handle connection strings for different databases, protocols, transports and parameters. It provides a unified way to connect to all the supported databases with minimal effort, and seems sufficient for the project goals. Please have a look at the dependency by the posted link for more details on parsing the strings. 👍
What's also possible is you may use environment variables as placeholders in the DSN string and interpolate parts of it as needed.
For now there is no intention to change the connection configuration anytime soon.
from sql_exporter.
Related Issues (20)
- `up` metric to show that database connection was successful HOT 5
- parameter to set log file location HOT 8
- Add custom metrics to expose MSSQL server hostname HOT 1
- can we have the Postgres collector yml file example
- Is it possible to distinguish between the sql exporter process status and the target database? HOT 3
- Scrape each job separately HOT 2
- [helm] Support getting data-source-name from an existing secret HOT 12
- Ignore no rows returned HOT 6
- Better handling of NULL return values in certain cases HOT 6
- Environment variable substitution for DSN's HOT 3
- Cache Mechanism for sql exporter HOT 2
- clickhouse `context deadline exceeded` HOT 1
- Helm chart improvement: additionalContainers HOT 5
- Can it support the collection of cloud databases HOT 1
- unable to use -web.listen.address flag HOT 4
- SIGHUP config reload HOT 4
- Clickhouse requests dosn't work after upgrade clickhouse driver to v2 HOT 6
- Scrape errors not clearing without restart HOT 3
- Config interpolation (secrets) HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sql_exporter.