From 53dcca8595d9e9eeefed07c383ee1297dbf69b4d Mon Sep 17 00:00:00 2001 From: Yun-Ting Lin Date: Tue, 8 Nov 2022 14:30:36 -0800 Subject: [PATCH 1/5] initial commit --- src/OpenTelemetry.Instrumentation.Process/ProcessMetrics.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OpenTelemetry.Instrumentation.Process/ProcessMetrics.cs b/src/OpenTelemetry.Instrumentation.Process/ProcessMetrics.cs index b67327dd43..7eae111791 100644 --- a/src/OpenTelemetry.Instrumentation.Process/ProcessMetrics.cs +++ b/src/OpenTelemetry.Instrumentation.Process/ProcessMetrics.cs @@ -53,7 +53,7 @@ public ProcessMetrics(ProcessInstrumentationOptions options) "process.memory.virtual", () => { - return Diagnostics.Process.GetCurrentProcess().PrivateMemorySize64; + return Diagnostics.Process.GetCurrentProcess().VirtualMemorySize64; }, unit: "By", description: "The amount of virtual memory allocated for this process that cannot be shared with other processes."); From 33723f29124b3d48cfbfb7283ddb3ebaabac6f4a Mon Sep 17 00:00:00 2001 From: Yun-Ting Date: Wed, 9 Nov 2022 11:25:21 -0800 Subject: [PATCH 2/5] doc --- src/OpenTelemetry.Instrumentation.Process/CHANGELOG.md | 4 ++++ .../ProcessMetrics.cs | 2 +- src/OpenTelemetry.Instrumentation.Process/README.md | 9 +++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/OpenTelemetry.Instrumentation.Process/CHANGELOG.md b/src/OpenTelemetry.Instrumentation.Process/CHANGELOG.md index 2daf411212..2b50d197a2 100644 --- a/src/OpenTelemetry.Instrumentation.Process/CHANGELOG.md +++ b/src/OpenTelemetry.Instrumentation.Process/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +* Update the .NET API used to retrieve `process.memory.virtual` metric to be + `Process.VirtualMemorySize64`. + ([#762](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/762)) + * Update OTel API version to be `1.4.0-beta.2` and change process metrics type from ObservableGauge to `ObservableUpDownCounter`. Updated instruments are: "process.memory.usage", "process.memory.virtual" and "process.threads". diff --git a/src/OpenTelemetry.Instrumentation.Process/ProcessMetrics.cs b/src/OpenTelemetry.Instrumentation.Process/ProcessMetrics.cs index 306fc44a4f..bb9efbef2d 100644 --- a/src/OpenTelemetry.Instrumentation.Process/ProcessMetrics.cs +++ b/src/OpenTelemetry.Instrumentation.Process/ProcessMetrics.cs @@ -54,7 +54,7 @@ public ProcessMetrics(ProcessInstrumentationOptions options) return Diagnostics.Process.GetCurrentProcess().VirtualMemorySize64; }, unit: "By", - description: "The amount of virtual memory allocated for this process that cannot be shared with other processes."); + description: "All the address space this process can read from without trigerring an access violation."); this.MeterInstance.CreateObservableCounter( "process.cpu.time", diff --git a/src/OpenTelemetry.Instrumentation.Process/README.md b/src/OpenTelemetry.Instrumentation.Process/README.md index b73b99e3d8..5e6ac8c263 100644 --- a/src/OpenTelemetry.Instrumentation.Process/README.md +++ b/src/OpenTelemetry.Instrumentation.Process/README.md @@ -61,8 +61,9 @@ allocated for the associated process. ### process.memory.virtual -The amount of virtual memory allocated for this process -that cannot be shared with other processes. +All the address space this process can read from without trigerring an access +violation; including memory backed solely by RAM, pagefile-backed memory and +file-backed memory. | Units | Instrument Type | Value Type | |-------|-------------------------|------------| @@ -70,8 +71,8 @@ that cannot be shared with other processes. The API used to retrieve the value is: -* [Process.WorkingSet64](https://learn.microsoft.com/dotnet/api/system.diagnostics.process.privatememorysize64): -Gets the amount of private memory, in bytes, +* [Process.VirtualMemorySize64](https://learn.microsoft.com/dotnet/api/system.diagnostics.process.virtualmemorysize64): +Gets the amount of the virtual memory, in bytes, allocated for the associated process. ### process.cpu.time From ec1b87f6de911f0a195a0cd5bf11b1f21d2ca1f9 Mon Sep 17 00:00:00 2001 From: Yun-Ting Lin Date: Thu, 10 Nov 2022 11:45:34 -0800 Subject: [PATCH 3/5] Apply suggestions from code review Co-authored-by: Noah Falk --- src/OpenTelemetry.Instrumentation.Process/ProcessMetrics.cs | 2 +- src/OpenTelemetry.Instrumentation.Process/README.md | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/OpenTelemetry.Instrumentation.Process/ProcessMetrics.cs b/src/OpenTelemetry.Instrumentation.Process/ProcessMetrics.cs index bb9efbef2d..b724c3d308 100644 --- a/src/OpenTelemetry.Instrumentation.Process/ProcessMetrics.cs +++ b/src/OpenTelemetry.Instrumentation.Process/ProcessMetrics.cs @@ -54,7 +54,7 @@ public ProcessMetrics(ProcessInstrumentationOptions options) return Diagnostics.Process.GetCurrentProcess().VirtualMemorySize64; }, unit: "By", - description: "All the address space this process can read from without trigerring an access violation."); + description: "The amount of committed virtual memory for this process."); this.MeterInstance.CreateObservableCounter( "process.cpu.time", diff --git a/src/OpenTelemetry.Instrumentation.Process/README.md b/src/OpenTelemetry.Instrumentation.Process/README.md index 5e6ac8c263..44693f1f10 100644 --- a/src/OpenTelemetry.Instrumentation.Process/README.md +++ b/src/OpenTelemetry.Instrumentation.Process/README.md @@ -61,7 +61,8 @@ allocated for the associated process. ### process.memory.virtual -All the address space this process can read from without trigerring an access +The amount of committed virtual memory for this process. +One way to think of this is all the address space this process can read from without trigerring an access violation; including memory backed solely by RAM, pagefile-backed memory and file-backed memory. From 4c4fb8c63fd4ba916a2985931c076272e47cf00c Mon Sep 17 00:00:00 2001 From: Yun-Ting Date: Thu, 10 Nov 2022 12:45:46 -0800 Subject: [PATCH 4/5] lint --- src/OpenTelemetry.Instrumentation.Process/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/OpenTelemetry.Instrumentation.Process/README.md b/src/OpenTelemetry.Instrumentation.Process/README.md index 44693f1f10..2bc94ec264 100644 --- a/src/OpenTelemetry.Instrumentation.Process/README.md +++ b/src/OpenTelemetry.Instrumentation.Process/README.md @@ -62,9 +62,9 @@ allocated for the associated process. ### process.memory.virtual The amount of committed virtual memory for this process. -One way to think of this is all the address space this process can read from without trigerring an access -violation; including memory backed solely by RAM, pagefile-backed memory and -file-backed memory. +One way to think of this is all the address space this process can read from +without trigerring an access violation; including memory backed solely by RAM, +pagefile-backed memory and file-backed memory. | Units | Instrument Type | Value Type | |-------|-------------------------|------------| From d07991d8c44d8274c980864626231c8b38436e1a Mon Sep 17 00:00:00 2001 From: Yun-Ting Lin Date: Fri, 11 Nov 2022 13:10:12 -0800 Subject: [PATCH 5/5] Apply suggestions from code review Co-authored-by: Utkarsh Umesan Pillai --- src/OpenTelemetry.Instrumentation.Process/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/OpenTelemetry.Instrumentation.Process/README.md b/src/OpenTelemetry.Instrumentation.Process/README.md index 2bc94ec264..6d3562b42a 100644 --- a/src/OpenTelemetry.Instrumentation.Process/README.md +++ b/src/OpenTelemetry.Instrumentation.Process/README.md @@ -63,8 +63,8 @@ allocated for the associated process. The amount of committed virtual memory for this process. One way to think of this is all the address space this process can read from -without trigerring an access violation; including memory backed solely by RAM, -pagefile-backed memory and file-backed memory. +without trigerring an access violation; this includes memory backed solely by RAM, +by a swapfile/pagefile and by other mapped files on disk. | Units | Instrument Type | Value Type | |-------|-------------------------|------------|