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

internal/civisibility/integrations/gotesting: fixes for orchestrion autoinstrumentation #2844

Merged
merged 10 commits into from
Sep 12, 2024

Conversation

tonyredondo
Copy link
Member

@tonyredondo tonyredondo commented Sep 6, 2024

What does this PR do?

For orchestrion we are going to instrument testing.M.Run(), testing.T.Run() and testing.B.Run() methods, for that we need to make some fixes and add some checks to avoid multiple instrumentation over the same Func

This PR also fixes an issue found with orchestrion about Test Suite Level Visibility (tslv) objects having ParentId != 0 this breaks the backend json schema. Now we make sure that structs like Test, TestSuite, TestModule and TestSession never set the ParentId value (Only normal spans are allowed to have it).

Motivation

While working with the orchestrion autoinstrumentation I'm hitting this issues. This PR fixes those issues.

Reviewer's Checklist

  • Changed code has unit tests for its functionality at or near 100% coverage.
  • System-Tests covering this feature have been added and enabled with the va.b.c-dev version tag.
  • There is a benchmark for any new code, or changes to existing code.
  • If this interacts with the agent in a new way, a system test has been added.
  • Add an appropriate team label so this PR gets put in the right place for the release notes.
  • Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild.

Unsure? Have a question? Request a review!

@pr-commenter
Copy link

pr-commenter bot commented Sep 6, 2024

Benchmarks

Benchmark execution time: 2024-09-12 09:11:31

Comparing candidate commit 50434cc in PR branch tony/civisibility-orchestrion-fixes with baseline commit d1b31e8 in branch main.

Found 2 performance improvements and 0 performance regressions! Performance is the same for 56 metrics, 1 unstable metrics.

scenario:BenchmarkSetTagMetric-24

  • 🟩 execution_time [-6.513ns; -4.247ns] or [-5.317%; -3.467%]

scenario:BenchmarkSetTagString-24

  • 🟩 execution_time [-8.058ns; -5.682ns] or [-6.753%; -4.762%]

@tonyredondo tonyredondo force-pushed the tony/civisibility-orchestrion-fixes branch from f2eb2d2 to bf4fd9e Compare September 10, 2024 11:43
@tonyredondo tonyredondo marked this pull request as ready for review September 10, 2024 11:43
@tonyredondo tonyredondo requested review from a team as code owners September 10, 2024 11:43
@tonyredondo tonyredondo force-pushed the tony/civisibility-orchestrion-fixes branch from 83c07e4 to e32d8bb Compare September 11, 2024 08:23
…utoinstrumentation

For orchestrion we are going to instrument testing.M.Run(), testing.T.Run() and testing.B.Run() methods, for that we need to make some fixes and add some checks to avoid multiple instrumentation over the same Func
…d store the civisibility test from `testing.T` and/or `testing.common` both structs implements `testing.TB` we want to get always the same test no matter the struct used.
… if a ddtest has been failed or skipped so we can avoid rewriting existing useful messages by a generic one. The case of Error()/Errorf() calling Fail()/Failf() internally
… and ddTestItem.skipped bool type to an atomic.Int32 to avoid any race condition.
@tonyredondo tonyredondo force-pushed the tony/civisibility-orchestrion-fixes branch from c70e3af to d758e25 Compare September 11, 2024 13:37
… were caching the instrumented function from an original one, caching also the closure data of the function, now we don't catch the instrumented function. Also, added some tests to handle this scenario.
@tonyredondo tonyredondo force-pushed the tony/civisibility-orchestrion-fixes branch from d758e25 to 2246373 Compare September 11, 2024 14:00
Copy link
Contributor

@ManuelPalenzuelaDD ManuelPalenzuelaDD left a comment

Choose a reason for hiding this comment

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

LGTM, left a minor comment

internal/civisibility/integrations/gotesting/testingB.go Outdated Show resolved Hide resolved
@darccio darccio merged commit e1ca75f into main Sep 12, 2024
135 checks passed
@darccio darccio deleted the tony/civisibility-orchestrion-fixes branch September 12, 2024 09:32
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