File tree 2 files changed +10
-6
lines changed
2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ services:
6
6
- " 16686:16686"
7
7
- " 4318:4317"
8
8
otel-collector :
9
- image : otel/opentelemetry-collector:0.98 .0
9
+ image : otel/opentelemetry-collector:0.103 .0
10
10
volumes :
11
11
- ./otel-collector-minimal-config.yml:/etc/otel-collector-config.yml
12
12
ports :
Original file line number Diff line number Diff line change 1
- use opentelemetry:: { metrics, KeyValue } ;
1
+ use anyhow:: Result ;
2
+ use opentelemetry:: { global, KeyValue } ;
2
3
use opentelemetry_otlp:: { ExportConfig , WithExportConfig } ;
3
- use opentelemetry_sdk:: metrics:: SdkMeterProvider ;
4
4
use opentelemetry_sdk:: runtime;
5
5
6
6
mod policy_evaluations_total;
@@ -10,15 +10,19 @@ pub use policy_evaluations_latency::record_policy_latency;
10
10
11
11
const METER_NAME : & str = "kubewarden" ;
12
12
13
- pub fn setup_metrics ( ) -> metrics :: Result < SdkMeterProvider > {
14
- opentelemetry_otlp:: new_pipeline ( )
13
+ pub fn setup_metrics ( ) -> Result < ( ) > {
14
+ let meter_provider = opentelemetry_otlp:: new_pipeline ( )
15
15
. metrics ( runtime:: Tokio )
16
16
. with_exporter (
17
17
opentelemetry_otlp:: new_exporter ( )
18
18
. tonic ( )
19
19
. with_export_config ( ExportConfig :: default ( ) ) ,
20
20
)
21
- . build ( )
21
+ . build ( ) ?;
22
+
23
+ global:: set_meter_provider ( meter_provider. clone ( ) ) ;
24
+
25
+ Ok ( ( ) )
22
26
}
23
27
24
28
pub trait PolicyEvaluationMetric : Into < Vec < KeyValue > > { }
You can’t perform that action at this time.
0 commit comments