Skip to content

[Resources.Process] Add process.creation.time#4036

Merged
martincostello merged 13 commits into
open-telemetry:mainfrom
martincostello:gh-1515
May 6, 2026
Merged

[Resources.Process] Add process.creation.time#4036
martincostello merged 13 commits into
open-telemetry:mainfrom
martincostello:gh-1515

Conversation

@martincostello

@martincostello martincostello commented Mar 29, 2026

Copy link
Copy Markdown
Member

Contributes to #1515.

Changes

Collect new attribute based on v1.41.0 of the semantic conventions:

  • process.args_count
  • process.command
  • process.creation.time
  • process.executable.path
  • process.title
  • process.working_directory

Based on Selecting process attributes, I went with process.executable.path as it can be used to derive process.executable.name, and process.args_count so that we do not need to implement redaction for process.command_line and/or process.command_args.

Merge requirement checklist

  • CONTRIBUTING guidelines followed (license requirements, nullable enabled, static analysis, etc.)
  • Unit tests added/updated
  • Appropriate CHANGELOG.md files updated for non-trivial changes
  • Changes in public API reviewed (if applicable)

@github-actions github-actions Bot added the comp:resources.process Things related to OpenTelemetry.Resources.Process label Mar 29, 2026
@codecov

codecov Bot commented Mar 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.50000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.47%. Comparing base (26a1dc7) to head (b522dc6).
⚠️ Report is 7 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...OpenTelemetry.Resources.Process/ProcessDetector.cs 87.50% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4036      +/-   ##
==========================================
- Coverage   76.04%   73.47%   -2.58%     
==========================================
  Files         466      454      -12     
  Lines       18695    17588    -1107     
==========================================
- Hits        14217    12922    -1295     
- Misses       4478     4666     +188     
Flag Coverage Δ
unittests-Instrumentation.Cassandra ?
unittests-Resources.Process 90.47% <87.50%> (-9.53%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...OpenTelemetry.Resources.Process/ProcessDetector.cs 89.47% <87.50%> (-10.53%) ⬇️

... and 110 files with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@martincostello
martincostello marked this pull request as ready for review March 29, 2026 15:11
@martincostello
martincostello requested a review from a team as a code owner March 29, 2026 15:11
Copilot AI review requested due to automatic review settings March 29, 2026 15:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds additional OpenTelemetry process resource attributes to align OpenTelemetry.Resources.Process with semantic conventions v1.40.0.

Changes:

  • Add semantic convention keys for process.executable.path and process.args_count.
  • Extend ProcessDetector to emit executable path and argument count attributes.
  • Update unit test to assert the presence/types of the new attributes and bump expected attribute count.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
test/OpenTelemetry.Resources.Process.Tests/ProcessDetectorTests.cs Updates assertions to cover the two new process attributes.
src/OpenTelemetry.Resources.Process/ProcessSemanticConventions.cs Adds constants for the new semantic convention attribute names.
src/OpenTelemetry.Resources.Process/ProcessDetector.cs Implements collection of executable path and args count.
src/OpenTelemetry.Resources.Process/CHANGELOG.md Documents the new attributes (currently with a placeholder PR link).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/OpenTelemetry.Resources.Process/ProcessDetector.cs Outdated
Comment thread src/OpenTelemetry.Resources.Process/ProcessDetector.cs Outdated
Comment thread src/OpenTelemetry.Resources.Process/ProcessDetector.cs Outdated
Comment thread src/OpenTelemetry.Resources.Process/CHANGELOG.md Outdated
Comment thread src/OpenTelemetry.Resources.Process/ProcessDetector.cs Outdated
@Kielek

Kielek commented Apr 7, 2026

Copy link
Copy Markdown
Member

@martincostello, can you check executing this detector with ./MyApp vs dotnet MyApp.dll?
Are the attributes correct for both cases?

@martincostello

martincostello commented Apr 7, 2026

Copy link
Copy Markdown
Member Author

These are the results. Looks like process.command is wrong, and thus process.args_count.

dotnet run

process.owner=marti
process.pid=176192
process.working_directory=D:\Coding\open-telemetry\opentelemetry-dotnet-contrib\examples\process-instrumentation
process.creation.time=2026-04-07T11:00:22.4389323+01:00
process.command=D:\Coding\open-telemetry\opentelemetry-dotnet-contrib\artifacts\bin\process-instrumentation\debug\process-instrumentation.dll
process.args_count=0
process.executable.path=D:\Coding\open-telemetry\opentelemetry-dotnet-contrib\artifacts\bin\process-instrumentation\debug\process-instrumentation.exe
telemetry.sdk.name=opentelemetry
telemetry.sdk.language=dotnet
telemetry.sdk.version=1.15.1
service.name=unknown_service:process-instrumentation

dotnet foo.dll

process.owner=marti
process.pid=148100
process.working_directory=D:\Coding\open-telemetry\opentelemetry-dotnet-contrib\artifacts\bin\process-instrumentation\debug
process.creation.time=2026-04-07T11:00:02.6171738+01:00
process.command=D:\Coding\open-telemetry\opentelemetry-dotnet-contrib\artifacts\bin\process-instrumentation\debug\process-instrumentation.dll
process.args_count=0
process.executable.path=C:\Program Files\dotnet\dotnet.exe
telemetry.sdk.name=opentelemetry
telemetry.sdk.language=dotnet
telemetry.sdk.version=1.15.1
service.name=unknown_service:dotnet

foo.exe

process.owner=marti
process.pid=177708
process.working_directory=D:\Coding\open-telemetry\opentelemetry-dotnet-contrib\artifacts\bin\process-instrumentation\debug
process.creation.time=2026-04-07T10:59:42.2029624+01:00
process.command=D:\Coding\open-telemetry\opentelemetry-dotnet-contrib\artifacts\bin\process-instrumentation\debug\process-instrumentation.dll
process.args_count=0
process.executable.path=D:\Coding\open-telemetry\opentelemetry-dotnet-contrib\artifacts\bin\process-instrumentation\debug\process-instrumentation.exe
telemetry.sdk.name=opentelemetry
telemetry.sdk.language=dotnet
telemetry.sdk.version=1.15.1
service.name=unknown_service:process-instrumentation

@martincostello

Copy link
Copy Markdown
Member Author

@Kielek I removed process.command.

@Kielek
Kielek requested a review from lachmatt April 7, 2026 10:22
Collect the `process.executable.path` and `process.args_count` attributes.

Contributes to open-telemetry#1515.
- Add `process.command`.
- Add `process.creation.time`.
- Add `process.title`.
- Add `process.working_directory`.
- Address review comments.
Improve fallback behaviour for getting the process' path.
Fix incorrect variable being used.
`process.command` isn't reliable with the different modes of executing modern .NET processes.
@github-actions

Copy link
Copy Markdown
Contributor

This PR was marked stale due to lack of activity. It will be closed in 7 days.

@github-actions github-actions Bot added the Stale label Apr 17, 2026
@martincostello martincostello added keep-open Prevents issues and pull requests being closed as stale and removed Stale labels Apr 17, 2026
@lachmatt

lachmatt commented May 5, 2026

Copy link
Copy Markdown
Contributor

@martincostello it seems requirement level recently changed for some of the attributes this PR adds: https://github.com/open-telemetry/semantic-conventions/blob/v1.41.0/docs/resource/process.md
Can you take a look and update it accordingly?

Update changes to target Semantic Conventions v1.41.0.
Previous testing showed the value not to be reliable. As it isn't required, just recommended, removing for now.
Leftover from previous commit.
@martincostello martincostello changed the title [Resources.Process] Add new attributes [Resources.Process] Add process.creation.time May 5, 2026
@martincostello

Copy link
Copy Markdown
Member Author

@lachmatt Done - this reduces the PR to just adding process.creation.time.

Comment thread src/OpenTelemetry.Resources.Process/ProcessDetector.cs Outdated
Comment thread src/OpenTelemetry.Resources.Process/ProcessSemanticConventions.cs Outdated
Comment thread src/OpenTelemetry.Resources.Process/CHANGELOG.md
- Remove leftovers from v1.40.0.
- Update README.
@martincostello
martincostello enabled auto-merge May 6, 2026 09:11
@martincostello
martincostello added this pull request to the merge queue May 6, 2026
@Kielek Kielek removed the keep-open Prevents issues and pull requests being closed as stale label May 6, 2026
Merged via the queue into open-telemetry:main with commit c484108 May 6, 2026
71 checks passed
@martincostello
martincostello deleted the gh-1515 branch May 6, 2026 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp:resources.process Things related to OpenTelemetry.Resources.Process

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants