Move imports to the top of the file

Since commit de85e7fa, prometheus is a required dependency for Ursula.
So conditional imports of prometheus are no longer necessary.
pull/3405/head
Manuel Montenegro 2023-11-06 09:25:04 +01:00 committed by KPrasch
parent 13948b2625
commit e6c5293779
1 changed files with 2 additions and 4 deletions

View File

@ -1,13 +1,14 @@
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.twisted import MetricsResource
from prometheus_client.utils import floatToGoString
from twisted.internet import reactor, task
from twisted.web.resource import Resource
from twisted.web.server import Site
from nucypher.characters import lawful
from nucypher.utilities.prometheus.collector import (
@ -117,9 +118,6 @@ def start_prometheus_exporter(
registry: CollectorRegistry = REGISTRY,
) -> None:
"""Configure, collect, and serve prometheus metrics."""
from prometheus_client.twisted import MetricsResource
from twisted.web.resource import Resource
from twisted.web.server import Site
# Disabling default collector metrics
REGISTRY.unregister(GC_COLLECTOR)