Skip to content

Commit

Permalink
Merge branch 'main' into otel-json
Browse files Browse the repository at this point in the history
  • Loading branch information
lalitb committed Apr 16, 2024
2 parents 67d6875 + 2286378 commit 680b191
Show file tree
Hide file tree
Showing 24 changed files with 24 additions and 102 deletions.
29 changes: 9 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
components: rustfmt
profile: minimal
- name: "Set rustup profile"
run: rustup set profile minimal
- uses: arduino/setup-protoc@v3
- name: Test
run: ./scripts/test.sh
Expand All @@ -38,11 +39,9 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: rustfmt
profile: minimal
- uses: arduino/setup-protoc@v3
- uses: actions-rs/cargo@v1
with:
Expand All @@ -57,11 +56,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly-2024-02-07
components: rustfmt
override: true
- name: external-type-check
run: |
cargo install cargo-check-external-types
Expand All @@ -76,11 +74,9 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: rustfmt
profile: minimal
- uses: arduino/setup-protoc@v3
- name: Build
run: |
Expand All @@ -92,11 +88,7 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.65.0
override: true
- uses: dtolnay/rust-toolchain@1.65.0
- name: Patch dependencies versions # some dependencies bump MSRV without major version bump
run: ./scripts/patch_dependencies.sh
- name: Run tests
Expand All @@ -117,11 +109,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly
components: rustfmt
override: true
- uses: arduino/setup-protoc@v3
- name: doc
run: cargo doc --no-deps --all-features
Expand All @@ -136,11 +126,10 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: rustfmt,llvm-tools-preview
override: true
- uses: arduino/setup-protoc@v3
- name: cargo install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: rustfmt
profile: minimal
- uses: arduino/setup-protoc@v3
- name: Run integration tests using docker compose
run: ./scripts/integration_tests.sh
1 change: 0 additions & 1 deletion opentelemetry-http/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ pub trait HttpClient: Debug + Send + Sync {
#[cfg(feature = "reqwest")]
mod reqwest {
use super::{async_trait, Bytes, HttpClient, HttpError, Request, Response};
use std::convert::TryInto;

#[async_trait]
impl HttpClient for reqwest::Client {
Expand Down
7 changes: 1 addition & 6 deletions opentelemetry-jaeger-propagator/src/propagator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,7 @@ impl TextMapPropagator for Propagator {
#[cfg(test)]
mod tests {
use super::*;
use opentelemetry::{
propagation::{Injector, TextMapPropagator},
testing::trace::TestSpan,
trace::{SpanContext, SpanId, TraceContextExt, TraceFlags, TraceId, TraceState},
Context,
};
use opentelemetry::testing::trace::TestSpan;
use std::collections::HashMap;

const LONG_TRACE_ID_STR: &str = "000000000000004d0000000000000016";
Expand Down
5 changes: 1 addition & 4 deletions opentelemetry-jaeger/src/exporter/config/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@ use std::sync::Arc;
use std::{env, net};

use opentelemetry::trace::TraceError;
use opentelemetry_sdk::trace::{BatchConfig, Config, TracerProvider};
use opentelemetry_sdk::trace::{BatchSpanProcessor, Tracer};
use opentelemetry_sdk::{
self,
trace::{BatchConfig, Config, TracerProvider},
};

use crate::exporter::agent::{AgentAsyncClientUdp, AgentSyncClientUdp};
use crate::exporter::config::{
Expand Down
1 change: 0 additions & 1 deletion opentelemetry-jaeger/src/exporter/config/collector/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::borrow::BorrowMut;
use std::convert::TryFrom;
use std::env;
use std::sync::Arc;
#[cfg(feature = "collector_client")]
Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-otlp/src/logs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use opentelemetry::{
global,
logs::{LogError, LoggerProvider},
};
use opentelemetry_sdk::{self, export::logs::LogData, runtime::RuntimeChannel};
use opentelemetry_sdk::{export::logs::LogData, runtime::RuntimeChannel};

/// Compression algorithm to use, defaults to none.
pub const OTEL_EXPORTER_OTLP_LOGS_COMPRESSION: &str = "OTEL_EXPORTER_OTLP_LOGS_COMPRESSION";
Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-sdk/src/logs/log_emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ mod tests {
use opentelemetry::global::{logger, set_logger_provider, shutdown_logger_provider};
use opentelemetry::logs::Logger;
use opentelemetry::{Key, KeyValue, Value};
use std::sync::{Arc, Mutex};
use std::sync::Mutex;
use std::thread;

#[test]
Expand Down
1 change: 0 additions & 1 deletion opentelemetry-sdk/src/metrics/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ pub fn new_view(criteria: Instrument, mask: Stream) -> Result<Box<dyn View>> {
#[cfg(test)]
mod tests {
use super::*;
use crate::metrics::Instrument;
#[test]
fn test_new_view_matching_all() {
let criteria = Instrument::new().name("*");
Expand Down
4 changes: 1 addition & 3 deletions opentelemetry-sdk/src/propagation/baggage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,7 @@ impl TextMapPropagator for BaggagePropagator {
#[cfg(test)]
mod tests {
use super::*;
use opentelemetry::{
baggage::BaggageMetadata, propagation::TextMapPropagator, Key, KeyValue, StringValue, Value,
};
use opentelemetry::{baggage::BaggageMetadata, Key, KeyValue, StringValue, Value};
use std::collections::HashMap;

#[rustfmt::skip]
Expand Down
5 changes: 0 additions & 5 deletions opentelemetry-sdk/src/propagation/trace_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,7 @@ impl TextMapPropagator for TraceContextPropagator {
mod tests {
use super::*;
use crate::testing::trace::TestSpan;
use opentelemetry::{
propagation::{Extractor, Injector, TextMapPropagator},
trace::{SpanContext, SpanId, TraceId},
};
use std::collections::HashMap;
use std::str::FromStr;

#[rustfmt::skip]
fn extract_data() -> Vec<(&'static str, &'static str, SpanContext)> {
Expand Down
2 changes: 0 additions & 2 deletions opentelemetry-sdk/src/resource/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,6 @@ pub trait ResourceDetector {
#[cfg(test)]
mod tests {
use super::*;
use crate::resource::EnvResourceDetector;
use std::collections::HashMap;
use std::time;

#[test]
Expand Down
4 changes: 1 addition & 3 deletions opentelemetry-sdk/src/trace/sampler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use opentelemetry::{
},
Context, KeyValue,
};
use std::convert::TryInto;

#[cfg(feature = "jaeger_remote_sampler")]
mod jaeger_remote;
Expand Down Expand Up @@ -250,8 +249,7 @@ pub(crate) fn sample_based_on_probability(prob: &f64, trace_id: TraceId) -> Samp
mod tests {
use super::*;
use crate::testing::trace::TestSpan;
use crate::trace::{Sampler, ShouldSample};
use opentelemetry::trace::{SamplingDecision, SpanContext, SpanId, TraceFlags, TraceState};
use opentelemetry::trace::{SpanContext, SpanId, TraceFlags};
use rand::Rng;

#[rustfmt::skip]
Expand Down
4 changes: 2 additions & 2 deletions opentelemetry-sdk/src/trace/span.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,8 @@ mod tests {
DEFAULT_MAX_ATTRIBUTES_PER_SPAN, DEFAULT_MAX_EVENT_PER_SPAN, DEFAULT_MAX_LINKS_PER_SPAN,
};
use crate::trace::{SpanEvents, SpanLinks};
use opentelemetry::trace::{self, Link, SpanBuilder, TraceFlags, TraceId, Tracer};
use opentelemetry::{trace::Span as _, trace::TracerProvider, KeyValue};
use opentelemetry::trace::{self, SpanBuilder, TraceFlags, TraceId, Tracer};
use opentelemetry::{trace::Span as _, trace::TracerProvider};
use std::time::Duration;
use std::vec;

Expand Down
6 changes: 1 addition & 5 deletions opentelemetry-zipkin/src/propagator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,7 @@ impl TextMapPropagator for Propagator {
#[cfg(test)]
mod tests {
use super::*;
use opentelemetry::{
propagation::TextMapPropagator,
testing::trace::TestSpan,
trace::{SpanContext, SpanId, TraceFlags, TraceId},
};
use opentelemetry::testing::trace::TestSpan;
use std::collections::HashMap;

const TRACE_ID_STR: &str = "4bf92f3577b34da6a3ce929d0e0e4736";
Expand Down
1 change: 0 additions & 1 deletion opentelemetry/src/baggage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ use crate::{Context, Key, KeyValue, Value};
use once_cell::sync::Lazy;
use std::collections::{hash_map, HashMap};
use std::fmt;
use std::iter::FromIterator;

static DEFAULT_BAGGAGE: Lazy<Baggage> = Lazy::new(Baggage::default);

Expand Down
2 changes: 1 addition & 1 deletion opentelemetry/src/metrics/instruments/counter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use crate::{
KeyValue,
};
use core::fmt;
use std::any::Any;
use std::sync::Arc;
use std::{any::Any, convert::TryFrom};

/// An SDK implemented instrument that records increasing values.
pub trait SyncCounter<T> {
Expand Down
2 changes: 1 addition & 1 deletion opentelemetry/src/metrics/instruments/gauge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use crate::{
KeyValue,
};
use core::fmt;
use std::any::Any;
use std::sync::Arc;
use std::{any::Any, convert::TryFrom};

/// An SDK implemented instrument that records independent values
pub trait SyncGauge<T> {
Expand Down
1 change: 0 additions & 1 deletion opentelemetry/src/metrics/instruments/histogram.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use crate::{
KeyValue,
};
use core::fmt;
use std::convert::TryFrom;
use std::sync::Arc;

/// An SDK implemented instrument that records a distribution of values.
Expand Down
1 change: 0 additions & 1 deletion opentelemetry/src/metrics/instruments/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use crate::KeyValue;
use core::fmt;
use std::any::Any;
use std::borrow::Cow;
use std::convert::TryFrom;
use std::marker;
use std::sync::Arc;

Expand Down
2 changes: 1 addition & 1 deletion opentelemetry/src/metrics/instruments/up_down_counter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use crate::{
KeyValue,
};
use core::fmt;
use std::any::Any;
use std::sync::Arc;
use std::{any::Any, convert::TryFrom};

use super::{AsyncInstrument, AsyncInstrumentBuilder};

Expand Down
1 change: 0 additions & 1 deletion opentelemetry/src/propagation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ impl PropagationError {
#[cfg(test)]
mod tests {
use super::*;
use std::collections::HashMap;

#[test]
fn hash_map_get() {
Expand Down
2 changes: 1 addition & 1 deletion opentelemetry/src/trace/noop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ impl TextMapPropagator for NoopTextMapPropagator {
mod tests {
use super::*;
use crate::testing::trace::TestSpan;
use crate::trace::{self, Span, TraceState, Tracer};
use crate::trace::{Span, TraceState, Tracer};

fn valid_span_context() -> trace::SpanContext {
trace::SpanContext::new(
Expand Down
37 changes: 1 addition & 36 deletions stress/src/logs.rs
Original file line number Diff line number Diff line change
@@ -1,39 +1,10 @@
use opentelemetry_appender_tracing::layer;
use opentelemetry_sdk::logs::{LogProcessor, LoggerProvider};
use tracing::error;
use tracing_subscriber::{prelude::*, Layer};
use tracing_subscriber::prelude::*;

mod throughput;

struct NoopEventVisitor;

impl tracing::field::Visit for NoopEventVisitor {
fn record_debug(&mut self, _field: &tracing::field::Field, _value: &dyn std::fmt::Debug) {}
}

struct NoOpLogLayer;
impl<S> Layer<S> for NoOpLogLayer
where
S: tracing::Subscriber,
{
fn on_event(
&self,
event: &tracing::Event<'_>,
_ctx: tracing_subscriber::layer::Context<'_, S>,
) {
let mut visitor = NoopEventVisitor;
event.record(&mut visitor);
}

fn event_enabled(
&self,
_event: &tracing::Event<'_>,
_ctx: tracing_subscriber::layer::Context<'_, S>,
) -> bool {
true
}
}

#[derive(Debug)]
pub struct NoOpLogProcessor;

Expand Down Expand Up @@ -67,12 +38,6 @@ fn main() {
// Use the OpenTelemetryTracingBridge to test the throughput of the appender-tracing.
let layer = layer::OpenTelemetryTracingBridge::new(&provider);
tracing_subscriber::registry().with(layer).init();

// Use a "Do-Nothing" layer to test the throughput of the tracing system without
// OpenTelemetry overhead. This helps measure the OpenTelemetry overhead.
// let noop_layer = NoOpLogLayer;
// tracing_subscriber::registry().with(noop_layer).init();

throughput::test_throughput(test_log);
}

Expand Down

0 comments on commit 680b191

Please sign in to comment.