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

Prepare crates for otel v0.27.0 #130

Merged
merged 7 commits into from
Nov 26, 2024
Merged

Conversation

lalitb
Copy link
Member

@lalitb lalitb commented Nov 18, 2024

Fixes #
Design discussion issue (if applicable) #

Changes

Please provide a brief description of the changes here.

Merge requirement checklist

  • CONTRIBUTING guidelines followed
  • Unit tests added/updated (if applicable)
  • Appropriate CHANGELOG.md files updated for non-trivial, user-facing changes
  • Changes in public API reviewed (if applicable)

@lalitb lalitb requested a review from a team as a code owner November 18, 2024 07:31
@lalitb lalitb changed the title Prepare for otel v0.27.0 Prepare crates for otel v0.27.0 Nov 18, 2024
Copy link

codecov bot commented Nov 18, 2024

Codecov Report

Attention: Patch coverage is 40.00000% with 27 lines in your changes missing coverage. Please review.

Project coverage is 55.4%. Comparing base (559fe64) to head (e6476da).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
opentelemetry-stackdriver/src/lib.rs 0.0% 5 Missing ⚠️
...pentelemetry-user-events-logs/src/logs/exporter.rs 0.0% 5 Missing ⚠️
opentelemetry-datadog/src/exporter/intern.rs 0.0% 4 Missing ⚠️
...elemetry-contrib/src/trace/exporter/jaeger_json.rs 0.0% 3 Missing ⚠️
opentelemetry-datadog/src/exporter/mod.rs 80.0% 3 Missing ⚠️
opentelemetry-etw-logs/src/logs/exporter.rs 50.0% 2 Missing ⚠️
opentelemetry-aws/src/trace/xray_propagator.rs 0.0% 1 Missing ⚠️
opentelemetry-etw-logs/src/logs/converters.rs 0.0% 1 Missing ⚠️
opentelemetry-stackdriver/src/proto/api.rs 0.0% 1 Missing ⚠️
...ser-events-logs/src/logs/reentrant_logprocessor.rs 0.0% 1 Missing ⚠️
... and 1 more
Additional details and impacted files
@@           Coverage Diff           @@
##            main    #130     +/-   ##
=======================================
- Coverage   55.4%   55.4%   -0.1%     
=======================================
  Files         39      39             
  Lines       6105    6098      -7     
=======================================
- Hits        3385    3381      -4     
+ Misses      2720    2717      -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -17,6 +17,7 @@ impl IntoJson for AnyValue {
AnyValue::Bytes(_value) => todo!("No support for AnyValue::Bytes yet."),
AnyValue::ListAny(value) => value.as_json_value(),
AnyValue::Map(value) => value.as_json_value(),
&_ => Value::Null,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I rather we add a branch that explicitly calls todo!. This way, upgrades to opentelemetry that adds a new value will fail to compile, forcing us to add support for it. Returning Null make it easy to forget.

Suggested change
&_ => Value::Null,
&_ => {
// If we reach this line is because we are upgrading opentelemetry to a version that contains a new type.
// We must add support for the new type.
todo!("Add support for new types");
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@psandana The goal is to ensure that adding a new enum variant in OpenTelemetry does not break custom exporters.

PS: I believe the suggested change won't cause a compile-time failure but will result in a runtime panic, which we want to avoid entirely.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lalitb you are right. IMO, if compile error is preferred, then I would just remove the &_ entry. If opentelemetry ever adds a new item to the enum, it should come with code that handles it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad. Forgot this is non-exhaustive, so you must use a default branch.

@@ -401,6 +401,7 @@ fn add_attribute_to_event(event: &mut tld::EventBuilder, key: &Key, value: &AnyV
0,
);
}
&_ => {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as in converters.rs file:

Suggested change
&_ => {}
&_ => {
// If we reach this line is because we are upgrading opentelemetry to a version that contains a new type.
// We must add support for the new type.
todo!("Add support for new types");
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@psandana same as the earlier comment.

@psandana psandana mentioned this pull request Nov 25, 2024
4 tasks
@lalitb lalitb merged commit 1cb39ed into open-telemetry:main Nov 26, 2024
9 of 10 checks passed
@lalitb
Copy link
Member Author

lalitb commented Nov 26, 2024

crates are published now:

~/obs/ot/opentelemetry-rust-contrib$ for crate in opentelemetry-*; do    
    data=$(curl -s "https://crates.io/api/v1/crates/$crate")
    latest_version=$(echo "$data" | jq -r '.versions[0].num')
    latest_date=$(echo "$data" | jq -r '.versions[0].created_at' | xargs -I{} date -d {} +"%Y-%m-%d %H:%M:%S")
    echo "$crate: version $latest_version, published at $latest_date"
done
opentelemetry-aws: version 0.15.0, published at 2024-11-25 22:44:15
opentelemetry-contrib: version 0.19.0, published at 2024-11-25 22:45:29
opentelemetry-datadog: version 0.15.0, published at 2024-11-25 22:46:17
opentelemetry-etw-logs: version 0.6.0, published at 2024-11-25 22:46:37
opentelemetry-etw-metrics: version 0.6.0, published at 2024-11-25 22:47:17
opentelemetry-resource-detectors: version 0.6.0, published at 2024-11-25 22:47:52
opentelemetry-stackdriver: version 0.24.0, published at 2024-11-25 22:48:33
opentelemetry-user-events-logs: version 0.8.0, published at 2024-11-25 22:49:18
opentelemetry-user-events-metrics: version 0.8.0, published at 2024-11-25 22:49:02
opentelemetry-zpages: version 0.12.0, published at 2024-11-25 22:50:04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants