Skip to content

Commit

Permalink
Update user_events metrics exporter to otel 0.27, add internal logs (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
lalitb authored Nov 15, 2024
1 parent d407cbf commit 559fe64
Show file tree
Hide file tree
Showing 5 changed files with 153 additions and 85 deletions.
6 changes: 5 additions & 1 deletion opentelemetry-user-events-metrics/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# Changelog

## vNext
## v0.8.0

### Changed

- Bump opentelemetry and opentelemetry_sdk versions to 0.27
- Bump opentelemetry-proto version to 0.27
- Uses internal logging from `opentelemetry` crate, which routes internal logs
via `tracing`
- Add support for skipping the metric data point if the size exceeds 65360 bytes.

## v0.7.0
Expand Down
6 changes: 3 additions & 3 deletions opentelemetry-user-events-metrics/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ edition = "2021"
rust-version = "1.71.1"

[dependencies]
opentelemetry = { workspace = true, features = ["metrics"] }
opentelemetry_sdk = { workspace = true, features = ["metrics", "rt-tokio"] }
opentelemetry-proto = { workspace = true, features = ["gen-tonic", "metrics"] }
opentelemetry = { version = "0.27", features = ["metrics"] }
opentelemetry_sdk = { version = "0.27", features = ["metrics", "rt-tokio"] }
opentelemetry-proto = { version = "0.27", features = ["gen-tonic", "metrics"] }
eventheader = { version = "= 0.4.0" }
async-trait = "0.1"
prost = "0.13"
Expand Down
28 changes: 16 additions & 12 deletions opentelemetry-user-events-metrics/examples/basic-metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,31 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
.f64_counter("counter_f64_test")
.with_description("test_decription")
.with_unit("test_unit")
.init();
.build();

let counter2 = meter
.u64_counter("counter_u64_test")
.with_description("test_decription")
.with_unit("test_unit")
.init();
.build();

// Create an UpDownCounter Instrument.
let updown_counter = meter.i64_up_down_counter("up_down_counter_i64_test").init();
let updown_counter2 = meter.f64_up_down_counter("up_down_counter_f64_test").init();
let updown_counter = meter
.i64_up_down_counter("up_down_counter_i64_test")
.build();
let updown_counter2 = meter
.f64_up_down_counter("up_down_counter_f64_test")
.build();

// Create a Histogram Instrument.
let histogram = meter
.f64_histogram("histogram_f64_test")
.with_description("test_description")
.init();
.build();
let histogram2 = meter
.u64_histogram("histogram_u64_test")
.with_description("test_description")
.init();
.build();

// Create a ObservableGauge instrument and register a callback that reports the measurement.
let _gauge = meter
Expand All @@ -68,7 +72,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
],
)
})
.init();
.build();

let _gauge2 = meter
.u64_observable_gauge("observable_gauge_u64_test")
Expand All @@ -83,7 +87,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
],
)
})
.init();
.build();

// Create a ObservableCounter instrument and register a callback that reports the measurement.
let _observable_counter = meter
Expand All @@ -99,7 +103,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
],
)
})
.init();
.build();

let _observable_counter2 = meter
.f64_observable_counter("observable_counter_f64_test")
Expand All @@ -114,7 +118,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
],
)
})
.init();
.build();

// Create a Observable UpDownCounter instrument and register a callback that reports the measurement.
let _observable_up_down_counter = meter
Expand All @@ -130,7 +134,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
],
)
})
.init();
.build();
let _observable_up_down_counter2 = meter
.f64_observable_up_down_counter("observable_up_down_counter_f64_test")
.with_description("test_description")
Expand All @@ -144,7 +148,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
],
)
})
.init();
.build();

loop {
// Record measurements using the Counter instrument.
Expand Down
Loading

0 comments on commit 559fe64

Please sign in to comment.