Skip to content

Commit

Permalink
remove sdk re-export from opentelemetry crate
Browse files Browse the repository at this point in the history
- rt-tokio,rt-tokio-current-thread,rt-async-std are no longer features
  of opentelemetry crate, only the sdk crate
- fix feature list for opentelemetry crate in lint script
  • Loading branch information
shaun-cox committed Aug 10, 2023
1 parent e4b866f commit e025ab0
Show file tree
Hide file tree
Showing 12 changed files with 50 additions and 64 deletions.
1 change: 1 addition & 0 deletions examples/traceresponse/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ doc = false
hyper = { version = "0.14", features = ["full"] }
tokio = { version = "1.0", features = ["full"] }
opentelemetry = { path = "../../opentelemetry" }
opentelemetry_sdk = { path = "../../opentelemetry-sdk" }
opentelemetry-http = { path = "../../opentelemetry-http" }
opentelemetry-contrib = { path = "../../opentelemetry-contrib" }
opentelemetry-stdout = { path = "../../opentelemetry-stdout", features = ["trace"] }
10 changes: 4 additions & 6 deletions examples/traceresponse/src/client.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
use hyper::http::HeaderValue;
use hyper::{body::Body, Client};
use opentelemetry::global;
use opentelemetry::propagation::TextMapPropagator;
use opentelemetry::sdk::propagation::TraceContextPropagator;
use opentelemetry::sdk::trace::TracerProvider;
use opentelemetry::trace::SpanKind;
use opentelemetry::{
trace::{TraceContextExt, Tracer},
global,
propagation::TextMapPropagator,
trace::{SpanKind, TraceContextExt, Tracer},
Context, KeyValue,
};
use opentelemetry_contrib::trace::propagator::trace_context_response::TraceContextResponsePropagator;
use opentelemetry_http::{HeaderExtractor, HeaderInjector};
use opentelemetry_sdk::{propagation::TraceContextPropagator, trace::TracerProvider};
use opentelemetry_stdout::SpanExporter;

fn init_tracer() {
Expand Down
18 changes: 11 additions & 7 deletions examples/traceresponse/src/server.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
use hyper::service::{make_service_fn, service_fn};
use hyper::{Body, Request, Response, Server};
use opentelemetry::propagation::TextMapPropagator;
use opentelemetry::sdk::trace::TracerProvider;
use opentelemetry::trace::{SpanKind, TraceContextExt};
use opentelemetry::Context;
use opentelemetry::{global, sdk::propagation::TraceContextPropagator, trace::Tracer};
use hyper::{
service::{make_service_fn, service_fn},
Body, Request, Response, Server,
};
use opentelemetry::{
global,
propagation::TextMapPropagator,
trace::{SpanKind, TraceContextExt, Tracer},
Context,
};
use opentelemetry_contrib::trace::propagator::trace_context_response::TraceContextResponsePropagator;
use opentelemetry_http::{HeaderExtractor, HeaderInjector};
use opentelemetry_sdk::{propagation::TraceContextPropagator, trace::TracerProvider};
use opentelemetry_stdout::SpanExporter;
use std::{convert::Infallible, net::SocketAddr};

Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-dynatrace/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ surf-client = ["surf", "opentelemetry-http/surf"]
isahc-client = ["isahc", "opentelemetry-http/isahc"]

rt-tokio = ["tokio", "opentelemetry/rt-tokio"]
rt-async-std = ["async-std", "opentelemetry/rt-async-std"]
rt-async-std = ["async-std"]

wasm = [
"base64",
Expand Down
3 changes: 2 additions & 1 deletion opentelemetry-jaeger/examples/actix-udp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ publish = false
[dependencies]
opentelemetry = { path = "../../../opentelemetry" }
opentelemetry-jaeger = { path = "../.." }
opentelemetry_sdk = { path = "../../../opentelemetry-sdk" }
actix-web = "4.1"
actix-service = "2"
env_logger = "0.9"
env_logger = "0.10.0"
22 changes: 10 additions & 12 deletions opentelemetry-jaeger/examples/actix-udp/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
use actix_service::Service;
use actix_web::middleware::Logger;
use actix_web::{web, App, HttpServer};
use opentelemetry::trace::TraceError;
use opentelemetry::{global, sdk::trace as sdktrace};
use opentelemetry::{
trace::{FutureExt, TraceContextExt, Tracer},
Key,
global,
trace::{FutureExt, TraceContextExt, TraceError, Tracer},
Key, KeyValue,
};
use opentelemetry_sdk::{trace::config, Resource};

fn init_tracer() -> Result<sdktrace::Tracer, TraceError> {
fn init_tracer() -> Result<opentelemetry_sdk::trace::Tracer, TraceError> {
opentelemetry_jaeger::new_agent_pipeline()
.with_endpoint("localhost:6831")
.with_service_name("trace-udp-demo")
.with_trace_config(opentelemetry::sdk::trace::config().with_resource(
opentelemetry::sdk::Resource::new(vec![
opentelemetry::KeyValue::new("service.name", "my-service"), // this will not override the trace-udp-demo
opentelemetry::KeyValue::new("service.namespace", "my-namespace"),
opentelemetry::KeyValue::new("exporter", "jaeger"),
]),
))
.with_trace_config(config().with_resource(Resource::new(vec![
KeyValue::new("service.name", "my-service"), // this will not override the trace-udp-demo
KeyValue::new("service.namespace", "my-namespace"),
KeyValue::new("exporter", "jaeger"),
])))
.install_simple()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ publish = false

[dependencies]
async-std = { version = "= 1.10.0", features = ["attributes"] }
env_logger = "0.9.0"
opentelemetry = { path = "../../../opentelemetry", features = ["rt-async-std"] }
env_logger = "0.10.0"
opentelemetry = { path = "../../../opentelemetry" }
opentelemetry_sdk = { path = "../../../opentelemetry-sdk", features = ["rt-async-std"] }
opentelemetry-otlp = { path = "../../../opentelemetry-otlp", features = [
"grpc-sys",
"trace",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,24 @@
//! ```
use opentelemetry::{
global::{shutdown_tracer_provider, tracer},
sdk::trace as sdktrace,
trace::TraceError,
trace::{TraceContextExt, Tracer},
Key,
};
use opentelemetry_otlp::WithExportConfig;
use url::Url;

use std::{
collections::HashMap,
env::{remove_var, set_var, var, vars},
error::Error,
};
use url::Url;

// Use the variables to try and export the example to any external collector that accepts otlp
// like: oltp itself, honeycomb or lightstep
const ENDPOINT: &str = "OTLP_GRPCIO_ENDPOINT";
const HEADER_PREFIX: &str = "OTLP_GRPCIO_";

fn init_tracer() -> Result<sdktrace::Tracer, TraceError> {
fn init_tracer() -> Result<opentelemetry_sdk::trace::Tracer, TraceError> {
let endpoint = var(ENDPOINT).unwrap_or_else(|_| {
panic!(
"You must specify and endpoint to connect to with the variable {:?}.",
Expand Down Expand Up @@ -65,7 +63,7 @@ fn init_tracer() -> Result<sdktrace::Tracer, TraceError> {
.with_headers(headers)
.with_tls(true),
)
.install_batch(opentelemetry::runtime::AsyncStd)
.install_batch(opentelemetry_sdk::runtime::AsyncStd)
}

const LEMONS_KEY: Key = Key::from_static_str("ex.com/lemons");
Expand Down
8 changes: 8 additions & 0 deletions opentelemetry/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## [v0.21.0](https://github.com/open-telemetry/opentelemetry-rust/compare/v0.20.0...v0.21.0)
This release should been seen as 1.0-rc4 following 1.0-rc3 in v0.20.0. Refer to CHANGELOG.md in individual creates for details on changes made in different creates.

### Changed

- `opentelemetry` crate now only carries the API types #1186

## [v0.19.0](https://github.com/open-telemetry/opentelemetry-rust/compare/v0.18.0...v0.19.0)
## [v0.20.0](https://github.com/open-telemetry/opentelemetry-rust/compare/v0.19.0...v0.20.0)
This release should been seen as 1.0-rc3 following 1.0-rc2 in v0.19.0. Refer to CHANGELOG.md in individual creates for details on changes made in different creates.

Expand Down
14 changes: 5 additions & 9 deletions opentelemetry/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "opentelemetry"
version = "0.20.0"
version = "0.21.0"
description = "A metrics collection and distributed tracing framework"
homepage = "https://github.com/open-telemetry/opentelemetry-rust"
repository = "https://github.com/open-telemetry/opentelemetry-rust"
Expand All @@ -22,18 +22,14 @@ rustdoc-args = ["--cfg", "docsrs"]

[dependencies]
opentelemetry_api = { version = "0.20", path = "../opentelemetry-api" }
opentelemetry_sdk = { version = "0.20", path = "../opentelemetry-sdk" }

[dev-dependencies]
opentelemetry-stdout = { version = "0.1", path = "../opentelemetry-stdout", features = ["trace"] }

[features]
default = ["trace"]
trace = ["opentelemetry_api/trace", "opentelemetry_sdk/trace"]
metrics = ["opentelemetry_api/metrics", "opentelemetry_sdk/metrics"]
logs = ["opentelemetry_sdk/logs"]
trace = ["opentelemetry_api/trace"]
metrics = ["opentelemetry_api/metrics"]
logs = ["opentelemetry_api/logs"]
logs_level_enabled = ["logs"]
testing = ["opentelemetry_api/testing", "opentelemetry_sdk/testing"]
rt-tokio = ["opentelemetry_sdk/rt-tokio"]
rt-tokio-current-thread = ["opentelemetry_sdk/rt-tokio-current-thread"]
rt-async-std = ["opentelemetry_sdk/rt-async-std"]
testing = ["opentelemetry_api/testing"]
21 changes: 1 addition & 20 deletions opentelemetry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
//! # {
//! use opentelemetry::{
//! global,
//! sdk::trace::TracerProvider,
//! trace::{Tracer, TracerProvider as _},
//! };
//! use opentelemetry_sdk::trace::TracerProvider;
//!
//! fn main() {
//! // Create a new trace pipeline that prints to stdout
Expand Down Expand Up @@ -228,22 +228,3 @@
#![cfg_attr(test, deny(warnings))]

pub use opentelemetry_api::*;
pub use opentelemetry_sdk::runtime;

#[doc(hidden)]
#[cfg(feature = "testing")]
pub mod testing {
pub use opentelemetry_sdk::testing::*;
}

/// # OpenTelemetry SDK
///
/// This SDK provides an opinionated reference implementation of
/// the OpenTelemetry API. The SDK implements the specifics of
/// deciding which data to collect through `Sampler`s, and
/// facilitates the delivery of telemetry data to storage systems
/// through `Exporter`s. These can be configured on `Tracer` and
/// `Meter` creation.
pub mod sdk {
pub use opentelemetry_sdk::*;
}
2 changes: 1 addition & 1 deletion scripts/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if rustup component add clippy; then
`# Exit with a nonzero code if there are clippy warnings` \
-Dwarnings

cargo_feature opentelemetry "trace,rt-tokio,rt-tokio-current-thread,rt-async-std,testing"
cargo_feature opentelemetry "trace,metrics,logs,logs_level_enabled,testing"

cargo_feature opentelemetry-otlp "default"
cargo_feature opentelemetry-otlp "default,tls"
Expand Down

0 comments on commit e025ab0

Please sign in to comment.