Disable default collector metrics

By default, prometheus exports 'process', 'gc' and 'platform' collector
metrics. This information is not useful in our case and introduces some
noise to the metrics, so they have been disabled.
pull/3405/head
Manuel Montenegro 2023-09-01 12:56:36 +02:00 committed by KPrasch
parent 11f973a97a
commit 7f70c9a086
2 changed files with 6 additions and 0 deletions

View File

View File

@ -2,6 +2,7 @@
import json
from typing import List
from prometheus_client import GC_COLLECTOR, PLATFORM_COLLECTOR, PROCESS_COLLECTOR
from prometheus_client.core import Timestamp
from prometheus_client.registry import REGISTRY, CollectorRegistry
from prometheus_client.utils import floatToGoString
@ -119,6 +120,11 @@ def start_prometheus_exporter(
from twisted.web.resource import Resource
from twisted.web.server import Site
# Disabling default collector metrics
REGISTRY.unregister(GC_COLLECTOR)
REGISTRY.unregister(PLATFORM_COLLECTOR)
REGISTRY.unregister(PROCESS_COLLECTOR)
metrics_collectors = create_metrics_collectors(ursula)
# initialize collectors
for collector in metrics_collectors: