1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-09-16 09:26:25 +02:00

OS and Process resource detectors (#1788)

* WIP: OS and Process resource detectors

* Completed documentation headers

* Added empty test files for OS and Process resource functions

* Split long line

* Added resource.WithOS function test

* Added resource.WithProcess* functions tests

* Renamed osDetector and WithOS function to better reflect they only add the os.type attribute

* Updated changelog

* WIP: possible use of wrappers for getting attribute values

* Refined implementation of wrapper functions providing os/runtime/user information

* Added PR number to new changelog entries

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>

* Fix wrong function name in documentation header

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>

* Fixed wording in WithProcessOwner documentation header

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>

* Updated osTypeDetector

* Replaced ToUpper with ToLower to match the current convention.
* Used runtimeOS provider to get the OS name.

* Adapted WithOSType test to mock runtime providers

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
This commit is contained in:
Nelson Ghezzi
2021-04-23 15:28:13 +00:00
committed by GitHub
parent 7374d67961
commit aa66fe75e4
7 changed files with 694 additions and 0 deletions

View File

@@ -116,8 +116,24 @@ const (
// `proc/[pid]/cmdline`. On Windows, can be set to the result of
// `GetCommandLineW`.
ProcessCommandLineKey = attribute.Key("process.command_line")
// All the command arguments (including the command/executable itself)
// as received by the process. On Linux-based systems (and some other
// Unixoid systems supporting procfs), can be set according to the list
// of null-delimited strings extracted from `proc/[pid]/cmdline`. For
// libc-based executables, this would be the full argv vector passed to
// `main`.
ProcessCommandArgsKey = attribute.Key("process.command_args")
// The username of the user that owns the process.
ProcessOwnerKey = attribute.Key("process.owner")
// The name of the runtime of this process. For compiled native
// binaries, this SHOULD be the name of the compiler.
ProcessRuntimeNameKey = attribute.Key("process.runtime.name")
// The version of the runtime of this process, as returned by the
// runtime without modification.
ProcessRuntimeVersionKey = attribute.Key("process.runtime.version")
// An additional description about the runtime of the process, for
// example a specific vendor customization of the runtime environment.
ProcessRuntimeDescriptionKey = attribute.Key("process.runtime.description")
)
// Semantic conventions for Kubernetes resource attribute keys.
@@ -183,6 +199,14 @@ const (
K8SCronJobNameKey = attribute.Key("k8s.cronjob.name")
)
// Semantic conventions for OS resource attribute keys.
const (
// The operating system type.
OSTypeKey = attribute.Key("os.type")
// Human readable (not intended to be parsed) OS version information.
OSDescriptionKey = attribute.Key("os.description")
)
// Semantic conventions for host resource attribute keys.
const (
// A uniquely identifying name for the host: 'hostname', FQDN, or user specified name