Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opentelemetry-otlp: Default the port correctly. #1556

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion opentelemetry-otlp/CHANGELOG.md
Expand Up @@ -2,8 +2,14 @@

## vNext

- **Breaking** Remove support for surf HTTP client [#1537](https://github.com/open-telemetry/opentelemetry-rust/pull/1537)
### Fixed
- Fix `tonic()` to the use correct port. [#1556](https://github.com/open-telemetry/opentelemetry-rust/pull/1556)

### Changed
- Update to tonic 0.11 and prost 0.12 (#1536)

### Removed
- **Breaking** Remove support for surf HTTP client [#1537](https://github.com/open-telemetry/opentelemetry-rust/pull/1537)
- Remove support for grpcio transport (#1534)

## v0.14.0
Expand Down
22 changes: 22 additions & 0 deletions opentelemetry-otlp/src/exporter/mod.rs
Expand Up @@ -245,6 +245,28 @@ mod tests {
)
}

#[cfg(feature = "http-proto")]
#[test]
fn test_default_http_endpoint() {
let exporter_builder = crate::new_exporter().http();

assert_eq!(
exporter_builder.exporter_config.endpoint,
"http://localhost:4318"
);
}

#[cfg(feature = "grpc-tonic")]
#[test]
fn test_default_tonic_endpoint() {
let exporter_builder = crate::new_exporter().tonic();

assert_eq!(
exporter_builder.exporter_config.endpoint,
"http://localhost:4317"
);
}

#[test]
fn test_parse_header_string() {
let test_cases = vec![
Expand Down
1 change: 1 addition & 0 deletions opentelemetry-otlp/src/exporter/tonic/mod.rs
Expand Up @@ -149,6 +149,7 @@ impl Default for TonicExporterBuilder {
TonicExporterBuilder {
exporter_config: ExportConfig {
protocol: crate::Protocol::Grpc,
endpoint: crate::exporter::default_endpoint(crate::Protocol::Grpc),
..Default::default()
},
tonic_config,
Expand Down
7 changes: 1 addition & 6 deletions opentelemetry-otlp/tests/integration_test/tests/traces.rs
Expand Up @@ -6,7 +6,6 @@ use opentelemetry::{
trace::{TraceContextExt, Tracer},
Key, KeyValue,
};
use opentelemetry_otlp::WithExportConfig;
use opentelemetry_sdk::{runtime, trace as sdktrace, Resource};
use std::error::Error;
use std::fs::File;
Expand All @@ -15,11 +14,7 @@ use std::os::unix::fs::MetadataExt;
fn init_tracer() -> Result<sdktrace::Tracer, TraceError> {
opentelemetry_otlp::new_pipeline()
.tracing()
.with_exporter(
opentelemetry_otlp::new_exporter()
.tonic()
.with_endpoint("http://localhost:4317"),
)
.with_exporter(opentelemetry_otlp::new_exporter().tonic())
.with_trace_config(
sdktrace::config().with_resource(Resource::new(vec![KeyValue::new(
opentelemetry_semantic_conventions::resource::SERVICE_NAME,
Expand Down