Skip to content

feat(sparkjava-2.3): toolkit-generated sparkjava-2.3 [DO NOT MERGE]#11708

Draft
jordan-wong wants to merge 6 commits into
masterfrom
eval/sparkjava-2.3-rebase-20260623
Draft

feat(sparkjava-2.3): toolkit-generated sparkjava-2.3 [DO NOT MERGE]#11708
jordan-wong wants to merge 6 commits into
masterfrom
eval/sparkjava-2.3-rebase-20260623

Conversation

@jordan-wong

Copy link
Copy Markdown
Contributor

Summary

Rebased toolkit-generated sparkjava-2.3 instrumentation onto current master to fix stale-base CI drift on PR #11562. Single squashed commit, sparkjava-2.3 module only.

Why this PR

PR #11562 sits on a branch ~200+ commits behind current master, which causes dd-gitlab/build_tests: [:instrumentationLatestDepTest, latestdep] to fail intermittently due to unrelated drift — not a sparkjava code defect. Running the exact same Gradle command against PR #11562's HEAD locally passes.

This PR rebases the toolkit-generated work onto current master so CI runs against a clean base.

What's in this PR

Only the toolkit-generated sparkjava-2.3 work — nothing else from #11562's branch:

  • SparkJavaDecorator.java (new)
  • RoutesInstrumentation.java updated (Routes.find advice)
  • SparkJavaTest.java, SparkJavaForkedTest.java — Java tests (per R20: no Groovy in toolkit-generated tests)
  • build.gradle updated for the module structure
  • Removed: old gradle.lockfile, SparkJavaBasedTest.groovy, TestSparkJavaApplication.java (replaced by Java equivalents)

What's NOT in this PR (intentionally dropped)

Next step

If CI is green on this branch, close #11562 as superseded. Keeping #11562 open until then so reviewers have continuity.

🤖 Generated with Claude Code

…[DO NOT MERGE]

Rebased onto current master to fix the stale-base CI failures on PR #11562.

This branch contains only the toolkit-generated sparkjava-2.3 work:
- SparkJavaDecorator, RoutesInstrumentation (with Routes.find advice)
- SparkJavaTest, SparkJavaForkedTest (Java tests per R20)
- build.gradle updated for the generated module structure
- Old groovy test + TestSparkJavaApplication + stale gradle.lockfile removed (toolkit produces Java tests only)

Supersedes #11562. The supported-configurations.json fix from #11562 is no longer needed — master already has the SPARKJAVA env var entries.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@datadog-datadog-prod-us1-2

This comment has been minimized.

Adds the three integration config entries needed for the new sparkjava-2.3 module:
- DD_TRACE_SPARKJAVA_2_3_ENABLED (for super("sparkjava-2.3") in RoutesInstrumentation)
- DD_TRACE_SPARKJAVA_ANALYTICS_ENABLED (for decorator instrumentationNames() -> "sparkjava")
- DD_TRACE_SPARKJAVA_ANALYTICS_SAMPLE_RATE (same)

Fixes the config-inversion-linter CI job on this PR.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dd-octo-sts

dd-octo-sts Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

🟢 Java Benchmark SLOs — All performance SLOs passed

Suite Status
Startup 🟢 pass

SLO thresholds are defined here based on automatically generated metrics. A warning is raised when results are within 5% of the threshold.

PR vs. master results
Scenario Candidate master Δ (95% CI of mean)
startup:insecure-bank:iast:Agent 13.94 s 13.98 s [-1.1%; +0.5%] (no difference)
startup:insecure-bank:tracing:Agent 12.95 s 12.98 s [-1.0%; +0.6%] (no difference)
startup:petclinic:appsec:Agent 16.80 s 16.60 s [+0.2%; +2.2%] (maybe worse)
startup:petclinic:iast:Agent 16.48 s 16.20 s [-4.6%; +8.0%] (unstable)
startup:petclinic:profiling:Agent 16.80 s 16.87 s [-1.7%; +0.8%] (no difference)
startup:petclinic:sca:Agent 16.76 s 16.68 s [-0.6%; +1.6%] (no difference)
startup:petclinic:tracing:Agent 15.62 s 16.07 s [-6.9%; +1.3%] (no difference)

Commit: 2c372a3c · CI Pipeline · Benchmarking Platform UI


Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion.

… 'double')

dd-trace-java's supported-configurations.json schema uses 'decimal' for
double-precision floats; 'double' fails the validate_supported_configurations_v2
GitLab CI check. Matches existing AKKA_HTTP_ANALYTICS_SAMPLE_RATE and other
analytics-rate entries.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jordan-wong jordan-wong changed the title feat(sparkjava-2.3): toolkit-generated sparkjava-2.3 [DO NOT MERGE — supersedes #11562] feat(sparkjava-2.3): toolkit-generated sparkjava-2.3 [DO NOT MERGE] Jun 23, 2026
jordan-wong and others added 3 commits June 23, 2026 23:23
…_file validator

Three coordinated changes:

1. super('sparkjava', 'sparkjava-2.4') in RoutesInstrumentation
   (was 'sparkjava-2.3'). Matches master's existing module exactly. Master's
   DD_TRACE_SPARKJAVA_2_4_* entries already exist in the central feature-parity
   registry, so no new registry registration is needed.

2. Remove SparkJavaDecorator.java entirely.
   Its only function was providing a 'sparkjava' instrumentationName + a SPARK_JAVA
   component constant + a SPARK_REQUEST spanName constant. Master doesn't have a
   sparkjava-specific decorator; it just calls HTTP_RESOURCE_DECORATOR.withRoute(...).
   Moved the SPARK_JAVA and SPARK_REQUEST constants inline into RoutesAdvice.
   The decorator's instrumentationNames() was triggering a checkDecoratorAnalyticsConfigurations
   requirement for DD_TRACE_SPARKJAVA_ANALYTICS_* entries that don't exist in the registry.

3. Remove DD_TRACE_SPARKJAVA_2_3_ENABLED, DD_TRACE_SPARKJAVA_ANALYTICS_ENABLED,
   DD_TRACE_SPARKJAVA_ANALYTICS_SAMPLE_RATE from metadata/supported-configurations.json.
   Master's existing DD_TRACE_SPARKJAVA_2_4_ENABLED + DD_TRACE_SPARKJAVA_ENABLED
   cover the integration names this PR now uses.

Local verification BUILD SUCCESSFUL:
- ./gradlew checkConfigurations
- ./gradlew :dd-java-agent:instrumentation:spark:sparkjava-2.3:compileTestJava
- ./gradlew spotlessCheck

This should clear validate_supported_configurations_v2_local_file CI failure.

Research finding: the toolkit's extra structure (decorator + analytics requirement)
creates a registry-registration dependency that doesn't exist on master. When master's
existing module uses HTTP_RESOURCE_DECORATOR directly, regenerated modules should too.
Documented in eval-research/hypotheses/sparkjava.md.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… muzzle

Muzzle failed AssertPass for spark-core 2.3, 2.6.0, 2.7.2, 2.9.4 with:
  FAILED MUZZLE VALIDATION: datadog.trace.instrumentation.sparkjava.RoutesInstrumentation mismatches:
  Missing class datadog.trace.instrumentation.sparkjava.RoutesInstrumentation$RoutesAdvice

ByteBuddy advice classes get inlined into the target library's classes at
runtime. Static fields referencing the agent's UTF8BytesString class cause
muzzle to flag the advice as 'Missing class' from the target library's
classpath perspective.

Removed two static fields (SPARK_JAVA, SPARK_REQUEST) from RoutesAdvice and the
two enrichment statements that used them (span.setSpanName, span.setTag).
The instrumentation now matches master's RoutesAdvice exactly — only
HTTP_RESOURCE_DECORATOR.withRoute(...) is called.

Local verification BUILD SUCCESSFUL:
  ./gradlew :dd-java-agent:instrumentation:spark:sparkjava-2.3:muzzle

Research finding: toolkit-generated advice classes that add static field
constants violate muzzle constraints. Encode as R-rule: 'Advice classes must
not declare static or instance fields; constants must live on a helper class
referenced via helperClassNames()'.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…vaNaming helper

Previous commit removed SPARK_JAVA/SPARK_REQUEST constants entirely to satisfy
muzzle, but broke 68 tests (SparkJavaTest + SparkJavaForkedTest) that assert
on the enrichment tags (span name 'spark.request', component 'spark-java').

Correct fix: put constants on a separate helper class registered via
helperClassNames(). Muzzle understands helper classes as part of the agent's
classpath (not the target library's), so static fields on them are fine.

Created SparkJavaNaming.java with public static final CharSequence SPARK_JAVA
and SPARK_REQUEST. Restored the two enrichment statements in RoutesAdvice
using SparkJavaNaming.SPARK_REQUEST and SparkJavaNaming.SPARK_JAVA.

Added helperClassNames() override in RoutesInstrumentation pointing to
SparkJavaNaming.

Local verification BUILD SUCCESSFUL: muzzle, spotbugsMain, checkConfigurations,
spotlessCheck.

Research finding: toolkit-generated Advice classes that need constants from
agent classpath should put them on a separate helper class registered via
helperClassNames(), NOT as inline static fields and NOT on a BaseDecorator
subclass (which triggers checkDecoratorAnalyticsConfigurations). A minimal
naming-only helper avoids both pitfalls.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant