Skip to content

Conversation

@dubloom
Copy link
Contributor

@dubloom dubloom commented Jan 12, 2026

Description

This PR implements this RFC for the tracing product.

Add process_tags in APM payload. According to the RFC, the tag _dd.tags.process is set in the first first span of each payload.

The set tag are:

  • entrypoint.workdir. The working dir name, should be the last path segment.
  • entrypoint.name. The entrypoint of the application. It is the the script name. Set to none if php is executed as an executable.
  • entrypoint.type. Either script or executable
  • entrypoint.basedir. The base dir is the directory where the called executable resides. Should be the last path segment.
  • runtime.sapi. The name of the SAPI in which PHP is run.

Reviewer checklist

  • Test coverage seems ok.
  • Appropriate labels assigned.

dubloom and others added 2 commits January 12, 2026 10:55
@datadog-datadog-prod-us1
Copy link

datadog-datadog-prod-us1 bot commented Jan 12, 2026

⚠️ Tests

Fix all issues with Cursor

⚠️ Warnings

🧪 1024 Tests failed

    testSearchPhpBinaries from integration.DDTrace\Tests\Integration\PHPInstallerTest (Fix with Cursor)

    testSimplePushAndProcess from laravel-58-test.DDTrace\Tests\Integrations\Laravel\V5_8\QueueTest (Fix with Cursor)

testSimplePushAndProcess from laravel-8x-test.DDTrace\Tests\Integrations\Laravel\V8_x\QueueTest (Datadog) (Fix with Cursor)
DDTrace\Tests\Integrations\Laravel\V8_x\QueueTest::testSimplePushAndProcess
Test code or tested code printed unexpected output: spanLinksTraceId: 69666e8f00000000c55f2c7bd8b9a6cc
tid: 69666e8f00000000
hexProcessTraceId: c55f2c7bd8b9a6cc
hexProcessSpanId: 093839a093202d86
processTraceId: 14222135058687960780
processSpanId: 664344306863058310
View all

ℹ️ Info

❄️ No new flaky tests detected

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 3a8038c | Docs | Datadog PR Page | Was this helpful? Give us feedback!

@codecov-commenter
Copy link

codecov-commenter commented Jan 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 62.01%. Comparing base (2c70c61) to head (3a8038c).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3566   +/-   ##
=======================================
  Coverage   62.01%   62.01%           
=======================================
  Files         140      140           
  Lines       13309    13309           
  Branches     1762     1762           
=======================================
  Hits         8253     8253           
  Misses       4268     4268           
  Partials      788      788           

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2c70c61...3a8038c. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dubloom dubloom changed the title Dubloom/process tags feat(process_tags): add process_tags to tracing payloads Jan 12, 2026
@dubloom dubloom marked this pull request as ready for review January 12, 2026 13:23
@dubloom dubloom requested review from a team as code owners January 12, 2026 13:23
Comment on lines 106 to 109
process_tag_entry_t* bigger_list = realloc(
process_tags.tag_list,
process_tags.capacity * sizeof(process_tag_entry_t)
);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
process_tag_entry_t* bigger_list = realloc(
process_tags.tag_list,
process_tags.capacity * sizeof(process_tag_entry_t)
);
process_tag_entry_t* bigger_list = perealloc(
process_tags.tag_list,
process_tags.capacity * sizeof(process_tag_entry_t),
1
);

Also at other places, use pemalloc(, 1), and pefree(, 1). (They ultimately call system malloc functions, but defer to PHPs handling for OOM.)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Then you can remove the if (!bigger_list) completely.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

addressed in 127c555


}

static void collect_process_tags(void) {
Copy link
Collaborator

@bwoebi bwoebi Jan 12, 2026

Choose a reason for hiding this comment

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

It is known and acknowledged, that for web requests, where multiple web applications are hosted on a single web server, or have multiple entrypoints, the values will always reflect the first request after process start (which may be distinct between different processes of the same webserver in multiprocessing mode - which is e.g. the default for FPM), given that they're collected in first rinit?
If yes, then it's fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

addressed in 127c555

@dubloom dubloom force-pushed the dubloom/process-tags branch from e6cb061 to 3a8038c Compare January 13, 2026 15:58
@dubloom dubloom requested a review from bwoebi January 13, 2026 16:27
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