Giter Club home page Giter Club logo

Comments (3)

DanielOliver avatar DanielOliver commented on June 23, 2024

Good question that I should have clarified before. That's a timeout that starts when a prometheus instance calls the metrics endpoint, which is what triggers each query to run and to measure. Without the prometheus instance scraping the metrics endpoint, no queries will run at all.

var results = Task.WhenAll(_metrics.Select(x => x.MeasureWithConnection(_logger, _sqlConnectionString, _millisecondTimeout)).ToArray()).ConfigureAwait(false).GetAwaiter().GetResult();

As best as resources allow, every query will be called in parallel and then each query must finish before that timeout happens, or else each failed individual query will contribute to a built-in "timed out queries" gauge metric that merely shows how many queries are timing out.

There is currently a minor ability to set an individual query timeout. Each query might have a timeout also set, but the timeout that will be used is the minimum between the global timeout and the query timeout.

var timeout = Math.Min(defaultMillisecondTimeout, query.MillisecondTimeout ?? 100_000_000);

    "Queries": [
        {
            "Name": "mssql_deadlocks",
            "Query": "SELECT cntr_value FROM sys.dm_os_performance_counters where counter_name = 'Number of Deadlocks/sec' AND instance_name = '_Total'",
            "Description": "Number of lock requests per second that resulted in a deadlock since last restart",
            "Columns": [
                {
                    "Name": "cntr_value",
                    "Label": "mssql_deadlocks",
                    "Usage": "Gauge",
                    "DefaultValue": 0
                }
            ],
            "MillisecondTimeout": 2000
        }
    ],
    "MillisecondTimeout": 4000
}

The reason that I so insistently throw a hard limit on query times out there is that I don't want monitoring to be a big performance hit on my SQL Server instances, AND because I tend to make aggressively small timeouts on prometheus scrape targets to keep things as light as possible.
https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config

from mssql_exporter.

DanielOliver avatar DanielOliver commented on June 23, 2024

And to the last part of your question, you always could start multiple exporter processes, but that seems like a lot of overhead. I'd rather reach a solution that doesn't require a lot of these instances.

from mssql_exporter.

Mario-Hofstaetter avatar Mario-Hofstaetter commented on June 23, 2024

Thank you for your answers.
What would you recommend as a possible way, if some querys are taking more time?

First thing that came to my mind is: offloading the query to e.g. SQL Server Agent and caching the results in temporary tables, which then can be scraped quickly.

Probably I should ensure my querys don't take that darn long though :-/

from mssql_exporter.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.