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

[AzureMonitorExporter] minor test improvements. add additional logging to TelemetryItems tests #31557

Merged
merged 7 commits into from
Sep 30, 2022

Conversation

TimothyMothra
Copy link
Contributor

@TimothyMothra TimothyMothra commented Sep 30, 2022

This PR adds additional console logging to help inspect TelemetryItems

Still having some intermediate test failures.
I need this additional logging to identify the origin of the extra Activity TelemetryItems that are being captured by our test.

Changes

  • move TelemetryItemOutputHelper from "Integration.Tests" project to "CommonTestFramework"
    This makes this class available to all tests.
  • add logging to every "TelemetryItemValidation" test.
  • assert SpanId to Trace tests.
  • change LogExporterForTest to use SimpleLogRecordExportProcessor
  • mitigate test failure by using .First() instead of .Single().
    This should prevent the random error from blocking someone else in the Azure repo.
    I'll continue investigating this on a new branch.

Visual Studio Screenshot

image

@azure-sdk
Copy link
Collaborator

API change check

API changes are not detected in this pull request.

@TimothyMothra TimothyMothra changed the title [AzureMonitorExporter] investigating test failures [AzureMonitorExporter] add additional logging to TelemetryItems tests Sep 30, 2022
@TimothyMothra TimothyMothra marked this pull request as ready for review September 30, 2022 17:42
@TimothyMothra TimothyMothra added the Monitor - Exporter Monitor OpenTelemetry Exporter label Sep 30, 2022
@TimothyMothra
Copy link
Contributor Author

TimothyMothra commented Sep 30, 2022

Captured the failure.
It appears that the test created two duplicate Activities: Name, TraceId, and SpanId are identical.

 Failed Azure.Monitor.OpenTelemetry.Exporter.Tests.E2ETelemetryItemValidation.TracesTests.VerifyLogWithinActivity(logLevel: Trace, expectedSeverityLevel: "Verbose") [1 s]
  Error Message:
   System.InvalidOperationException : Sequence contains more than one element
  Stack Trace:
     at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source)
   at Azure.Monitor.OpenTelemetry.Exporter.Tests.E2ETelemetryItemValidation.TracesTests.VerifyLogWithinActivity(LogLevel logLevel, String expectedSeverityLevel) in D:\a\_work\1\s\sdk\monitor\Azure.Monitor.OpenTelemetry.Exporter\tests\Azure.Monitor.OpenTelemetry.Exporter.Tests\E2ETelemetryItemValidation\TracesTests.cs:line 185
  Standard Output Messages:
 --------------------------------
 Name: RemoteDependency
 Tags: 4
 	ai.operation.id: 13edd4f471789fa99d168090412fbf40
 	ai.cloud.role: unknown_service:testhost.net461
 	ai.cloud.roleInstance: f9ee0c6bc000019
 	ai.internal.sdkVersion: dotnet4.8.4515.0:otel1.3.1:ext1.0.0-alpha.20220930.7
 
BaseData: RemoteDependencyData
 Name: TestActivity VerifyLogWithinActivity Trace
 Id: 242d683d95b1297e
 Properties: 0
 --------------------------------
 Name: RemoteDependency
 Tags: 4
 	ai.operation.id: 13edd4f471789fa99d168090412fbf40
 	ai.cloud.role: unknown_service:testhost.net461
 	ai.cloud.roleInstance: f9ee0c6bc000019
 	ai.internal.sdkVersion: dotnet4.8.4515.0:otel1.3.1:ext1.0.0-alpha.20220930.7
 
BaseData: RemoteDependencyData
 Name: TestActivity VerifyLogWithinActivity Trace
 Id: 242d683d95b1297e
 Properties: 0

@TimothyMothra TimothyMothra changed the title [AzureMonitorExporter] add additional logging to TelemetryItems tests [AzureMonitorExporter] minor improvements. add additional logging to TelemetryItems tests Sep 30, 2022
@TimothyMothra TimothyMothra changed the title [AzureMonitorExporter] minor improvements. add additional logging to TelemetryItems tests [AzureMonitorExporter] minor test improvements. add additional logging to TelemetryItems tests Sep 30, 2022
@TimothyMothra TimothyMothra enabled auto-merge (squash) September 30, 2022 21:27
@TimothyMothra TimothyMothra merged commit b744e57 into main Sep 30, 2022
@TimothyMothra TimothyMothra deleted the tilee/new_tests3 branch September 30, 2022 22:01
sofiar-msft pushed a commit to sofiar-msft/azure-sdk-for-net that referenced this pull request Dec 7, 2022
…g to `TelemetryItems` tests (Azure#31557)

* investigating test failures

* additional logs

* fix

* add spanId missing from Trace tests

* change LogExporterForTest to use SimpleLogRecordExportProcessor

* mitigate test by using .First()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Monitor - Exporter Monitor OpenTelemetry Exporter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants