Coder Social home page Coder Social logo

Comments (2)

sandersaares avatar sandersaares commented on June 2, 2024

By default, recent prometheus-net versions will export metrics published via the .NET Meters API. .NET 8 added many new built-in metrics and I expect future versions of .NET will also add more that will become visible via this adapter. If you do not want these metrics to be exported, you can indeed use Metrics.SuppressDefaultMetrics(). This also has an overload that takes a SuppressDefaultMetricOptions for more fine-grained control.

Alternatively, if you wish to keep the .NET Meters API metrics, you can fine-tune their export (and filter out instruments you do not want) by calling Metrics.ConfigureMeterAdapter().

Is this enabled by default? Surely if metrics are removed between scrapes there's a chance that some incremented values will be lost? If this is on by default, can it be turned off.

Yes, metrics exposed via the .NET Meters API by default expire after 5 minutes since there is no functionality in the .NET Meters API to say that a timeseries has gone away, which risks garbage building up in memory (as many client apps create unique metrics per request/session or similar business objects, which would stick around forever without this expiration). This only affects the .NET Meters API adapter.

Indeed, there is a risk here that rarely updated metrics will be lost - the assumption is that an active app will be publishing values at a regular rate. If you have an app that publishes metrics rarely via the .NET Meters API, increasing the timeout may be appropriate.

You can configure this timeout via Metrics.ConfigureMeterAdapter(). See MeterAdapterOptions for a list of all the possible configuration options.

from prometheus-net.

andy-g avatar andy-g commented on June 2, 2024

@sandersaares thanks so much for the detailed response, that really helps point me in the right direction, I'm sure I'll be able to configure the metrics I'm needing based on what you've outlined.

Thanks again.

from prometheus-net.

Related Issues (20)

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.