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

improve code coverage: BaseExporter, BaseProcessor, PooledList, SamplingResult, SimpleExportProcessor, TracerProviderExtensions, MathHelper, and WildcardHelper #3476

Merged
merged 17 commits into from
Aug 4, 2022

Conversation

TimothyMothra
Copy link
Contributor

@TimothyMothra TimothyMothra commented Jul 22, 2022

Contributes to #3353

As of today:

  • overall: 86.67% -> 87.07%
    • OpenTelemetry.csproj: 86.56% -> 88.10%
      • BaseExporter: 66.67% -> 100%
      • BaseProcessor: 70% -> 100%
      • PooledList: 74% -> 100%
      • SamplingResult: 54.55% -> 100%
      • SimpleExportProcessor: 70% -> 100%
      • WildcardHelper: 88.89% -> 100%
      • TracerProviderExtensions: 40% -> 68%
      • MathHelper: 90.48% -> 100%

Changes

  • added new unit tests to improve coverage
  • added additional overloads to DelegatingExportor to enable more test scenarios.
  • added DelegatingProcessor

Please provide a brief description of the changes here.

For significant contributions please make sure you have completed the following items:

  • Appropriate CHANGELOG.md updated for non-trivial changes
  • Design discussion issue #
  • Changes in public API reviewed

@TimothyMothra TimothyMothra requested a review from a team July 22, 2022 22:02
@codecov
Copy link

codecov bot commented Jul 22, 2022

Codecov Report

Merging #3476 (dc7f47b) into main (51c6d13) will increase coverage by 0.88%.
The diff coverage is n/a.

❗ Current head dc7f47b differs from pull request most recent head 0b01280. Consider uploading reports for the commit 0b01280 to get more accurate results

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3476      +/-   ##
==========================================
+ Coverage   86.37%   87.26%   +0.88%     
==========================================
  Files         275      275              
  Lines        9959     9948      -11     
==========================================
+ Hits         8602     8681      +79     
+ Misses       1357     1267      -90     
Impacted Files Coverage Δ
...tation/OpenTelemetryProtocolExporterEventSource.cs 75.00% <0.00%> (-10.00%) ⬇️
...umentation.Http/TracerProviderBuilderExtensions.cs 71.42% <0.00%> (-3.58%) ⬇️
...ter.ZPages/Implementation/ZPagesActivityTracker.cs 97.14% <0.00%> (-2.86%) ⬇️
...Telemetry/Internal/SelfDiagnosticsEventListener.cs 96.87% <0.00%> (-0.79%) ⬇️
...tation.AspNetCore/Implementation/HttpInListener.cs 89.74% <0.00%> (-0.13%) ⬇️
src/OpenTelemetry/Metrics/MetricPoint.cs 84.89% <0.00%> (-0.11%) ⬇️
....Instrumentation.Http/HttpClientInstrumentation.cs 100.00% <0.00%> (ø)
...tion.AspNetCore/TracerProviderBuilderExtensions.cs 100.00% <0.00%> (ø)
...mentation/ExportClient/BaseOtlpHttpExportClient.cs 100.00% <0.00%> (ø)
...Exporter.Jaeger/Implementation/JaegerHttpClient.cs 91.66% <0.00%> (+0.36%) ⬆️
... and 22 more

reyang
reyang previously requested changes Jul 22, 2022
Copy link
Member

@reyang reyang left a comment

Choose a reason for hiding this comment

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

Need to remove bloated code, e.g. ExceptionTestExporter.

@TimothyMothra
Copy link
Contributor Author

Need to remove bloated code, e.g. ExceptionTestExporter.

@reyang I made changes to DelegatingTestExporter so I could use it for my test cases.
I was trying to keep refactors out of this PR. If we're okay with this change I can pull this into a smaller PR. I think there are some other tests that could use this to remove one-off TestExporters :)

@reyang reyang dismissed their stale review July 25, 2022 17:46

Boilerplate code are refactored

@TimothyMothra TimothyMothra changed the title improve code coverage: BaseExporter, BaseProcessor, PooledList, SamplingResult, SimpleExportProcessor, and WildcardHelper improve code coverage: BaseExporter, BaseProcessor, PooledList, SamplingResult, SimpleExportProcessor, TracerProviderExtensions, and WildcardHelper Jul 25, 2022
@TimothyMothra TimothyMothra changed the title improve code coverage: BaseExporter, BaseProcessor, PooledList, SamplingResult, SimpleExportProcessor, TracerProviderExtensions, and WildcardHelper improve code coverage: BaseExporter, BaseProcessor, PooledList, SamplingResult, SimpleExportProcessor, TracerProviderExtensions, MathHelper, and WildcardHelper Aug 3, 2022
// Verify that the Processor catches and suppresses the exception.
testSimpleExportProcessor.OnEnd(new object());

// verify Exporter OnExport wall called.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// verify Exporter OnExport wall called.
// verify Exporter OnExport was called.

Copy link
Member

@cijothomas cijothomas left a comment

Choose a reason for hiding this comment

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

nice!

@cijothomas cijothomas merged commit aba6eaf into open-telemetry:main Aug 4, 2022
@TimothyMothra TimothyMothra deleted the tilee/3353_OpenTelemetry_misc branch August 4, 2022 23:10
public void Verify_ForceFlush_HandlesException()
{
// By default, ForceFlush should return true.
var testExporter = new DelegatingExporter<object>();
Copy link
Contributor

@utpilla utpilla Aug 4, 2022

Choose a reason for hiding this comment

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

Is this actually testing the "default" return value of BaseExporter<T>.ForceFlush()? This would test what DelegatingExporter.OnForceFlushFunc returns.

{
// By default, ForceFlush should return true.
var testExporter = new DelegatingExporter<object>();
Assert.True(testExporter.Shutdown());
Copy link
Contributor

Choose a reason for hiding this comment

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

Same concern as the previous comment.

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.

4 participants