Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
lalitb committed Nov 5, 2024
1 parent 16ffb3e commit fa9237b
Show file tree
Hide file tree
Showing 26 changed files with 46 additions and 46 deletions.
4 changes: 2 additions & 2 deletions opentelemetry-appender-tracing/src/layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,12 @@ const fn severity_of_level(level: &Level) -> Severity {
mod tests {
use crate::layer;
use async_trait::async_trait;
use opentelemetry::logs::{LogResult, Severity};
use opentelemetry::logs::Severity;
use opentelemetry::trace::TracerProvider as _;
use opentelemetry::trace::{TraceContextExt, TraceFlags, Tracer};
use opentelemetry::{logs::AnyValue, Key};
use opentelemetry_sdk::export::logs::{LogBatch, LogExporter};
use opentelemetry_sdk::logs::{LogRecord, LoggerProvider};
use opentelemetry_sdk::logs::{LogRecord, LogResult, LoggerProvider};
use opentelemetry_sdk::testing::logs::InMemoryLogExporter;
use opentelemetry_sdk::trace;
use opentelemetry_sdk::trace::{Sampler, TracerProvider};
Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-otlp/src/exporter/http/logs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use std::sync::Arc;

use async_trait::async_trait;
use http::{header::CONTENT_TYPE, Method};
use opentelemetry::logs::{LogError, LogResult};
use opentelemetry_sdk::export::logs::{LogBatch, LogExporter};
use opentelemetry_sdk::logs::{LogError, LogResult};

use super::OtlpHttpClient;

Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-otlp/src/exporter/http/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use std::sync::Arc;

use async_trait::async_trait;
use http::{header::CONTENT_TYPE, Method};
use opentelemetry::metrics::{MetricError, MetricResult};
use opentelemetry_sdk::metrics::data::ResourceMetrics;
use opentelemetry_sdk::metrics::{MetricError, MetricResult};

use crate::{metric::MetricsClient, Error};

Expand Down
14 changes: 8 additions & 6 deletions opentelemetry-otlp/src/exporter/http/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ impl HttpExporterBuilder {

/// Create a log exporter with the current configuration
#[cfg(feature = "logs")]
pub fn build_log_exporter(mut self) -> opentelemetry::logs::LogResult<crate::LogExporter> {
pub fn build_log_exporter(mut self) -> opentelemetry_sdk::logs::LogResult<crate::LogExporter> {
use crate::{
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT, OTEL_EXPORTER_OTLP_LOGS_HEADERS,
OTEL_EXPORTER_OTLP_LOGS_TIMEOUT,
Expand All @@ -244,7 +244,7 @@ impl HttpExporterBuilder {
pub fn build_metrics_exporter(
mut self,
temporality: opentelemetry_sdk::metrics::data::Temporality,
) -> opentelemetry::metrics::MetricResult<crate::MetricExporter> {
) -> opentelemetry_sdk::metrics::MetricResult<crate::MetricExporter> {
use crate::{
OTEL_EXPORTER_OTLP_METRICS_ENDPOINT, OTEL_EXPORTER_OTLP_METRICS_HEADERS,
OTEL_EXPORTER_OTLP_METRICS_TIMEOUT,
Expand Down Expand Up @@ -315,7 +315,7 @@ impl OtlpHttpClient {
fn build_logs_export_body(
&self,
logs: LogBatch<'_>,
) -> opentelemetry::logs::LogResult<(Vec<u8>, &'static str)> {
) -> opentelemetry_sdk::logs::LogResult<(Vec<u8>, &'static str)> {
use opentelemetry_proto::tonic::collector::logs::v1::ExportLogsServiceRequest;
let resource_logs = group_logs_by_resource_and_scope(logs, &self.resource);
let req = ExportLogsServiceRequest { resource_logs };
Expand All @@ -324,7 +324,7 @@ impl OtlpHttpClient {
#[cfg(feature = "http-json")]
Protocol::HttpJson => match serde_json::to_string_pretty(&req) {
Ok(json) => Ok((json.into(), "application/json")),
Err(e) => Err(opentelemetry::logs::LogError::from(e.to_string())),
Err(e) => Err(opentelemetry_sdk::logs::LogError::from(e.to_string())),
},
_ => Ok((req.encode_to_vec(), "application/x-protobuf")),
}
Expand All @@ -334,7 +334,7 @@ impl OtlpHttpClient {
fn build_metrics_export_body(
&self,
metrics: &mut opentelemetry_sdk::metrics::data::ResourceMetrics,
) -> opentelemetry::metrics::MetricResult<(Vec<u8>, &'static str)> {
) -> opentelemetry_sdk::metrics::MetricResult<(Vec<u8>, &'static str)> {
use opentelemetry_proto::tonic::collector::metrics::v1::ExportMetricsServiceRequest;

let req: ExportMetricsServiceRequest = (&*metrics).into();
Expand All @@ -343,7 +343,9 @@ impl OtlpHttpClient {
#[cfg(feature = "http-json")]
Protocol::HttpJson => match serde_json::to_string_pretty(&req) {
Ok(json) => Ok((json.into(), "application/json")),
Err(e) => Err(opentelemetry::metrics::MetricError::Other(e.to_string())),
Err(e) => Err(opentelemetry_sdk::metrics::MetricError::Other(
e.to_string(),
)),
},
_ => Ok((req.encode_to_vec(), "application/x-protobuf")),
}
Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-otlp/src/exporter/tonic/logs.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use async_trait::async_trait;
use core::fmt;
use opentelemetry::logs::{LogError, LogResult};
use opentelemetry_proto::tonic::collector::logs::v1::{
logs_service_client::LogsServiceClient, ExportLogsServiceRequest,
};
use opentelemetry_sdk::export::logs::{LogBatch, LogExporter};
use opentelemetry_sdk::logs::{LogError, LogResult};
use tonic::{codegen::CompressionEncoding, service::Interceptor, transport::Channel, Request};

use opentelemetry_proto::transform::logs::tonic::group_logs_by_resource_and_scope;
Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-otlp/src/exporter/tonic/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ use core::fmt;
use std::sync::Mutex;

use async_trait::async_trait;
use opentelemetry::metrics::{MetricError, MetricResult};
use opentelemetry_proto::tonic::collector::metrics::v1::{
metrics_service_client::MetricsServiceClient, ExportMetricsServiceRequest,
};
use opentelemetry_sdk::metrics::data::ResourceMetrics;
use opentelemetry_sdk::metrics::{MetricError, MetricResult};
use tonic::{codegen::CompressionEncoding, service::Interceptor, transport::Channel, Request};

use super::BoxInterceptor;
Expand Down
4 changes: 2 additions & 2 deletions opentelemetry-otlp/src/exporter/tonic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ impl TonicExporterBuilder {
#[cfg(feature = "logs")]
pub(crate) fn build_log_exporter(
self,
) -> Result<crate::logs::LogExporter, opentelemetry::logs::LogError> {
) -> Result<crate::logs::LogExporter, opentelemetry_sdk::logs::LogError> {
use crate::exporter::tonic::logs::TonicLogsClient;

let (channel, interceptor, compression) = self.build_channel(
Expand All @@ -274,7 +274,7 @@ impl TonicExporterBuilder {
pub(crate) fn build_metrics_exporter(
self,
temporality: opentelemetry_sdk::metrics::data::Temporality,
) -> opentelemetry::metrics::MetricResult<crate::MetricExporter> {
) -> opentelemetry_sdk::metrics::MetricResult<crate::MetricExporter> {
use crate::MetricExporter;
use metrics::TonicMetricsClient;

Expand Down
6 changes: 3 additions & 3 deletions opentelemetry-otlp/src/logs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use async_trait::async_trait;
use std::fmt::Debug;

use opentelemetry::logs::LogResult;
use opentelemetry_sdk::logs::LogResult;

use opentelemetry_sdk::export::logs::LogBatch;

Expand Down Expand Up @@ -62,14 +62,14 @@ impl LogExporterBuilder<NoExporterBuilderSet> {

#[cfg(feature = "grpc-tonic")]
impl LogExporterBuilder<TonicExporterBuilderSet> {
pub fn build(self) -> Result<LogExporter, opentelemetry::logs::LogError> {
pub fn build(self) -> Result<LogExporter, opentelemetry_sdk::logs::LogError> {
self.client.0.build_log_exporter()
}
}

#[cfg(any(feature = "http-proto", feature = "http-json"))]
impl LogExporterBuilder<HttpExporterBuilderSet> {
pub fn build(self) -> Result<LogExporter, opentelemetry::logs::LogError> {
pub fn build(self) -> Result<LogExporter, opentelemetry_sdk::logs::LogError> {
self.client.0.build_log_exporter()
}
}
Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-otlp/src/metric.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::NoExporterBuilderSet;

use async_trait::async_trait;
use core::fmt;
use opentelemetry::metrics::MetricResult;
use opentelemetry_sdk::metrics::MetricResult;

use opentelemetry_sdk::metrics::{
data::{ResourceMetrics, Temporality},
Expand Down
6 changes: 2 additions & 4 deletions opentelemetry-sdk/benches/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,11 @@ use std::time::SystemTime;

use criterion::{criterion_group, criterion_main, Criterion};

use opentelemetry::logs::{
AnyValue, LogRecord as _, LogResult, Logger as _, LoggerProvider as _, Severity,
};
use opentelemetry::logs::{AnyValue, LogRecord as _, Logger as _, LoggerProvider as _, Severity};
use opentelemetry::trace::Tracer;
use opentelemetry::trace::TracerProvider as _;
use opentelemetry::{InstrumentationScope, Key};
use opentelemetry_sdk::logs::{LogProcessor, LogRecord, Logger, LoggerProvider};
use opentelemetry_sdk::logs::{LogProcessor, LogRecord, LogResult, Logger, LoggerProvider};
use opentelemetry_sdk::trace;
use opentelemetry_sdk::trace::{Sampler, TracerProvider};

Expand Down
3 changes: 2 additions & 1 deletion opentelemetry-sdk/benches/log_exporter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ use std::time::SystemTime;
use async_trait::async_trait;
use criterion::{criterion_group, criterion_main, Criterion};

use opentelemetry::logs::{LogRecord as _, LogResult, Logger as _, LoggerProvider as _, Severity};
use opentelemetry::logs::{LogRecord as _, Logger as _, LoggerProvider as _, Severity};
use opentelemetry_sdk::logs::LogResult;

use opentelemetry::InstrumentationScope;
use opentelemetry_sdk::export::logs::LogBatch;
Expand Down
4 changes: 2 additions & 2 deletions opentelemetry-sdk/benches/log_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ use std::{

use criterion::{criterion_group, criterion_main, Criterion};
use opentelemetry::{
logs::{LogRecord as _, LogResult, Logger as _, LoggerProvider as _, Severity},
logs::{LogRecord as _, Logger as _, LoggerProvider as _, Severity},
InstrumentationScope,
};
use opentelemetry_sdk::logs::{LogProcessor, LogRecord, Logger, LoggerProvider};
use opentelemetry_sdk::logs::{LogProcessor, LogRecord, LogResult, Logger, LoggerProvider};

// Run this benchmark with:
// cargo bench --bench log_processor
Expand Down
6 changes: 3 additions & 3 deletions opentelemetry-sdk/benches/metric.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ use std::sync::{Arc, Weak};

use criterion::{criterion_group, criterion_main, Bencher, Criterion};
use opentelemetry::{
metrics::{Counter, Histogram, MeterProvider as _, MetricResult},
metrics::{Counter, Histogram, MeterProvider as _},
Key, KeyValue,
};
use opentelemetry_sdk::{
metrics::{
data::{ResourceMetrics, Temporality},
new_view,
reader::MetricReader,
Aggregation, Instrument, InstrumentKind, ManualReader, Pipeline, SdkMeterProvider, Stream,
View,
Aggregation, Instrument, InstrumentKind, ManualReader, MetricResult, Pipeline,
SdkMeterProvider, Stream, View,
},
Resource,
};
Expand Down
1 change: 1 addition & 0 deletions opentelemetry-sdk/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//! Wrapper for error from trace, logs and metrics part of open telemetry.
use std::sync::PoisonError;

#[cfg(feature = "logs")]
Expand Down
3 changes: 2 additions & 1 deletion opentelemetry-sdk/src/logs/log_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,7 @@ mod tests {
};
use crate::export::logs::{LogBatch, LogExporter};
use crate::logs::LogRecord;
use crate::logs::LogResult;
use crate::testing::logs::InMemoryLogExporterBuilder;
use crate::{
logs::{
Expand All @@ -547,7 +548,7 @@ mod tests {
use opentelemetry::logs::AnyValue;
use opentelemetry::logs::LogRecord as _;
use opentelemetry::logs::{Logger, LoggerProvider as _};
use opentelemetry::{logs::LogResult, KeyValue};
use opentelemetry::KeyValue;
use opentelemetry::{InstrumentationScope, Key};
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::{Arc, Mutex};
Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-sdk/src/metrics/aggregation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ mod tests {
internal::{EXPO_MAX_SCALE, EXPO_MIN_SCALE},
Aggregation,
};
use opentelemetry::metrics::{MetricError, MetricResult};
use crate::metrics::{MetricError, MetricResult};

#[test]
fn validate_aggregation() {
Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-sdk/src/metrics/meter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ where
mod tests {
use std::borrow::Cow;

use opentelemetry::metrics::MetricError;
use crate::metrics::MetricError;

use super::{
validate_instrument_name, validate_instrument_unit, INSTRUMENT_NAME_FIRST_ALPHABETIC,
Expand Down
3 changes: 2 additions & 1 deletion opentelemetry-sdk/src/metrics/periodic_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,11 +386,12 @@ impl MetricReader for PeriodicReader {
#[cfg(all(test, feature = "testing"))]
mod tests {
use super::PeriodicReader;
use crate::metrics::MetricError;
use crate::{
metrics::data::ResourceMetrics, metrics::reader::MetricReader, metrics::SdkMeterProvider,
runtime, testing::metrics::InMemoryMetricExporter, Resource,
};
use opentelemetry::metrics::{MeterProvider, MetricError};
use opentelemetry::metrics::MeterProvider;
use std::sync::mpsc;

#[test]
Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-sdk/src/testing/logs/in_memory_exporter.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::export::logs::{LogBatch, LogExporter};
use crate::logs::LogRecord;
use crate::logs::{LogError, LogResult};
use crate::Resource;
use async_trait::async_trait;
use opentelemetry::logs::{LogError, LogResult};
use opentelemetry::InstrumentationScope;
use std::borrow::Cow;
use std::sync::{Arc, Mutex};
Expand Down
4 changes: 2 additions & 2 deletions opentelemetry-sdk/src/testing/metrics/in_memory_exporter.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use crate::metrics::data;
use crate::metrics::data::{Histogram, Metric, ResourceMetrics, ScopeMetrics, Temporality};
use crate::metrics::exporter::PushMetricExporter;
use crate::metrics::MetricError;
use crate::metrics::MetricResult;
use async_trait::async_trait;
use opentelemetry::metrics::MetricError;
use opentelemetry::metrics::MetricResult;
use std::collections::VecDeque;
use std::fmt;
use std::sync::{Arc, Mutex};
Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-sdk/src/testing/metrics/metric_reader.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use std::sync::{Arc, Mutex, Weak};

use crate::metrics::MetricResult;
use crate::metrics::{
data::{ResourceMetrics, Temporality},
pipeline::Pipeline,
reader::MetricReader,
InstrumentKind,
};
use opentelemetry::metrics::MetricResult;

#[derive(Debug, Clone)]
pub struct TestMetricReader {
Expand Down
7 changes: 2 additions & 5 deletions opentelemetry-sdk/src/testing/trace/span_exporters.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
use crate::{
export::{
trace::{ExportResult, SpanData, SpanExporter},
ExportError,
},
export::trace::{ExportResult, SpanData, SpanExporter},
trace::{SpanEvents, SpanLinks},
};
use futures_util::future::BoxFuture;
Expand Down Expand Up @@ -80,7 +77,7 @@ pub struct TestExportError(String);

impl std::error::Error for TestExportError {}

impl ExportError for TestExportError {
impl opentelemetry::trace::ExportError for TestExportError {
fn exporter_name(&self) -> &'static str {
"test"
}
Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-stdout/src/logs/exporter.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use async_trait::async_trait;
use chrono::{DateTime, Utc};
use core::fmt;
use opentelemetry::logs::LogResult;
use opentelemetry_sdk::export::logs::LogBatch;
use opentelemetry_sdk::logs::LogResult;
use opentelemetry_sdk::Resource;
use std::sync::atomic;

Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-stdout/src/metrics/exporter.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use async_trait::async_trait;
use chrono::{DateTime, Utc};
use core::{f64, fmt};
use opentelemetry::metrics::{MetricError, MetricResult};
use opentelemetry_sdk::metrics::{
data::{self, ScopeMetrics, Temporality},
exporter::PushMetricExporter,
};
use opentelemetry_sdk::metrics::{MetricError, MetricResult};
use std::fmt::Debug;
use std::sync::atomic;

Expand Down
1 change: 0 additions & 1 deletion opentelemetry/src/global/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ mod metrics;
mod propagation;
#[cfg(feature = "trace")]
mod trace;
pub use error_handler::Error;

#[cfg(feature = "metrics")]
#[cfg_attr(docsrs, doc(cfg(feature = "metrics")))]
Expand Down
4 changes: 2 additions & 2 deletions stress/src/logs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ impl LogProcessor for NoOpLogProcessor {
) {
}

fn force_flush(&self) -> opentelemetry::logs::LogResult<()> {
fn force_flush(&self) -> opentelemetry_sdk::logs::LogResult<()> {
Ok(())
}

fn shutdown(&self) -> opentelemetry::logs::LogResult<()> {
fn shutdown(&self) -> opentelemetry_sdk::logs::LogResult<()> {
Ok(())
}
}
Expand Down

0 comments on commit fa9237b

Please sign in to comment.