groups:
  - id: metric.dotnet.process.cpu.count
    type: metric
    metric_name: dotnet.process.cpu.count
    brief: "The number of processors available to the process."
    note: >
      Meter name: `System.Runtime`; Added in: .NET 9.0.

      This metric reports the same values as accessing [`Environment.ProcessorCount`](https://learn.microsoft.com/dotnet/api/system.environment.processorcount).
    instrument: updowncounter
    unit: "{cpu}"
    stability: stable

  - id: metric.dotnet.process.cpu.time
    type: metric
    metric_name: dotnet.process.cpu.time
    brief: "CPU time used by the process."
    note: >
      Meter name: `System.Runtime`; Added in: .NET 9.0.

      This metric reports the same values as accessing the corresponding
      processor time properties on [`System.Diagnostics.Process`](https://learn.microsoft.com/dotnet/api/system.diagnostics.process).
    instrument: counter
    unit: "s"
    stability: stable
    attributes:
      - ref: cpu.mode
        requirement_level: required

  - id: metric.dotnet.process.memory.working_set
    type: metric
    metric_name: dotnet.process.memory.working_set
    brief: "The number of bytes of physical memory mapped to the process context."
    note: >
      Meter name: `System.Runtime`; Added in: .NET 9.0.

      This metric reports the same values as calling [`Environment.WorkingSet`](https://learn.microsoft.com/dotnet/api/system.environment.workingset).
    instrument: updowncounter
    unit: "By"
    stability: stable

  - id: metric.dotnet.gc.collections
    type: metric
    metric_name: dotnet.gc.collections
    brief: "The number of garbage collections that have occurred since the process has started."
    note: >
      Meter name: `System.Runtime`; Added in: .NET 9.0.

      This metric uses the [`GC.CollectionCount(int generation)`](https://learn.microsoft.com/dotnet/api/system.gc.collectioncount)
      API to calculate exclusive collections per generation.
    instrument: counter
    unit: "{collection}"
    stability: stable
    attributes:
      - ref: dotnet.gc.heap.generation
        requirement_level: required

  - id: metric.dotnet.gc.heap.total_allocated
    type: metric
    metric_name: dotnet.gc.heap.total_allocated
    brief: >
      The *approximate* number of bytes allocated on the managed GC heap since the process has
      started. The returned value does not include any native allocations.
    note: >
      Meter name: `System.Runtime`; Added in: .NET 9.0.

      This metric reports the same values as calling [`GC.GetTotalAllocatedBytes()`](https://learn.microsoft.com/dotnet/api/system.gc.gettotalallocatedbytes).
    instrument: counter
    unit: "By"
    stability: stable

  - id: metric.dotnet.gc.last_collection.memory.committed_size
    type: metric
    metric_name: dotnet.gc.last_collection.memory.committed_size
    brief: >
      The amount of committed virtual memory in use by the .NET GC, as
      observed during the latest garbage collection.
    note: >
      Meter name: `System.Runtime`; Added in: .NET 9.0.

      This metric reports the same values as calling
      [`GC.GetGCMemoryInfo().TotalCommittedBytes`](https://learn.microsoft.com/dotnet/api/system.gcmemoryinfo.totalcommittedbytes).
      Committed virtual memory may be larger than the heap size because it
      includes both memory for storing existing objects (the heap size) and some
      extra memory that is ready to handle newly allocated objects in the
      future.
    instrument: updowncounter
    unit: "By"
    stability: stable

  - id: metric.dotnet.gc.last_collection.heap.size
    type: metric
    metric_name: dotnet.gc.last_collection.heap.size
    brief: >
      The managed GC heap size (including fragmentation), as observed during the
      latest garbage collection.
    note: >
      Meter name: `System.Runtime`; Added in: .NET 9.0.

      This metric reports the same values as calling
      [`GC.GetGCMemoryInfo().GenerationInfo.SizeAfterBytes`](https://learn.microsoft.com/dotnet/api/system.gcgenerationinfo.sizeafterbytes).
    instrument: updowncounter
    unit: "By"
    stability: stable
    attributes:
      - ref: dotnet.gc.heap.generation
        requirement_level: required

  - id: metric.dotnet.gc.last_collection.heap.fragmentation.size
    type: metric
    metric_name: dotnet.gc.last_collection.heap.fragmentation.size
    brief: >
      The heap fragmentation, as observed during the latest garbage collection.
    note: >
      Meter name: `System.Runtime`; Added in: .NET 9.0.

      This metric reports the same values as calling
      [`GC.GetGCMemoryInfo().GenerationInfo.FragmentationAfterBytes`](https://learn.microsoft.com/dotnet/api/system.gcgenerationinfo.fragmentationafterbytes).
    instrument: updowncounter
    unit: "By"
    stability: stable
    attributes:
      - ref: dotnet.gc.heap.generation
        requirement_level: required

  - id: metric.dotnet.gc.pause.time
    type: metric
    metric_name: dotnet.gc.pause.time
    brief: "The total amount of time paused in GC since the process has started."
    note: >
      Meter name: `System.Runtime`; Added in: .NET 9.0.

      This metric reports the same values as calling [`GC.GetTotalPauseDuration()`](https://learn.microsoft.com/dotnet/api/system.gc.gettotalpauseduration).
    instrument: counter
    unit: "s"
    stability: stable

  - id: metric.dotnet.jit.compiled_il.size
    type: metric
    metric_name: dotnet.jit.compiled_il.size
    brief: "Count of bytes of intermediate language that have been compiled since the process has started."
    note: >
      Meter name: `System.Runtime`; Added in: .NET 9.0.

      This metric reports the same values as calling
      [`JitInfo.GetCompiledILBytes()`](https://learn.microsoft.com/dotnet/api/system.runtime.jitinfo.getcompiledilbytes).
    instrument: counter
    unit: "By"
    stability: stable

  - id: metric.dotnet.jit.compiled_methods
    type: metric
    metric_name: dotnet.jit.compiled_methods
    brief: >
      The number of times the JIT compiler (re)compiled methods since the
      process has started.
    note: >
      Meter name: `System.Runtime`; Added in: .NET 9.0.

      This metric reports the same values as calling
      [`JitInfo.GetCompiledMethodCount()`](https://learn.microsoft.com/dotnet/api/system.runtime.jitinfo.getcompiledmethodcount).
    instrument: counter
    unit: "{method}"
    stability: stable

  - id: metric.dotnet.jit.compilation.time
    type: metric
    metric_name: dotnet.jit.compilation.time
    brief: >
      The amount of time the JIT compiler has spent compiling methods since the
      process has started.
    note: >
      Meter name: `System.Runtime`; Added in: .NET 9.0.

      This metric reports the same values as calling
      [`JitInfo.GetCompilationTime()`](https://learn.microsoft.com/dotnet/api/system.runtime.jitinfo.getcompilationtime).
    instrument: counter
    unit: "s"
    stability: stable

  - id: metric.dotnet.monitor.lock_contentions
    type: metric
    metric_name: dotnet.monitor.lock_contentions
    brief: >
      The number of times there was contention when trying to acquire a monitor
      lock since the process has started.
    note: >
      Meter name: `System.Runtime`; Added in: .NET 9.0.

      This metric reports the same values as calling
      [`Monitor.LockContentionCount`](https://learn.microsoft.com/dotnet/api/system.threading.monitor.lockcontentioncount).
    instrument: counter
    unit: "{contention}"
    stability: stable

  - id: metric.dotnet.thread_pool.thread.count
    type: metric
    metric_name: dotnet.thread_pool.thread.count
    brief: "The number of thread pool threads that currently exist."
    note: >
      Meter name: `System.Runtime`; Added in: .NET 9.0.

      This metric reports the same values as calling [`ThreadPool.ThreadCount`](https://learn.microsoft.com/dotnet/api/system.threading.threadpool.threadcount).
    instrument: updowncounter
    unit: "{thread}"
    stability: stable

  - id: metric.dotnet.thread_pool.work_item.count
    type: metric
    metric_name: dotnet.thread_pool.work_item.count
    brief: >
      The number of work items that the thread pool has completed since
      the process has started.
    note: >
      Meter name: `System.Runtime`; Added in: .NET 9.0.

      This metric reports the same values as calling
      [`ThreadPool.CompletedWorkItemCount`](https://learn.microsoft.com/dotnet/api/system.threading.threadpool.completedworkitemcount).
    instrument: counter
    unit: "{work_item}"
    stability: stable

  - id: metric.dotnet.thread_pool.queue.length
    type: metric
    metric_name: dotnet.thread_pool.queue.length
    brief: >
      The number of work items that are currently queued to be processed by the
      thread pool.
    note: >
      Meter name: `System.Runtime`; Added in: .NET 9.0.

      This metric reports the same values as calling
      [`ThreadPool.PendingWorkItemCount`](https://learn.microsoft.com/dotnet/api/system.threading.threadpool.pendingworkitemcount).
    instrument: updowncounter
    unit: "{work_item}"
    stability: stable

  - id: metric.dotnet.timer.count
    type: metric
    metric_name: dotnet.timer.count
    brief: "The number of timer instances that are currently active."
    note: >
      Meter name: `System.Runtime`; Added in: .NET 9.0.

      This metric reports the same values as calling [`Timer.ActiveCount`](https://learn.microsoft.com/dotnet/api/system.threading.timer.activecount).
    instrument: updowncounter
    unit: "{timer}"
    stability: stable

  - id: metric.dotnet.assembly.count
    type: metric
    metric_name: dotnet.assembly.count
    brief: "The number of .NET assemblies that are currently loaded."
    note: >
      Meter name: `System.Runtime`; Added in: .NET 9.0.

      This metric reports the same values as calling
      [`AppDomain.CurrentDomain.GetAssemblies().Length`](https://learn.microsoft.com/dotnet/api/system.appdomain.getassemblies).
    instrument: updowncounter
    unit: "{assembly}"
    stability: stable

  - id: metric.dotnet.exceptions
    type: metric
    metric_name: dotnet.exceptions
    brief: "The number of exceptions that have been thrown in managed code."
    note: >
      Meter name: `System.Runtime`; Added in: .NET 9.0.

      This metric reports the same values as counting calls to
      [`AppDomain.CurrentDomain.FirstChanceException`](https://learn.microsoft.com/dotnet/api/system.appdomain.firstchanceexception).
    instrument: counter
    unit: "{exception}"
    stability: stable
    attributes:
      - ref: error.type
        note: ""
        examples: ['System.OperationCanceledException', 'Contoso.MyException']
        requirement_level: required
