Skip to content

the trait bound PrometheusRecorder: Recorder is not satisfied #557

Open
@berwani

Description

@berwani

Somehow, the set_global_recorder call inside the PrometheusBuilder.install() is not working for me, so I am trying to get the recorder via the PrometheusBuilder.build() and trying to set the global recorder myself. But I get the error stating that the PrometheusRecorder doesn't implement Recorder trait. Code I use and the error below:

    let (recorder, exporter): (PrometheusRecorder, ExporterFuture) = PrometheusBuilder::new()
        .build()
        .unwrap();
    metrics::set_global_recorder(recorder).unwrap();
error[E0277]: the trait bound `PrometheusRecorder: Recorder` is not satisfied
   --> enforcer/main.rs:131:34
    |
131 |     metrics::set_global_recorder(recorder).unwrap();
    |     ---------------------------- ^^^^^^^^ the trait `Recorder` is not implemented for `PrometheusRecorder`
    |     |
    |     required by a bound introduced by this call
  

May be the Recorder impl for PrometheusRecorder should be pub or part of a module that users can import?

I also have the following imports:

use metrics_exporter_prometheus::{ExporterFuture, PrometheusBuilder, PrometheusRecorder};
use metrics::Recorder;

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-coreComponent: core functionality such as traits, etc.C-exporterComponent: exporters such as Prometheus, TCP, etc.S-needs-reproStatus: awaiting a reproduction to continue investgation.T-ergonomicsType: ergonomics.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions