Skip to content

Commit

Permalink
stamp 0.3.0: upgrading opentelemetry to 0.22, remove incompatible ope…
Browse files Browse the repository at this point in the history
…ntelemetry-api dependency
  • Loading branch information
francoposa committed May 5, 2024
1 parent b2c3afa commit 68284a3
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "tower-otel-http-metrics"
edition = "2021"
version = "0.3.0-alpha0"
version = "0.3.0"
license = "MIT"
description = "OpenTelemetry Metrics Middleware for Tower-compatible Rust HTTP servers"
homepage = "https://github.com/francoposa/tower-otel-http-metrics"
Expand Down
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use std::time::Duration;

use axum::routing::{get, post, put, Router};
use bytes::Bytes;
use opentelemetry_api::global;
use opentelemetry::{global, KeyValue};
use opentelemetry_otlp::{
WithExportConfig, {self},
};
Expand All @@ -42,9 +42,10 @@ fn init_otel_resource() -> Resource {
Box::new(TelemetryResourceDetector),
],
);
let otlp_resource_override = Resource::new(vec![
opentelemetry_semantic_conventions::resource::SERVICE_NAME.string(SERVICE_NAME),
]);
let otlp_resource_override = Resource::new(vec![KeyValue {
key: opentelemetry_semantic_conventions::resource::SERVICE_NAME.into(),
value: SERVICE_NAME.into(),
}]);
otlp_resource_detected.merge(&otlp_resource_override)
}

Expand Down Expand Up @@ -107,7 +108,7 @@ use http_body_util::Full;
use hyper::body::Bytes;
use hyper::server::conn::http1;
use hyper::{Request, Response};
use opentelemetry_api::global;
use opentelemetry::{global, KeyValue};
use opentelemetry_otlp::{
WithExportConfig, {self},
};
Expand All @@ -130,9 +131,10 @@ fn init_otel_resource() -> Resource {
Box::new(TelemetryResourceDetector),
],
);
let otlp_resource_override = Resource::new(vec![
opentelemetry_semantic_conventions::resource::SERVICE_NAME.string(SERVICE_NAME),
]);
let otlp_resource_override = Resource::new(vec![KeyValue {
key: opentelemetry_semantic_conventions::resource::SERVICE_NAME.into(),
value: SERVICE_NAME.into(),
}]);
otlp_resource_detected.merge(&otlp_resource_override)
}

Expand Down
8 changes: 3 additions & 5 deletions development/config/otel-collector-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ receivers:
endpoint: 0.0.0.0:4317

exporters:
logging:
loglevel: debug
debug:
verbosity: detailed
otlphttp/grafana-cloud:
Expand Down Expand Up @@ -64,10 +62,10 @@ service:
pipelines:
metrics:
receivers: [ otlp ]
exporters: [ logging, otlphttp/mimir-monolithic-mode-local ]
exporters: [ debug, otlphttp/mimir-monolithic-mode-docker-compose ]
# traces:
# receivers: [ otlp ]
# exporters: [ logging ]
# exporters: [ debug ]
# logs:
# receivers: [ otlp ]
# exporters: [ logging ]
# exporters: [ debug ]
2 changes: 1 addition & 1 deletion development/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ networks:

services:
otel-collector:
image: otel/opentelemetry-collector:latest
image: otel/opentelemetry-collector-contrib:latest
container_name: otel-collector
command:
- "--config=/etc/otel-collector-config.yaml"
Expand Down

0 comments on commit 68284a3

Please sign in to comment.