-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(opentelemetry): integrate with open telemetry
- Loading branch information
bogdan.vidrean
committed
Nov 1, 2024
1 parent
631e3ba
commit b49a2ff
Showing
9 changed files
with
403 additions
and
40 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
receivers: | ||
otlp: | ||
protocols: | ||
grpc: | ||
endpoint: 0.0.0.0:4317 | ||
processors: | ||
extensions: | ||
health_check: | ||
endpoint: "0.0.0.0:13133" | ||
exporters: | ||
otlp: | ||
endpoint: jaeger:4317 | ||
tls: | ||
insecure: true | ||
prometheus: | ||
endpoint: "0.0.0.0:9090" | ||
service: | ||
extensions: [health_check] | ||
pipelines: | ||
traces: | ||
receivers: [otlp] | ||
processors: [] | ||
exporters: [otlp] | ||
metrics: | ||
receivers: [otlp] | ||
exporters: [prometheus] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// (c) Copyright 2019-2024 OLX | ||
|
||
use std::time::Duration; | ||
|
||
use opentelemetry::{global, KeyValue}; | ||
use opentelemetry_otlp::WithExportConfig; | ||
use opentelemetry_sdk::trace::{Config, RandomIdGenerator, Sampler}; | ||
use opentelemetry_sdk::Resource; | ||
|
||
pub fn init_tracer() { | ||
let tracer_provider = opentelemetry_otlp::new_pipeline() | ||
.tracing() | ||
.with_exporter( | ||
opentelemetry_otlp::new_exporter() | ||
.tonic() | ||
.with_protocol(opentelemetry_otlp::Protocol::Grpc) | ||
.with_endpoint("http://localhost:4317") | ||
.with_timeout(Duration::from_secs(3)), | ||
) | ||
.with_trace_config( | ||
Config::default() | ||
.with_sampler(Sampler::AlwaysOn) | ||
.with_id_generator(RandomIdGenerator::default()) | ||
.with_max_events_per_span(64) | ||
.with_max_attributes_per_span(16) | ||
.with_resource(Resource::new(vec![KeyValue::new("service.name", "dali")])), | ||
) | ||
.install_batch(opentelemetry_sdk::runtime::Tokio); | ||
|
||
if tracer_provider.is_err() { | ||
panic!("open telemetry couldn't be initiated. received error"); | ||
} | ||
global::set_tracer_provider(tracer_provider.unwrap()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters