From 606b90a9b3535311842f6ac09aa2988ce0121526 Mon Sep 17 00:00:00 2001 From: Dan Jaglowski Date: Wed, 12 Jan 2022 19:49:42 -0500 Subject: [PATCH] Specify common process.runtime.* attributes for Go --- .../resource/semantic_conventions/process.md | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/specification/resource/semantic_conventions/process.md b/specification/resource/semantic_conventions/process.md index f026ea185ec..edf5e3406e0 100644 --- a/specification/resource/semantic_conventions/process.md +++ b/specification/resource/semantic_conventions/process.md @@ -78,10 +78,30 @@ Example: ### Go Runtimes -| Value | Description | -| --- | --- | -| `go` | Go compiler | -| `gccgo` | GCC Go frontend | +Go Runtimes should fill in the as follows: + +- `process.runtime.name` - Fill in an interpretation of Go's `runtime.Compiler` constant, according to the following rule: If the value is `gc`, fill in `go`. Otherwise, fill in the exact value of `runtime.Compiler`. + + This can be implemented with the following Go snippet: + + ```go + import "runtime" + + func getRuntimeName() string { + if runtime.Compiler == "gc" { + return "go" + } + return runtime.Compiler + } + ``` + +- `process.runtime.version` - Fill in the exact value returned by `runtime.Version()`, i.e. `go1.17`. +- `process.runtime.description` - Fill in a description corresponding to the value of `process.runtime.name`, as defined by the table below. + +| `runtime.Compiler` | `process.runtime.name` | `process.runtime.description` | +| --- | --- | --- | +| `gc` | go | cmd/compile | +| `gccgo` | gccgo | gccgo front end | ### Java runtimes