Skip to content

Commit

Permalink
update init values
Browse files Browse the repository at this point in the history
  • Loading branch information
Yun-Ting committed Oct 14, 2022
1 parent 8e08e37 commit d25e0b7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/OpenTelemetry.Instrumentation.Process/ProcessMetrics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,16 @@ internal sealed class ProcessMetrics
private IEnumerable<Measurement<double>> cpuUtilization;

// vars for calculating CPU utilization
private DateTime lastCollectedTimeStampUtc = DateTime.UtcNow;
private DateTime lastCollectedTimeStampUtc;
private double lastCollectedUserProcessorTime;
private double lastCollectedPrivilegedProcessorTime;

public ProcessMetrics(ProcessInstrumentationOptions options)
{
this.lastCollectedTimeStampUtc = DateTime.UtcNow;
this.lastCollectedUserProcessorTime = this.currentProcess.UserProcessorTime.TotalSeconds;
this.lastCollectedUserProcessorTime = this.currentProcess.PrivilegedProcessorTime.TotalSeconds;

// TODO: change to ObservableUpDownCounter
this.MeterInstance.CreateObservableGauge(
"process.memory.usage",
Expand Down

0 comments on commit d25e0b7

Please sign in to comment.