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

chore: Test sync exporters #2455

Merged

Conversation

scottgerring
Copy link
Contributor

More work for #2432. In this case we're adding coverage for using the batch log exporters from non-tokio main functions.

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)

@scottgerring scottgerring marked this pull request as ready for review December 19, 2024 09:43
@scottgerring scottgerring requested a review from a team as a code owner December 19, 2024 09:43
Copy link

codecov bot commented Dec 19, 2024

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 76.1%. Comparing base (acf16ed) to head (a30e807).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
opentelemetry-zipkin/src/exporter/mod.rs 0.0% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            main   #2455     +/-   ##
=======================================
- Coverage   76.1%   76.1%   -0.1%     
=======================================
  Files        122     122             
  Lines      22065   22066      +1     
=======================================
  Hits       16793   16793             
- Misses      5272    5273      +1     

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

@@ -22,7 +22,7 @@ fn init_tracer() -> sdktrace::TracerProvider {

struct MetadataMap<'a>(&'a mut tonic::metadata::MetadataMap);

impl<'a> Injector for MetadataMap<'a> {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I applied clippy fixes and it wants to elide this lifecycle 🤷

@@ -29,7 +29,7 @@ pub mod hello_world {

struct MetadataMap<'a>(&'a tonic::metadata::MetadataMap);

impl<'a> Extractor for MetadataMap<'a> {
impl Extractor for MetadataMap<'_> {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

... and this one

@@ -239,7 +239,7 @@ mod any_value {
pub(crate) fn serialize(value: log::kv::Value) -> Option<AnyValue> {
struct ValueVisitor(Option<AnyValue>);

impl<'kvs> log::kv::VisitValue<'kvs> for ValueVisitor {
impl log::kv::VisitValue<'_> for ValueVisitor {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

... and this one.
I can remove these, but we should probably start enforcing this in CI anyway, I reckon :D

@@ -84,15 +98,44 @@ mod logtests {

Ok(())
}

#[test]
#[cfg(any(feature = "tonic-client", feature = "reqwest-blocking-client"))]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cijothomas here's the new test. I took advantage of the temporary tokio runtime to setup the collector too.

@@ -140,8 +140,8 @@ struct UnsafeSlice<'a> {
slice: &'a [UnsafeCell<WorkerStats>],
}

unsafe impl<'a> Send for UnsafeSlice<'a> {}
unsafe impl<'a> Sync for UnsafeSlice<'a> {}
unsafe impl Send for UnsafeSlice<'_> {}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

More elision

@scottgerring
Copy link
Contributor Author

@cijothomas , works on my machine ;) Needs the integration tests label applied here to confirm then I reckon it's good!

let logger_provider = rt.block_on(async {
// While we're here setup our collector container too, as this needs tokio to run
test_utils::start_collector_container().await?;
init_logs()
Copy link
Member

Choose a reason for hiding this comment

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

nit - will it make sense to have two different tests, with init_logs being called within tokio runtime only for tonic-client ?

Copy link
Member

@lalitb lalitb left a comment

Choose a reason for hiding this comment

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

Thanks.

@lalitb lalitb added the integration tests Run integration tests label Dec 19, 2024
@cijothomas cijothomas merged commit 0fc0764 into open-telemetry:main Dec 19, 2024
22 of 23 checks passed
@scottgerring scottgerring deleted the chore/test-sync-exporters branch December 19, 2024 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration tests Run integration tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants