-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add experimental go runtime metrics semantic conventions
- Loading branch information
Showing
4 changed files
with
281 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Use this changelog template to create an entry for release notes. | ||
# | ||
# If your change doesn't affect end users you should instead start | ||
# your pull request title with [chore] or use the "Skip Changelog" label. | ||
|
||
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' | ||
change_type: new_component | ||
|
||
# The name of the area of concern in the attributes-registry, (e.g. http, cloud, db) | ||
component: go | ||
|
||
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). | ||
note: Add new go namespace for Go runtime metrics | ||
|
||
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. | ||
# The values here must be integers. | ||
issues: [535] | ||
|
||
# (Optional) One or more lines of additional information to render under the primary note. | ||
# These lines will be padded with 2 spaces and then inserted directly into the document. | ||
# Use pipe (|) for multiline entries. | ||
subtext: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,171 @@ | ||
<!--- Hugo front matter used to generate the website version of this page: | ||
linkTitle: Go Runtime | ||
---> | ||
|
||
# Semantic Conventions for Go Runtime Metrics | ||
|
||
**Status**: [Experimental][DocumentStatus] | ||
|
||
This document describes semantic conventions for Go runtime metrics in OpenTelemetry. | ||
|
||
<!-- Re-generate TOC with `markdown-toc --no-first-h1 -i` --> | ||
|
||
<!-- toc --> | ||
|
||
- [Go Memory](#go-memory) | ||
- [Metric: `go.memory.used`](#metric-gomemoryused) | ||
- [Metric: `go.memory.limit`](#metric-gomemorylimit) | ||
- [Metric: `go.memory.allocated`](#metric-gomemoryallocated) | ||
- [Metric: `go.memory.allocations`](#metric-gomemoryallocations) | ||
- [Go Garbage Collection](#go-garbage-collection) | ||
- [Metric: `go.memory.gc.target`](#metric-gomemorygctarget) | ||
- [Metric: `go.memory.gc.user_target`](#metric-gomemorygcuser_target) | ||
- [Go Threads](#go-threads) | ||
- [Metric: `go.thread.limit`](#metric-gothreadlimit) | ||
- [Go Scheduler](#go-scheduler) | ||
- [Metric: `go.schedule.duration`](#metric-goscheduleduration) | ||
|
||
<!-- tocstop --> | ||
|
||
## Go Memory | ||
|
||
**Description:** Go runtime metrics captured under the namespace `go.memory.*` | ||
|
||
### Metric: `go.memory.used` | ||
|
||
This metric is [recommended][MetricRecommended]. | ||
This metric is obtained from Go's [`runtime/metrics`][RuntimeMetrics] package using `/memory/classes` metrics. | ||
|
||
<!-- semconv metric.go.memory.used(metric_table) --> | ||
| Name | Instrument Type | Unit (UCUM) | Description | Stability | | ||
| -------- | --------------- | ----------- | -------------- | --------- | | ||
| `go.memory.used` | UpDownCounter | `By` | Virtual memory mapped by the Go runtime. | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | ||
<!-- endsemconv --> | ||
|
||
<!-- semconv metric.go.memory.used(full) --> | ||
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability | | ||
|---|---|---|---|---|---| | ||
| `type` | string | The type of memory. | `released`; `stack` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | ||
|
||
`type` MUST be one of the following: | ||
|
||
| Value | Description | Stability | | ||
|---|---|---| | ||
| `released` | Memory that is completely free and has been returned to the underlying system. | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | ||
| `stack` | Memory allocated from the heap that is reserved for stack space, whether or not it is currently in-use. | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | ||
| `other` | All memory mapped by the Go runtime into the current process as read-write, excluding other categories of memory usage. | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | ||
<!-- endsemconv --> | ||
|
||
### Metric: `go.memory.limit` | ||
|
||
This metric is [recommended][MetricRecommended]. | ||
This metric is obtained from Go's [`runtime/metrics`][RuntimeMetrics] package using `/gc/gomemlimit:bytes`. | ||
|
||
<!-- semconv metric.go.memory.limit(metric_table) --> | ||
| Name | Instrument Type | Unit (UCUM) | Description | Stability | | ||
| -------- | --------------- | ----------- | -------------- | --------- | | ||
| `go.memory.limit` | UpDownCounter | `By` | Go runtime memory limit configured by the user, otherwise math.MaxInt64. | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | ||
<!-- endsemconv --> | ||
|
||
<!-- semconv metric.go.memory.limit(full) --> | ||
<!-- endsemconv --> | ||
|
||
### Metric: `go.memory.allocated` | ||
|
||
This metric is [recommended][MetricRecommended]. | ||
This metric is obtained from Go's [`runtime/metrics`][RuntimeMetrics] package using `/gc/heap/allocs:bytes`. | ||
|
||
<!-- semconv metric.go.memory.allocated(metric_table) --> | ||
| Name | Instrument Type | Unit (UCUM) | Description | Stability | | ||
| -------- | --------------- | ----------- | -------------- | --------- | | ||
| `go.memory.allocated` | Counter | `By` | Memory allocated to the heap by the application. | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | ||
<!-- endsemconv --> | ||
|
||
<!-- semconv metric.go.memory.allocated(full) --> | ||
<!-- endsemconv --> | ||
|
||
### Metric: `go.memory.allocations` | ||
|
||
This metric is [recommended][MetricRecommended]. | ||
This metric is obtained from Go's [`runtime/metrics`][RuntimeMetrics] package using `/gc/heap/allocs:objects`. | ||
|
||
<!-- semconv metric.go.memory.allocations(metric_table) --> | ||
| Name | Instrument Type | Unit (UCUM) | Description | Stability | | ||
| -------- | --------------- | ----------- | -------------- | --------- | | ||
| `go.memory.allocations` | Counter | `{allocation}` | Count of allocations to the heap by the application. | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | ||
<!-- endsemconv --> | ||
|
||
<!-- semconv metric.go.memory.allocations(full) --> | ||
<!-- endsemconv --> | ||
|
||
## Go Garbage Collection | ||
|
||
**Description:** Go metrics captured under the namespace `go.memory.gc.*` | ||
|
||
### Metric: `go.memory.gc.target` | ||
|
||
This metric is [recommended][MetricRecommended]. | ||
This metric is obtained from Go's [`runtime/metrics`][RuntimeMetrics] package using `/gc/heap/goal:bytes`. | ||
|
||
<!-- semconv metric.go.memory.gc.target(metric_table) --> | ||
| Name | Instrument Type | Unit (UCUM) | Description | Stability | | ||
| -------- | --------------- | ----------- | -------------- | --------- | | ||
| `go.memory.gc.target` | UpDownCounter | `By` | Heap size target for the end of the GC cycle. | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | ||
<!-- endsemconv --> | ||
|
||
<!-- semconv metric.go.memory.gc.target(full) --> | ||
<!-- endsemconv --> | ||
|
||
### Metric: `go.memory.gc.user_target` | ||
|
||
This metric is [recommended][MetricRecommended]. | ||
This metric is obtained from Go's [`runtime/metrics`][RuntimeMetrics] package using `/gc/gogc:percent`. | ||
|
||
<!-- semconv metric.go.memory.gc.user_target(metric_table) --> | ||
| Name | Instrument Type | Unit (UCUM) | Description | Stability | | ||
| -------- | --------------- | ----------- | -------------- | --------- | | ||
| `go.memory.gc.user_target` | UpDownCounter | `By` | Heap size target percentage for the end of the GC cycle, as configured by the user. | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | ||
<!-- endsemconv --> | ||
|
||
<!-- semconv metric.go.memory.gc.user_target(full) --> | ||
<!-- endsemconv --> | ||
|
||
## Go Threads | ||
|
||
**Description:** Go metrics captured under the namespace `go.thread.*` | ||
|
||
### Metric: `go.thread.limit` | ||
|
||
This metric is [recommended][MetricRecommended]. | ||
This metric is obtained from Go's [`runtime/metrics`][RuntimeMetrics] package `/sched/gomaxprocs:threads`. | ||
|
||
<!-- semconv metric.go.thread.limit(metric_table) --> | ||
| Name | Instrument Type | Unit (UCUM) | Description | Stability | | ||
| -------- | --------------- | ----------- | -------------- | --------- | | ||
| `go.thread.limit` | UpDownCounter | `{thread}` | The number of OS threads that can execute user-level Go code simultaneously. | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | ||
<!-- endsemconv --> | ||
|
||
<!-- semconv metric.go.thread.limit(full) --> | ||
<!-- endsemconv --> | ||
|
||
## Go Scheduler | ||
|
||
**Description:** Go metrics captured under the namespace `go.schedule.*` | ||
|
||
### Metric: `go.schedule.duration` | ||
|
||
This metric is [recommended][MetricRecommended]. | ||
This metric is obtained from Go's [`runtime/metrics`][RuntimeMetrics] package `/sched/latencies:seconds`. | ||
|
||
<!-- semconv metric.go.schedule.duration(metric_table) --> | ||
| Name | Instrument Type | Unit (UCUM) | Description | Stability | | ||
| -------- | --------------- | ----------- | -------------- | --------- | | ||
| `go.schedule.duration` | Histogram | `s` | The time goroutines have spent in the scheduler in a runnable state before actually running. | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | ||
<!-- endsemconv --> | ||
|
||
<!-- semconv metric.go.schedule.duration(full) --> | ||
<!-- endsemconv --> | ||
|
||
[DocumentStatus]: https://github.com/open-telemetry/opentelemetry-specification/tree/v1.31.0/specification/document-status.md | ||
[MetricRecommended]: /docs/general/metric-requirement-level.md#recommended | ||
[RuntimeMetrics]: https://pkg.go.dev/runtime/metrics |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
groups: | ||
- id: metric.go.memory.used | ||
type: metric | ||
metric_name: go.memory.used | ||
brief: "Virtual memory mapped by the Go runtime." | ||
instrument: updowncounter | ||
unit: "By" | ||
attributes: | ||
- id: type | ||
stability: experimental | ||
type: | ||
allow_custom_values: false | ||
members: | ||
- id: released | ||
value: 'released' | ||
brief: 'Memory that is completely free and has been returned to the underlying system.' | ||
stability: experimental | ||
- id: stack | ||
value: 'stack' | ||
brief: 'Memory allocated from the heap that is reserved for stack space, whether or not it is currently in-use.' | ||
stability: experimental | ||
- id: other | ||
value: 'other' | ||
brief: 'All memory mapped by the Go runtime into the current process as read-write, excluding other categories of memory usage.' | ||
stability: experimental | ||
requirement_level: recommended | ||
brief: The type of memory. | ||
examples: ["released", "stack"] | ||
stability: experimental | ||
|
||
- id: metric.go.memory.limit | ||
type: metric | ||
metric_name: go.memory.limit | ||
brief: "Go runtime memory limit configured by the user, otherwise math.MaxInt64." | ||
instrument: updowncounter | ||
unit: "By" | ||
stability: experimental | ||
|
||
- id: metric.go.memory.allocated | ||
type: metric | ||
metric_name: go.memory.allocated | ||
brief: "Memory allocated to the heap by the application." | ||
instrument: counter | ||
unit: "By" | ||
stability: experimental | ||
|
||
- id: metric.go.memory.allocations | ||
type: metric | ||
metric_name: go.memory.allocations | ||
brief: "Count of allocations to the heap by the application." | ||
instrument: counter | ||
unit: "{allocation}" | ||
stability: experimental | ||
|
||
- id: metric.go.memory.gc.target | ||
type: metric | ||
metric_name: go.memory.gc.target | ||
brief: "Heap size target for the end of the GC cycle." | ||
instrument: updowncounter | ||
unit: "By" | ||
prefix: go.gc | ||
stability: experimental | ||
|
||
- id: metric.go.memory.gc.user_target | ||
type: metric | ||
metric_name: go.memory.gc.user_target | ||
brief: "Heap size target percentage for the end of the GC cycle, as configured by the user." | ||
instrument: updowncounter | ||
unit: "By" | ||
prefix: go.gc | ||
stability: experimental | ||
|
||
- id: metric.go.thread.limit | ||
type: metric | ||
metric_name: go.thread.limit | ||
brief: "The number of OS threads that can execute user-level Go code simultaneously." | ||
instrument: updowncounter | ||
unit: "{thread}" | ||
stability: experimental | ||
|
||
- id: metric.go.schedule.duration | ||
type: metric | ||
metric_name: go.schedule.duration | ||
brief: "The time goroutines have spent in the scheduler in a runnable state before actually running." | ||
instrument: histogram | ||
unit: "s" | ||
stability: experimental |