Skip to content

Getting prometheusFactoryNotBootstrapped #48

@LukasCZ

Description

@LukasCZ

I am trying to use this in my Vapor 4 app. I have followed the Readme and I'm bootstrapping PrometheusClient in the main configure(_ app: Application) method, like this:

let myPrometheus = PrometheusClient()
MetricsSystem.bootstrap(PrometheusMetricsFactory(client: myPrometheus))

And for the /metrics route, I am using the basic implementation too:

app.get("metrics") { request -> EventLoopFuture<String> in
        let promise = request.eventLoop.makePromise(of: String.self)
        DispatchQueue.global().async {
            do {
                try MetricsSystem.prometheus().collect(into: promise)
            } catch {
                promise.fail(error)
            }
        }
        return promise.futureResult
    }

But when I try accessing /metrics in the web browser, I get the following error:

[ WARNING ] prometheusFactoryNotBootstrapped(bootstrappedWith: "PrometheusMetricsFactory(client: Prometheus.PrometheusClient, configuration: Prometheus.PrometheusMetricsFactory.Configuration(labelSanitizer: Prometheus.PrometheusLabelSanitizer(allowedCharacters: "abcdefghijklmnopqrstuvwxyz0123456789_:"), timerImplementation: Prometheus.PrometheusMetricsFactory.TimerImplementation(_wrapped: Prometheus.PrometheusMetricsFactory.TimerImplementation._Wrapped.summary(defaultQuantiles: [0.01, 0.05, 0.5, 0.9, 0.95, 0.99, 0.999])), defaultRecorderBuckets: Prometheus.Buckets(buckets: [0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1.0, 2.5, 5.0, 10.0, 1.7976931348623157e+308])))") [request-id: 1704CFC1-E848-41E3-992A-7DB5CA7B1C0F]

Any help with this would be much appreciated 🙏. And thank you for creating this package!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions