Skip to content

feat(opentelemetry): add OpenTelemetry unit tests and update dependencies#148

Merged
j-d-ha merged 10 commits into
mainfrom
feature/add-otel-tests
Nov 16, 2025
Merged

feat(opentelemetry): add OpenTelemetry unit tests and update dependencies#148
j-d-ha merged 10 commits into
mainfrom
feature/add-otel-tests

Conversation

@j-d-ha

@j-d-ha j-d-ha commented Nov 16, 2025

Copy link
Copy Markdown
Collaborator

🚀 Pull Request

📋 Summary

This PR adds comprehensive unit tests for OpenTelemetry shutdown extensions, refactors OpenTelemetry extensions to use C# 14 extension blocks for cleaner syntax, updates dependabot configuration to check dependencies daily and add npm and dotnet-tools support, and updates project dependencies with new testing packages.


✅ Checklist

  • My changes build cleanly
  • I've added/updated relevant tests
  • I've added/updated documentation or README
  • I've followed the coding style for this project
  • I've tested the changes locally (if applicable)

🧪 Related Issues or PRs

Closes #N/A


💬 Notes for Reviewers

  • OpenTelemetry adapters have been refactored to use C# 14 extension blocks syntax
  • New unit test project added: AwsLambda.Host.OpenTelemetry.UnitTests
  • Dependabot now checks for updates daily and includes npm and dotnet-tools packages
  • All tests passing, build succeeds cleanly

- Moved project description below badges for improved structure and readability.
- Removed redundant IServiceProvider parameter from tracer methods.
- Improved null checks using `ArgumentNullException.ThrowIfNull`.
- Consolidated and simplified code structure for clarity and maintainability.
- Added `AwsLambda.Host.OpenTelemetry.UnitTests` project to solution.
- Included initial test class `LambdaOpenTelemetryServiceProviderExtensionsTests` with a placeholder test.
- Configured multiple target frameworks for the test project.
- Added necessary dependencies to support testing, mocking, and coverage tools.
- Added comprehensive unit tests for `LambdaOpenTelemetryServiceProviderExtensions` methods.
- Verified behavior for various scenarios, including null checks, invalid types, and valid middleware flows.
- Introduced helper models (`TestEvent`, `TestResponse`) to support test scenarios.
- Updated project file to include necessary dependencies and project references.
- Modified target frameworks and enabled `LangVersion=preview` for testing.
…n extensions

- Reorganized `OnShutdownOpenTelemetryExtensions` methods for improved readability and maintainability.
- Removed redundant XML documentation in favor of concise summaries.
- Consolidated method chaining to streamline extension behavior.
- Enhanced exception handling with `ArgumentNullException.ThrowIfNull`.
- Simplified `RunForceFlush` logic with consistent logging and timeout handling.
…viderExtensionsTests

- Removed unused `AutoFixture` dependency.
- Reorganized long method declarations to improve readability.
- Standardized formatting across `TestEvent` and `TestResponse` helper classes.
- Enhanced code consistency in test case definitions and constructor initialization.
- Added `OnShutdownFlushTracer` tests to validate different shutdown scenarios for tracer providers.
- Added `OnShutdownFlushMeter` tests to validate meter provider force flush behaviors on shutdown.
- Added `OnShutdownFlushOpenTelemetry` tests to cover combined tracer and meter flush scenarios.
- Verified logging messages for successful, failed, and timed-out flush operations.
- Introduced helper classes and mocks (`MockOptions`, `MockProcessor`, `MockMetricReader`) for test setup.
- Added `NSubstitute.Analyzers.CSharp` to all test projects for improved mocking verification.
- Integrated `OpenTelemetry.Exporter.InMemory` into OpenTelemetry test project for in-memory tracing.
- Added `Microsoft.Extensions.Diagnostics.Testing` to support diagnostic testing scenarios.
- Updated `Directory.Packages.props` to include new package versions for consistent versioning.
…ols support

- Changed Dependabot update schedule from weekly to daily for nuget and GitHub Actions ecosystems.
- Added configurations for npm and dotnet-tools ecosystems with daily updates.
- Defined minor-and-patch groupings for consistent dependency management.
@github-actions github-actions Bot added the type: feat New feature label Nov 16, 2025
- Changed `dotnet-tools` ecosystem to `dotnet-sdk` in Dependabot config.
- Updated directory to `/` for `dotnet-sdk`.
- Modified update schedule from daily to weekly for better control.
@j-d-ha j-d-ha changed the title feat(tests): add OpenTelemetry unit tests and update dependencies feat(test): add OpenTelemetry unit tests and update dependencies Nov 16, 2025
@j-d-ha j-d-ha changed the title feat(test): add OpenTelemetry unit tests and update dependencies feat(opentelemetry): add OpenTelemetry unit tests and update dependencies Nov 16, 2025
@sonarqubecloud

sonarqubecloud Bot commented Nov 16, 2025

Copy link
Copy Markdown

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

@codecov

codecov Bot commented Nov 16, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #148      +/-   ##
==========================================
+ Coverage   64.15%   71.86%   +7.70%     
==========================================
  Files          61       61              
  Lines        1727     1731       +4     
  Branches      202      202              
==========================================
+ Hits         1108     1244     +136     
+ Misses        562      430     -132     
  Partials       57       57              
Files with missing lines Coverage Δ
....Host.OpenTelemetry/LambdaOpenTelemetryAdapters.cs 100.00% <100.00%> (+100.00%) ⬆️
...OpenTelemetry/OnShutdownOpenTelemetryExtensions.cs 100.00% <100.00%> (+100.00%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8bdcec8...1da70de. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@j-d-ha
j-d-ha merged commit c92ea17 into main Nov 16, 2025
9 of 11 checks passed
@j-d-ha
j-d-ha deleted the feature/add-otel-tests branch November 16, 2025 15:31
@j-d-ha j-d-ha added type: chore Maintenance task and removed type: feat New feature labels Nov 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: chore Maintenance task

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant