Comments (6)
Hey @Maros112358, thanks for reporting another issue! I'll have a look soon. I'll try to squeeze in the fix into the v0.13
release. 👍
from sql_exporter.
Yes. Maybe it would also make sense, that in case of partial results (some failed, some succeeded) if result for specific metric/target is succesful, we return this result for the cache period. In case of partial results if the result was not succesful, we try to fetch fresh metrics on the next scrape until we succeed. What do you think?
Ah, this is tricky. The exporter is generally a stateless service (which also justifies its small footprint). We have a temporary cache storage to prevent spamming databases with requests. We can also prevent populating cache with invalid metrics (this PR), so if the cache is empty - we try to fetch something instead of waiting for cache to expire.
The alternative is - if there's one invalid metric, we decline the whole scrape. This is more strict, but sometimes just wasting already retrieved info is cruel. Also, some users asked for the partial returns. But these are our only options without introducing more complexity.
Watching for specific metric results, unfortunately, requires adding some state machine and store more metadata in memory between scrapes. This would significantly increase the complexity of this solution and is undesired.
We increase scrape_errors_total
for invalid metrics, so I think this can be used as a signal to check if something needs to be addressed.
from sql_exporter.
I just checked the branch fix/cache-false and it works as expected. Great work. 👍 ⚡
Cool, thanks for testing it! 🙏 I'll review the PR again with a fresh mind and hope to merge it soon. 👍
from sql_exporter.
I've managed to reproduce the issue, and came up with a fix. I'll test it properly first to make sure we don't get any unexpected regressions. Maybe you can also test it on your end as well (you'd need to checkout the branch in the PR and build the exporter). That'd be helpful as I cannot test against MSSQL (there's no instance I can access, unfortunately).
We prefer to return partial results, so if among multiple metrics configured, there's at least one successful, we return this result for the cache period. If there's none (e.g. it's a single metric, or all of them failed), we try to fetch fresh metrics on the next scrape until the cache has some goods.
Please let me know if you see any flaws in my reasoning. :)
P.S. I also learnt that mssql
driver doesn't respect proper context handling. This is the original issue, and this is a recent reference to it. But it doesn't make it different, just a fun fact.
from sql_exporter.
Hello @burningalchemist, thank you for looking into it.
We prefer to return partial results, so if among multiple metrics configured, there's at least one successful, we return this result for the cache period.
Yes. Maybe it would also make sense, that in case of partial results (some failed, some succeeded) if result for specific metric/target is succesful, we return this result for the cache period. In case of partial results if the result was not succesful, we try to fetch fresh metrics on the next scrape until we succeed. What do you think?
If there's none (e.g. it's a single metric, or all of them failed), we try to fetch fresh metrics on the next scrape until the cache has some goods.
Yes, exactly. :)
from sql_exporter.
I just checked the branch fix/cache-false
and it works as expected. Great work. 👍 ⚡
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
- Can't use UNIX socket for postgres connection HOT 5
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.