[Testing] Improve span metadata rules#3226
Conversation
…t accounted for - Add rules for HotChocolate and Process integrations - Fix rules for other integrations. There are still some that fail for now...
…ontract: ValidationIntegrationSpan(MockSpan) => Result - Apply the new abstract class to a subset of AspNetCore and Grpc test classes
…ionTest and implement the ValidateIntegrationSpan method
This reverts commit 206a2d2.
This reverts commit bba1802.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| { | ||
| } | ||
|
|
||
| public abstract Result ValidateIntegrationSpan(MockSpan span); |
There was a problem hiding this comment.
Anyway that this could be called automatically for each tests that inherits from this class? From a Dispose method maybe? I guess XUnit is not too helpful here ...
There was a problem hiding this comment.
Yeah, nice idea, but not sure that's doable with unfortunately - IIRC, the Dispose method runs outside the context of a test, so failures there wouldn't be reported properly 🤔 Plus the mechanics of passing the spans + expectations etc are a bit problematic
robertpi
left a comment
There was a problem hiding this comment.
Couple of minor comments, but otherwise LGTM.
…nstructor to the correct order after removing extra compiler directives
…n method in all applicable tracing integration tests to maximize code reuse
…tually run CI on CosmosDb right now
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
pierotibou
left a comment
There was a problem hiding this comment.
Really nice.
One super small nit in the action
| if ($LASTEXITCODE -eq 1) { | ||
| git diff -- .\docs\span_metadata.md | ||
| Write-Error "Found changes in docs/span_metadata.md file. Run build task GenerateSpanDocumentation to regenerate the file with the latest C# rules." | ||
| Exit 1 |
There was a problem hiding this comment.
Do you plan to make this step mandatory in the repo?
There was a problem hiding this comment.
Hmm I can update our Automatic Instrumentation docs to add this step for the integration development, as that's the only time you'll usually need to update this. Implemented in c59488f
There was a problem hiding this comment.
I suspect Pierre meant marking the GitHub action as required for merges 🙂
There was a problem hiding this comment.
I suspect Pierre meant marking the GitHub action as required for merges 🙂
Yep. Sorry if it wasn't clear
Co-authored-by: Pierre Bonet <[email protected]>
Benchmarks Report 🐌Benchmarks for #3226 compared to master:
The following thresholds were used for comparing the benchmark speeds:
Allocation changes below 0.5% are ignored. Benchmark detailsBenchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.AppSecBodyBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.AspNetCoreBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.DbCommandBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.ElasticsearchBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.GraphQLBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.HttpClientBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.ILoggerBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.Log4netBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.NLogBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.RedisBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.SerilogBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.SpanBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.TraceAnnotationsBenchmark - Same speed ✔️ Same allocations ✔️Raw results
|
Code Coverage Report 📊✔️ Merging #3226 into master will not change line coverage
View the full report for further details: Datadog.Trace Breakdown ✔️
The following classes have significant coverage changes.
View the full reports for further details: |
Summary of changes
A whole bunch of improvements to the span metadata rules infra in our integration test code.
Reason for change
Currently the span metadata rules are not required when adding a new integration and I believe they help make strong checks on the spans we produce.
Implementation details
HotChocolateandProcessintegrationsTracingIntegrationTestclassdocs/span_metadata.mdis up-to-date withtracer/test/Datadog.Trace.TestHelpers/SpanMetadataRules.csTest coverage
For integration tests, I ran as many tests locally as I could.
For the GitHub Action, you can see it fail before updating the markdown and then succeed after updating the markdown.
Other details
N/A