grafana / alloy

OpenTelemetry Collector distribution with programmable pipelines
https://grafana.com/oss/alloy
Apache License 2.0
1.37k stars 201 forks source link

Lower default active series in agent integration #556

Open rfratto opened 4 years ago

rfratto commented 4 years ago

The agent integration exposes ~700 active series out of the box, most of which may not be useful for just scraping agent metrics.

Some extra options should be provided to narrow down the default set of collected metrics to as small as possible.

rfratto commented 4 years ago

Looking at the list of exported metrics, there's quite a few ones that aren't used with the default configs:

The go instrumentation can also be disabled fairly easily.

The fix for this ideally should:

  1. Provide flags for disabling instrumentation (like with the go and Weaveworks server instrumentation)
  2. Remove series from being registered if they are not used (like with the etcd metrics)
  3. Filter out the remaining set of metrics that are still unwanted

grafana/agent#2 will take a lot of work coordinating upstream PRs, so I'm going to opt for just adding a filtering mechanism for now. The filtering mechanism will wrap a Gatherer and determine whether a series should be removed. The list of unwanted metrics will be defined either:

  1. "intelligently" by not collecting metrics for Agent components that are unused, like the etcd metrics
  2. By flag, where the user specifies they don't want Prometheus metrics.

As all integrations are embedded, this filtering mechanism can be eventually applied on top of existing exporters.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had any activity in the past 30 days. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

rfratto commented 2 years ago

There's still a lot of metrics registered by default that we probably don't need. I introduced a TODO comment in grafana/agent#2388 to stop using prometheus.DefaultRegisterer for all of our metrics so we have more control over what gets exposed.

There's probably some metrics registered there that we want to keep, so it's not a simple switch - we'll have to go through the metrics individually and identify what we want to keep and ensure we work with the relevant upstream projects to have those metrics be exposable another way.