revert copy traces to stdout (38fd62f) (#345)

V3_GIT_ORIGIN_REV_ID: c9ee70e9201026378a96d1205a2a566c211230d1
This commit is contained in:
paritosh-08 2024-03-13 15:01:14 +05:30 committed by hasura-bot
parent c50ad27037
commit b44711aaa5
4 changed files with 42 additions and 105 deletions

98
v3/Cargo.lock generated
View File

@ -1008,8 +1008,8 @@ dependencies = [
"nonempty",
"open-dds",
"opendds-derive",
"opentelemetry 0.21.0",
"opentelemetry_sdk 0.21.2",
"opentelemetry",
"opentelemetry_sdk",
"regex",
"reqwest",
"schemars",
@ -1956,7 +1956,7 @@ source = "git+https://github.com/hasura/ndc-spec.git?tag=v0.1.0#8892f0524affd37e
dependencies = [
"async-trait",
"indexmap 2.1.0",
"opentelemetry 0.20.0",
"opentelemetry",
"reqwest",
"schemars",
"serde",
@ -2136,38 +2136,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9591d937bc0e6d2feb6f71a559540ab300ea49955229c347a517a28d27784c54"
dependencies = [
"opentelemetry_api",
"opentelemetry_sdk 0.20.0",
]
[[package]]
name = "opentelemetry"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e32339a5dc40459130b3bd269e9892439f55b33e772d2a9d402a789baaf4e8a"
dependencies = [
"futures-core",
"futures-sink",
"indexmap 2.1.0",
"js-sys",
"once_cell",
"pin-project-lite",
"thiserror",
"urlencoding",
"opentelemetry_sdk",
]
[[package]]
name = "opentelemetry-otlp"
version = "0.14.0"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f24cda83b20ed2433c68241f918d0f6fdec8b1d43b7a9590ab4420c5095ca930"
checksum = "7e5e5a5c4135864099f3faafbe939eb4d7f9b80ebf68a8448da961b32a7c1275"
dependencies = [
"async-trait",
"futures-core",
"http",
"opentelemetry 0.21.0",
"opentelemetry-proto",
"opentelemetry-semantic-conventions",
"opentelemetry_sdk 0.21.2",
"opentelemetry_api",
"opentelemetry_sdk",
"prost",
"thiserror",
"tokio",
@ -2176,38 +2160,23 @@ dependencies = [
[[package]]
name = "opentelemetry-proto"
version = "0.4.0"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2e155ce5cc812ea3d1dffbd1539aed653de4bf4882d60e6e04dcf0901d674e1"
checksum = "b1e3f814aa9f8c905d0ee4bde026afd3b2577a97c10e1699912e3e44f0c4cbeb"
dependencies = [
"opentelemetry 0.21.0",
"opentelemetry_sdk 0.21.2",
"opentelemetry_api",
"opentelemetry_sdk",
"prost",
"tonic",
]
[[package]]
name = "opentelemetry-semantic-conventions"
version = "0.13.0"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f5774f1ef1f982ef2a447f6ee04ec383981a3ab99c8e77a1a7b30182e65bbc84"
checksum = "73c9f9340ad135068800e7f1b24e9e09ed9e7143f5bf8518ded3d3ec69789269"
dependencies = [
"opentelemetry 0.21.0",
]
[[package]]
name = "opentelemetry-stdout"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c13b2df4cd59c176099ac82806725ba340c8fa7b1a7004c0912daad30470f63e"
dependencies = [
"chrono",
"futures-util",
"opentelemetry 0.21.0",
"opentelemetry_sdk 0.21.2",
"ordered-float 4.2.0",
"serde",
"serde_json",
"opentelemetry",
]
[[package]]
@ -2239,28 +2208,11 @@ dependencies = [
"futures-util",
"once_cell",
"opentelemetry_api",
"ordered-float 3.9.2",
"percent-encoding 2.3.1",
"rand",
"thiserror",
]
[[package]]
name = "opentelemetry_sdk"
version = "0.21.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2f16aec8a98a457a52664d69e0091bac3a0abd18ead9b641cb00202ba4e0efe4"
dependencies = [
"async-trait",
"crossbeam-channel",
"futures-channel",
"futures-executor",
"futures-util",
"once_cell",
"opentelemetry 0.21.0",
"ordered-float 4.2.0",
"ordered-float",
"percent-encoding 2.3.1",
"rand",
"regex",
"serde_json",
"thiserror",
"tokio",
"tokio-stream",
@ -2275,15 +2227,6 @@ dependencies = [
"num-traits",
]
[[package]]
name = "ordered-float"
version = "4.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a76df7075c7d4d01fdcb46c912dd17fba5b60c78ea480b475f2b6ab6f666584e"
dependencies = [
"num-traits",
]
[[package]]
name = "os_str_bytes"
version = "6.6.1"
@ -3562,11 +3505,10 @@ dependencies = [
"axum",
"derive_more",
"http",
"opentelemetry 0.21.0",
"opentelemetry",
"opentelemetry-otlp",
"opentelemetry-semantic-conventions",
"opentelemetry-stdout",
"opentelemetry_sdk 0.21.2",
"opentelemetry_sdk",
"strum",
]

View File

@ -25,8 +25,8 @@ opendds-derive = { path = "../opendds-derive" }
serde = "1.0.152"
serde_json = "1.0.92"
reqwest = { version = "^0.11", features = ["json", "multipart"] }
opentelemetry = "0.21.0"
opentelemetry_sdk = "0.21.2"
opentelemetry = "0.20.0"
opentelemetry_sdk = "0.20.0"
schemars = { version = "0.8.12", features = ["smol_str"] }
async-trait = "0.1.67"
derive_more = "0.99.17"

View File

@ -8,11 +8,10 @@ license.workspace = true
[dependencies]
derive_more = "0.99.17"
opentelemetry = "0.21.0"
opentelemetry-otlp = "0.14.0"
opentelemetry_sdk = { version = "0.21.2", features = ["rt-tokio"] }
opentelemetry-semantic-conventions = "0.13.0"
opentelemetry-stdout = { version = "0.2.0", features = ["trace"] }
opentelemetry = { version = "0.20.0", features = ["rt-tokio"] }
opentelemetry-otlp = "0.13.0"
opentelemetry_sdk = "0.20.0"
opentelemetry-semantic-conventions = "0.12.0"
strum = "0.25.0"
http = "0.2.9"

View File

@ -1,7 +1,11 @@
use crate::tracer::Tracer;
use opentelemetry::{global, trace::TraceError, KeyValue};
use opentelemetry::{
global::{self, BoxedTracer},
trace::TraceError,
KeyValue,
};
use opentelemetry_otlp::{WithExportConfig, OTEL_EXPORTER_OTLP_ENDPOINT_DEFAULT};
use opentelemetry_sdk::{propagation::TraceContextPropagator, trace::TracerProvider};
use opentelemetry_sdk::propagation::TraceContextPropagator;
use opentelemetry_semantic_conventions as semcov;
pub fn start_tracer(
@ -10,29 +14,21 @@ pub fn start_tracer(
service_version: String,
) -> Result<Tracer, TraceError> {
global::set_text_map_propagator(TraceContextPropagator::new());
let otlp_exporter = opentelemetry_otlp::SpanExporterBuilder::Tonic(
opentelemetry_otlp::new_exporter()
.tonic()
.with_endpoint(endpoint.unwrap_or(OTEL_EXPORTER_OTLP_ENDPOINT_DEFAULT.into())),
)
.build_span_exporter()?;
let stdout_exporter = opentelemetry_stdout::SpanExporter::default();
let tracer_provider = TracerProvider::builder()
.with_batch_exporter(otlp_exporter, opentelemetry_sdk::runtime::Tokio)
.with_simple_exporter(stdout_exporter) // simple exporter outputs one event per line
.with_config(opentelemetry_sdk::trace::config().with_resource(
let tracer = opentelemetry_otlp::new_pipeline()
.tracing()
.with_exporter(
opentelemetry_otlp::new_exporter()
.tonic()
.with_endpoint(endpoint.unwrap_or(OTEL_EXPORTER_OTLP_ENDPOINT_DEFAULT.into())),
)
.with_trace_config(opentelemetry::sdk::trace::config().with_resource(
opentelemetry_sdk::Resource::new(vec![
KeyValue::new(semcov::resource::SERVICE_NAME, service_name),
KeyValue::new(semcov::resource::SERVICE_VERSION, service_version),
]),
))
.build();
global::set_tracer_provider(tracer_provider);
Ok(crate::tracer::global_tracer())
.install_batch(opentelemetry::runtime::Tokio)?;
Ok(Tracer::new(BoxedTracer::new(Box::new(tracer))))
}
pub fn shutdown_tracer() {