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

Integration tests for Logs #1759

Merged
merged 12 commits into from
May 23, 2024
Merged

Conversation

lalitb
Copy link
Member

@lalitb lalitb commented May 14, 2024

Changes

This is ready for review. It tests the basic use-case of OTLP Log export using default (grpc) exporter, and compare the generated log file, with one stored in the repo.
The changes are inspired (actually shameless copy :) ) from @TommyCpp 's implementation for span's integration tests.

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 May 14, 2024 07:54
@lalitb lalitb marked this pull request as draft May 14, 2024 07:54
@lalitb lalitb changed the title Integration tests for Logs [WIP] Integration tests for Logs May 14, 2024
@lalitb lalitb added the integration tests Run integration tests label May 16, 2024
Copy link

codecov bot commented May 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.6%. Comparing base (35f9a60) to head (ca8a955).

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #1759   +/-   ##
=====================================
  Coverage   73.6%   73.6%           
=====================================
  Files        124     124           
  Lines      19517   19517           
=====================================
+ Hits       14377   14378    +1     
+ Misses      5140    5139    -1     

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

@lalitb lalitb marked this pull request as ready for review May 16, 2024 21:25
@lalitb lalitb changed the title [WIP] Integration tests for Logs Integration tests for Logs May 16, 2024
tokio = { version = "1.0", features = ["full"] }
serde_json = "1"
testcontainers = "0.15.0"
# env_logger = "0.11.3" // uncomment if needed for local debugging.
Copy link
Member Author

Choose a reason for hiding this comment

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

This won't be usable further for local debugging. As we can only have one subscriber with log.

for path in ["common.v1.KeyValue.value", "logs.v1.LogRecord.body"] {
builder = builder
.field_attribute(path, "#[cfg_attr(feature =\"with-serde\", serde(serialize_with = \"crate::proto::serializers::serialize_to_value\", deserialize_with = \"crate::proto::serializers::deserialize_from_value\"))]");
}
Copy link
Member Author

Choose a reason for hiding this comment

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

LogRecord::body is AnyValue, and we need a custom serializer/deserializer for it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep that's a good follow up but not necessary blocking

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, this has been added to this PR, as was a pre-requisite to serialize/deserialize LogData.

@TommyCpp TommyCpp merged commit d21b13a into open-telemetry:main May 23, 2024
21 of 22 checks passed
lalitb added a commit to lalitb/opentelemetry-rust that referenced this pull request May 23, 2024
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.

2 participants