Skip to content

Conversation

wconti27
Copy link
Contributor

@wconti27 wconti27 commented Sep 30, 2025

What does this PR do?

DRAFT DO NOT MERGE: PR just shows possible tooling examples / changes to instrumentations / plugins to create integrations faster.

New Ideas Added to dd-trace-js:

  • declarative instrumentation: similar to orchestrion JS but actually works. creates wrappers for an instrumentation given an orchestrion config object
  • declarative plugin: given an extended orchestrion config object, makes a plugin at runtime using factories, and subscribes to related channels
  • base test classes Test cases broken up by integration class that all integrations of that class should run
  • test scaffolder Create tests, with all setup, tracer import, agent setup abstracted behind a factory function.

PR Also includes:

  • example bullmq integration written by apm-mcp tooling

APM MCP Tooling (what was used to generate this integration), can be found here

Tooling Workflow

  • dd-apm-analyze [NOT IMPLEMENTED YET]: analyzes source code to find instrumentation targets, engineer selects methods of interest to wrap, and type of wrapping (traceAsync, traceSync, traceCallback, etc) and orchestrion config is outputted
  • dd-scaffold: creates all boilerplate code necessary for a new integration:
    • all docs files
    • CI job added
    • plugin / hooks registration
    • test files
    • ts file changes
  • dd-populate-sample-app: populates a very rudimentary sample app within datadog-plugin-[pkg]/test/app/sample-app.js that labels what methods need to be implemented (pulls in APM data semantics by class of integration to list methods that should be required / optional by that type of integration, ie: database integration has a query function implemented in the app, optionally has a connect function added, which will then be traced later.)
image
  • dd-context-capture: Using the working sample app, generates temporary wrappers during runtime for all methods that are to be instrumented per the orchestrion config outputted by dd-apm-analyze. These generated wrappers capture the runtime context available within that traced function, such as this and arguments, and the shape of those objects (fields, class, etc). Outputs a json file of available context per wrapped method.
  • dd-map-interactive: Pulls in the orchestrion config, along with captured context by method chosen for tracing, and the APM data semantics for that class of integration, containing which tags are required / optional for the operation. Opens a Terminal User Interface that allows an engineer to map captured context / attributes to the relevant tag. IE: arg[0] maps to database.name.
image
  • dd-compile: Given orchestrion config, mapping of available context to span tags for each function to be traced, generate the remaining instrumentation and plugin files.

Motivation

Plugin Checklist

Additional Notes

@pr-commenter
Copy link

pr-commenter bot commented Sep 30, 2025

Benchmarks

Benchmark execution time: 2025-09-30 22:07:42

Comparing candidate commit fa9baf7 in PR branch conti/mcp-server with baseline commit 820f59b in branch master.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 1685 metrics, 79 unstable metrics.

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