You've already forked opentelemetry-go
							
							
				mirror of
				https://github.com/open-telemetry/opentelemetry-go.git
				synced 2025-10-31 00:07:40 +02:00 
			
		
		
		
	Semantic Convention generation tooling (#1891)
* Add semantic convention generator Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com> * Update semantic conventions from generator Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com> * Use existing internal/tools module Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com> * Fix lint issues, more initialisms Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com> * Update changelog Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com> * semconvgen: Faas->FaaS Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com> * Fix a few more key names with replacements * Update replacements from PR feedback Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com> * rename commonInitialisms to capitalizations, move some capitalizations there Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com> * Regenerate semantic conventions with updated capitalizations and replacements Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com> * Generate semantic conventions from spec v1.3.0 Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com> * Cleanup semconv generator util a bit Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com> * No need to put internal tooling additions in the CHANGELOG Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com> * Fix HTTP semconv tests Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com> * Add semconv generation notes to RELEASING.md Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
This commit is contained in:
		
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							6219221fc5
						
					
				
				
					commit
					5cb6263624
				
			
							
								
								
									
										10
									
								
								.github/dependabot.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								.github/dependabot.yml
									
									
									
									
										vendored
									
									
								
							| @@ -216,3 +216,13 @@ updates: | ||||
|     schedule: | ||||
|       day: sunday | ||||
|       interval: weekly | ||||
|   - | ||||
|     package-ecosystem: gomod | ||||
|     directory: /internal/tools/semconv-gen | ||||
|     labels: | ||||
|       - dependencies | ||||
|       - go | ||||
|       - "Skip Changelog" | ||||
|     schedule: | ||||
|       day: sunday | ||||
|       interval: weekly | ||||
|   | ||||
| @@ -40,6 +40,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm | ||||
| - The `ExportSpans` method of the`SpanExporter` interface type was updated to accept `ReadOnlySpan`s instead of the removed `SpanSnapshot`. | ||||
|   This brings the export interface into compliance with the specification in that it now accepts an explicitly immutable type instead of just an implied one. (#1873) | ||||
| - Unembed `SpanContext` in `Link`. (#1877) | ||||
| - Semantic conventions are now generated from the specification YAML. (#1891) | ||||
| - Spans created by the global `Tracer` obtained from `go.opentelemetry.io/otel`, prior to a functioning `TracerProvider` being set, now propagate the span context from their parent if one exists. (#1901) | ||||
| - Move the `go.opentelemetry.io/otel/unit` package to `go.opentelemetry.io/otel/metric/unit`. (#1903) | ||||
|  | ||||
|   | ||||
							
								
								
									
										5
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								Makefile
									
									
									
									
									
								
							| @@ -40,6 +40,9 @@ $(TOOLS)/%: | $(TOOLS) | ||||
| 	cd $(TOOLS_MOD_DIR) && \ | ||||
| 	$(GO) build -o $@ $(PACKAGE) | ||||
|  | ||||
| SEMCONVGEN = $(TOOLS)/semconv-gen | ||||
| $(TOOLS)/semconv-gen: PACKAGE=go.opentelemetry.io/otel/$(TOOLS_MOD_DIR)/semconv-gen | ||||
|  | ||||
| CROSSLINK = $(TOOLS)/crosslink | ||||
| $(TOOLS)/crosslink: PACKAGE=go.opentelemetry.io/otel/$(TOOLS_MOD_DIR)/crosslink | ||||
|  | ||||
| @@ -55,7 +58,7 @@ $(TOOLS)/stringer: PACKAGE=golang.org/x/tools/cmd/stringer | ||||
| $(TOOLS)/gojq: PACKAGE=github.com/itchyny/gojq/cmd/gojq | ||||
|  | ||||
| .PHONY: tools | ||||
| tools: $(CROSSLINK) $(GOLANGCI_LINT) $(MISSPELL) $(STRINGER) $(TOOLS)/gojq | ||||
| tools: $(CROSSLINK) $(GOLANGCI_LINT) $(MISSPELL) $(STRINGER) $(TOOLS)/gojq $(SEMCONVGEN) | ||||
|  | ||||
|  | ||||
| # Build | ||||
|   | ||||
							
								
								
									
										19
									
								
								RELEASING.md
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								RELEASING.md
									
									
									
									
									
								
							| @@ -1,5 +1,24 @@ | ||||
| # Release Process | ||||
|  | ||||
| ## Semantic Convention Generation | ||||
|  | ||||
| If a new version of the OpenTelemetry Specification has been released it will be necessary to generate a new | ||||
| semantic convention package from the YAML definitions in the specification repository. There is a utility in | ||||
| `internal/tools/semconv-gen` that can be used to generate the `semconv` package. This will ideally be done | ||||
| shortly after the specification release is tagged, but it is also good practice to ensure that current conventions | ||||
| are current before creating a release tag. | ||||
|  | ||||
| There are currently two categories of semantic conventions that must be generated, `resource` and `trace`. | ||||
|  | ||||
| ``` | ||||
| cd internal/tools/semconv-gen | ||||
| go run generate.go -i /path/to/specification/repo/semantic_conventions/resource | ||||
| go run generate.go -i /path/to/specification/repo/semantic_conventions/trace | ||||
| ``` | ||||
|  | ||||
| Using default values for all options other than `input` will result in using the `template.j2` template to | ||||
| generate `resource.go` and `trace.go` in `/path/to/otelgo/repo/semconv`. | ||||
|  | ||||
| ## Pre-Release | ||||
|  | ||||
| Update go.mod for submodules to depend on the new release which will happen in the next step. | ||||
|   | ||||
| @@ -7,6 +7,7 @@ require ( | ||||
| 	github.com/gogo/protobuf v1.3.2 | ||||
| 	github.com/golangci/golangci-lint v1.39.0 | ||||
| 	github.com/itchyny/gojq v0.12.3 | ||||
| 	github.com/spf13/pflag v1.0.5 | ||||
| 	golang.org/x/tools v0.1.0 | ||||
| ) | ||||
|  | ||||
|   | ||||
							
								
								
									
										319
									
								
								internal/tools/semconv-gen/generator.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										319
									
								
								internal/tools/semconv-gen/generator.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,319 @@ | ||||
| // Copyright The OpenTelemetry Authors | ||||
| // | ||||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| // you may not use this file except in compliance with the License. | ||||
| // You may obtain a copy of the License at | ||||
| // | ||||
| //     http://www.apache.org/licenses/LICENSE-2.0 | ||||
| // | ||||
| // Unless required by applicable law or agreed to in writing, software | ||||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
| // See the License for the specific language governing permissions and | ||||
| // limitations under the License. | ||||
|  | ||||
| package main | ||||
|  | ||||
| import ( | ||||
| 	"bytes" | ||||
| 	"errors" | ||||
| 	"fmt" | ||||
| 	"io/ioutil" | ||||
| 	"os" | ||||
| 	"os/exec" | ||||
| 	"path" | ||||
| 	"path/filepath" | ||||
| 	"regexp" | ||||
| 	"strings" | ||||
|  | ||||
| 	flag "github.com/spf13/pflag" | ||||
| ) | ||||
|  | ||||
| func main() { | ||||
| 	cfg := config{} | ||||
| 	flag.StringVarP(&cfg.inputPath, "input", "i", "", "Path to semantic convention definition YAML") | ||||
| 	flag.StringVarP(&cfg.outputPath, "output", "o", "semconv", "Path to output target. Must be either an absolute path or relative to the repository root.") | ||||
| 	flag.StringVarP(&cfg.containerImage, "container", "c", "otel/semconvgen", "Container image ID") | ||||
| 	flag.StringVarP(&cfg.outputFilename, "filename", "f", "", "Filename for templated output. If not specified 'basename(inputPath).go' will be used.") | ||||
| 	flag.StringVarP(&cfg.templateFilename, "template", "t", "template.j2", "Template filename") | ||||
| 	flag.Parse() | ||||
|  | ||||
| 	cfg, err := validateConfig(cfg) | ||||
| 	if err != nil { | ||||
| 		fmt.Println(err) | ||||
| 		flag.Usage() | ||||
| 		os.Exit(-1) | ||||
| 	} | ||||
|  | ||||
| 	err = render(cfg) | ||||
| 	if err != nil { | ||||
| 		panic(err) | ||||
| 	} | ||||
|  | ||||
| 	err = fixIdentifiers(cfg.outputFilename) | ||||
| 	if err != nil { | ||||
| 		panic(err) | ||||
| 	} | ||||
|  | ||||
| 	err = format(cfg.outputFilename) | ||||
| 	if err != nil { | ||||
| 		panic(err) | ||||
| 	} | ||||
| } | ||||
|  | ||||
| type config struct { | ||||
| 	inputPath        string | ||||
| 	outputPath       string | ||||
| 	outputFilename   string | ||||
| 	templateFilename string | ||||
| 	containerImage   string | ||||
| } | ||||
|  | ||||
| func validateConfig(cfg config) (config, error) { | ||||
| 	if cfg.inputPath == "" { | ||||
| 		return config{}, errors.New("input path must be provided") | ||||
| 	} | ||||
|  | ||||
| 	if cfg.outputFilename == "" { | ||||
| 		cfg.outputFilename = fmt.Sprintf("%s.go", path.Base(cfg.inputPath)) | ||||
| 	} | ||||
|  | ||||
| 	if !path.IsAbs(cfg.outputPath) { | ||||
| 		root, err := findRepoRoot() | ||||
| 		if err != nil { | ||||
| 			return config{}, err | ||||
| 		} | ||||
| 		cfg.outputPath = path.Join(root, cfg.outputPath) | ||||
| 	} | ||||
|  | ||||
| 	cfg.outputFilename = path.Join(cfg.outputPath, cfg.outputFilename) | ||||
|  | ||||
| 	if !path.IsAbs(cfg.templateFilename) { | ||||
| 		pwd, err := os.Getwd() | ||||
| 		if err != nil { | ||||
| 			return config{}, err | ||||
| 		} | ||||
| 		cfg.templateFilename = path.Join(pwd, cfg.templateFilename) | ||||
| 	} | ||||
|  | ||||
| 	return cfg, nil | ||||
| } | ||||
|  | ||||
| func render(cfg config) error { | ||||
| 	tmpDir, err := os.MkdirTemp("", "otel_semconvgen") | ||||
| 	if err != nil { | ||||
| 		return fmt.Errorf("unable to create temporary directory: %w", err) | ||||
| 	} | ||||
| 	defer os.RemoveAll(tmpDir) | ||||
|  | ||||
| 	inputPath := path.Join(tmpDir, "input") | ||||
| 	err = os.Mkdir(inputPath, 0700) | ||||
| 	if err != nil { | ||||
| 		return fmt.Errorf("unable to create input directory: %w", err) | ||||
| 	} | ||||
|  | ||||
| 	outputPath := path.Join(tmpDir, "output") | ||||
| 	err = os.Mkdir(outputPath, 0700) | ||||
| 	if err != nil { | ||||
| 		return fmt.Errorf("unable to create output directory: %w", err) | ||||
| 	} | ||||
|  | ||||
| 	err = exec.Command("cp", "-a", cfg.inputPath, inputPath).Run() | ||||
| 	if err != nil { | ||||
| 		return fmt.Errorf("unable to copy input to temp directory: %w", err) | ||||
| 	} | ||||
|  | ||||
| 	err = exec.Command("cp", cfg.templateFilename, tmpDir).Run() | ||||
| 	if err != nil { | ||||
| 		return fmt.Errorf("unable to copy template to temp directory: %w", err) | ||||
| 	} | ||||
|  | ||||
| 	cmd := exec.Command("docker", "run", "--rm", | ||||
| 		"-v", fmt.Sprintf("%s:/data", tmpDir), | ||||
| 		cfg.containerImage, | ||||
| 		"--yaml-root", path.Join("/data/input", path.Base(cfg.inputPath)), | ||||
| 		"code", | ||||
| 		"--template", path.Join("/data", path.Base(cfg.templateFilename)), | ||||
| 		"--output", path.Join("/data/output", path.Base(cfg.outputFilename)), | ||||
| 	) | ||||
| 	err = cmd.Run() | ||||
| 	if err != nil { | ||||
| 		return fmt.Errorf("unable to render template: %w", err) | ||||
| 	} | ||||
|  | ||||
| 	err = exec.Command("cp", path.Join(tmpDir, "output", path.Base(cfg.outputFilename)), cfg.outputPath).Run() | ||||
| 	if err != nil { | ||||
| 		return fmt.Errorf("unable to copy result to target: %w", err) | ||||
| 	} | ||||
|  | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| func findRepoRoot() (string, error) { | ||||
| 	start, err := os.Getwd() | ||||
| 	if err != nil { | ||||
| 		return "", err | ||||
| 	} | ||||
|  | ||||
| 	dir := start | ||||
| 	for { | ||||
| 		_, err := os.Stat(filepath.Join(dir, ".git")) | ||||
| 		if errors.Is(err, os.ErrNotExist) { | ||||
| 			dir = filepath.Dir(dir) | ||||
| 			// From https://golang.org/pkg/path/filepath/#Dir: | ||||
| 			// The returned path does not end in a separator unless it is the root directory. | ||||
| 			if strings.HasSuffix(dir, string(filepath.Separator)) { | ||||
| 				return "", fmt.Errorf("unable to find git repository enclosing working dir %s", start) | ||||
| 			} | ||||
| 			continue | ||||
| 		} | ||||
|  | ||||
| 		if err != nil { | ||||
| 			return "", err | ||||
| 		} | ||||
|  | ||||
| 		return dir, nil | ||||
| 	} | ||||
| } | ||||
|  | ||||
| var capitalizations = []string{ | ||||
| 	"ACL", | ||||
| 	"AIX", | ||||
| 	"AKS", | ||||
| 	"AMD64", | ||||
| 	"API", | ||||
| 	"ARM32", | ||||
| 	"ARM64", | ||||
| 	"ARN", | ||||
| 	"ARNs", | ||||
| 	"ASCII", | ||||
| 	"AWS", | ||||
| 	"CPU", | ||||
| 	"CSS", | ||||
| 	"DB", | ||||
| 	"DC", | ||||
| 	"DNS", | ||||
| 	"EC2", | ||||
| 	"ECS", | ||||
| 	"EDB", | ||||
| 	"EKS", | ||||
| 	"EOF", | ||||
| 	"GCP", | ||||
| 	"GRPC", | ||||
| 	"GUID", | ||||
| 	"HPUX", | ||||
| 	"HSQLDB", | ||||
| 	"HTML", | ||||
| 	"HTTP", | ||||
| 	"HTTPS", | ||||
| 	"IA64", | ||||
| 	"ID", | ||||
| 	"IP", | ||||
| 	"JDBC", | ||||
| 	"JSON", | ||||
| 	"K8S", | ||||
| 	"LHS", | ||||
| 	"MSSQL", | ||||
| 	"OS", | ||||
| 	"PHP", | ||||
| 	"PID", | ||||
| 	"PPC32", | ||||
| 	"PPC64", | ||||
| 	"QPS", | ||||
| 	"QUIC", | ||||
| 	"RAM", | ||||
| 	"RHS", | ||||
| 	"RPC", | ||||
| 	"SDK", | ||||
| 	"SLA", | ||||
| 	"SMTP", | ||||
| 	"SPDY", | ||||
| 	"SQL", | ||||
| 	"SSH", | ||||
| 	"TCP", | ||||
| 	"TLS", | ||||
| 	"TTL", | ||||
| 	"UDP", | ||||
| 	"UID", | ||||
| 	"UI", | ||||
| 	"UUID", | ||||
| 	"URI", | ||||
| 	"URL", | ||||
| 	"UTF8", | ||||
| 	"VM", | ||||
| 	"XML", | ||||
| 	"XMPP", | ||||
| 	"XSRF", | ||||
| 	"XSS", | ||||
| 	"ZOS", | ||||
| 	"CronJob", | ||||
| 	"WebEngine", | ||||
| 	"MySQL", | ||||
| 	"PostgreSQL", | ||||
| 	"MariaDB", | ||||
| 	"MaxDB", | ||||
| 	"FirstSQL", | ||||
| 	"InstantDB", | ||||
| 	"HBase", | ||||
| 	"MongoDB", | ||||
| 	"CouchDB", | ||||
| 	"CosmosDB", | ||||
| 	"DynamoDB", | ||||
| 	"HanaDB", | ||||
| 	"FreeBSD", | ||||
| 	"NetBSD", | ||||
| 	"OpenBSD", | ||||
| 	"DragonflyBSD", | ||||
| 	"InProc", | ||||
| 	"FaaS", | ||||
| } | ||||
|  | ||||
| // These are not simple capitalization fixes, but require string replacement. | ||||
| // All occurrences of the key will be replaced with the corresponding value. | ||||
| var replacements = map[string]string{ | ||||
| 	"RedisDatabase": "RedisDB", | ||||
| 	"IPTCP":         "TCP", | ||||
| 	"IPUDP":         "UDP", | ||||
| 	"Lineno":        "LineNumber", | ||||
| } | ||||
|  | ||||
| func fixIdentifiers(fn string) error { | ||||
| 	data, err := ioutil.ReadFile(fn) | ||||
| 	if err != nil { | ||||
| 		return fmt.Errorf("unable to read file: %w", err) | ||||
| 	} | ||||
|  | ||||
| 	for _, init := range capitalizations { | ||||
| 		// Match the title-cased capitalization target, asserting that its followed by | ||||
| 		// either a capital letter, whitespace, a digit, or the end of text. | ||||
| 		// This is to avoid, e.g., turning "Identifier" into "IDentifier". | ||||
| 		re := regexp.MustCompile(strings.Title(strings.ToLower(init)) + `([A-Z\s\d]|$)`) | ||||
| 		// RE2 does not support zero-width lookahead assertions, so we have to replace | ||||
| 		// the last character that may have matched the first capture group in the | ||||
| 		// expression constructed above. | ||||
| 		data = re.ReplaceAll(data, []byte(init+`$1`)) | ||||
| 	} | ||||
|  | ||||
| 	for cur, repl := range replacements { | ||||
| 		data = bytes.ReplaceAll(data, []byte(cur), []byte(repl)) | ||||
| 	} | ||||
|  | ||||
| 	err = ioutil.WriteFile(fn, data, 0644) | ||||
| 	if err != nil { | ||||
| 		return fmt.Errorf("unable to write updated file: %w", err) | ||||
| 	} | ||||
|  | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| func format(fn string) error { | ||||
| 	cmd := exec.Command("gofmt", "-w", "-s", fn) | ||||
| 	cmd.Stdout = os.Stdout | ||||
| 	cmd.Stderr = os.Stderr | ||||
| 	err := cmd.Run() | ||||
| 	if err != nil { | ||||
| 		return fmt.Errorf("unable to format updated file: %w", err) | ||||
| 	} | ||||
|  | ||||
| 	return nil | ||||
| } | ||||
							
								
								
									
										76
									
								
								internal/tools/semconv-gen/template.j2
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										76
									
								
								internal/tools/semconv-gen/template.j2
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,76 @@ | ||||
| {%- macro to_go_attr_type(type, val) -%} | ||||
|   {%- if type == "string" -%} | ||||
|     String("{{val}}") | ||||
|   {%- elif type == "int" -%} | ||||
|     Int({{val}}) | ||||
|   {%- endif -%} | ||||
| {%- endmacro -%} | ||||
| {%- macro to_go_name(fqn) -%} | ||||
| {{fqn | replace(".", " ") | replace("_", " ") | title | replace(" ", "")}} | ||||
| {%- endmacro -%} | ||||
| {%- macro godoc(attr) -%} | ||||
| {{ attr.brief }} | ||||
| // | ||||
| {%- if attr.attr_type is string %} | ||||
| Type: {{ attr.attr_type }} | ||||
| {%- else %} | ||||
| Type: Enum | ||||
| {%- endif %} | ||||
| {%- if attr.required == Required.ALWAYS %} | ||||
| Required: Always | ||||
| {%- elif attr.required == Required.CONDITIONAL %} | ||||
| Required: {{ attr.required_msg }} | ||||
| {%- else %} | ||||
| Required: No | ||||
| {%- endif %} | ||||
| {%- if attr.examples is iterable %} | ||||
| Examples: {{ attr.examples | pprint | trim("[]")  }} | ||||
| {%- endif %} | ||||
| {%- if attr.note %} | ||||
| Note: {{ attr.note }} | ||||
| {%- endif %} | ||||
| {%- endmacro -%} | ||||
| // Copyright The OpenTelemetry Authors | ||||
| // | ||||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| // you may not use this file except in compliance with the License. | ||||
| // You may obtain a copy of the License at | ||||
| // | ||||
| //     http://www.apache.org/licenses/LICENSE-2.0 | ||||
| // | ||||
| // Unless required by applicable law or agreed to in writing, software | ||||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
| // See the License for the specific language governing permissions and | ||||
| // limitations under the License. | ||||
|  | ||||
| // Code generated from semantic convention specification. DO NOT EDIT. | ||||
|  | ||||
| package semconv  // import "go.opentelemetry.io/otel/semconv" | ||||
|  | ||||
| import "go.opentelemetry.io/otel/attribute" | ||||
|  | ||||
| {% for semconv in semconvs -%} | ||||
| {%- if semconvs[semconv].attributes | rejectattr("ref") | selectattr("is_local") | sort(attribute=fqn) | length > 0 -%} | ||||
| // {{ semconvs[semconv].brief }} | ||||
| const ( | ||||
| {% for attr in semconvs[semconv].attributes if attr.is_local and not attr.ref -%} | ||||
|     // {{ godoc(attr) | wordwrap | indent(3) | replace("   ", "\t// ") | replace("// //", "//") }} | ||||
|     {{to_go_name(attr.fqn)}}Key = attribute.Key("{{attr.fqn}}") | ||||
| {% endfor %} | ||||
| ) | ||||
| {%- for attr in semconvs[semconv].attributes if attr.is_local and not attr.ref -%} | ||||
| {%- if attr.attr_type is not string %} | ||||
|  | ||||
| var ( | ||||
| {%- for val in attr.attr_type.members %} | ||||
|     // {{ val.brief | to_doc_brief }} | ||||
|     {{to_go_name("{}.{}".format(attr.fqn, val.member_id))}} = {{to_go_name(attr.fqn)}}Key.{{to_go_attr_type(attr.attr_type.enum_type, val.value)}} | ||||
| {%- endfor %} | ||||
| ) | ||||
| {%- endif -%} | ||||
| {%- endfor %} | ||||
|  | ||||
| {% endif %} | ||||
| {% endfor -%} | ||||
|  | ||||
| @@ -11,28 +11,9 @@ | ||||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
| // See the License for the specific language governing permissions and | ||||
| // limitations under the License. | ||||
|  | ||||
| package semconv | ||||
|  | ||||
| import "go.opentelemetry.io/otel/attribute" | ||||
|  | ||||
| // Semantic conventions for exception attribute keys. | ||||
| const ( | ||||
| 	// The Go type containing the error or exception. | ||||
| 	ExceptionTypeKey = attribute.Key("exception.type") | ||||
|  | ||||
| 	// The exception message. | ||||
| 	ExceptionMessageKey = attribute.Key("exception.message") | ||||
|  | ||||
| 	// A stacktrace as a string. This most commonly will come from | ||||
| 	// "runtime/debug".Stack. | ||||
| 	ExceptionStacktraceKey = attribute.Key("exception.stacktrace") | ||||
|  | ||||
| 	// If the exception event is recorded at a point where it is known | ||||
| 	// that the exception is escaping the scope of the span this | ||||
| 	// attribute is set to true. | ||||
| 	ExceptionEscapedKey = attribute.Key("exception.escaped") | ||||
| ) | ||||
|  | ||||
| const ( | ||||
| 	// ExceptionEventName is the name of the Span event representing an exception. | ||||
| 	ExceptionEventName = "exception" | ||||
|   | ||||
| @@ -25,6 +25,11 @@ import ( | ||||
| 	"go.opentelemetry.io/otel/codes" | ||||
| ) | ||||
|  | ||||
| var ( | ||||
| 	HTTPSchemeHTTP  = HTTPSchemeKey.String("http") | ||||
| 	HTTPSchemeHTTPS = HTTPSchemeKey.String("https") | ||||
| ) | ||||
|  | ||||
| // NetAttributesFromHTTPRequest generates attributes of the net | ||||
| // namespace as specified by the OpenTelemetry specification for a | ||||
| // span.  The network parameter is a string that net.Dial function | ||||
|   | ||||
| @@ -63,7 +63,7 @@ func TestNetAttributesFromHTTPRequest(t *testing.T) { | ||||
| 			}, | ||||
| 			header: nil, | ||||
| 			expected: []attribute.KeyValue{ | ||||
| 				attribute.String("net.transport", "IP.TCP"), | ||||
| 				attribute.String("net.transport", "ip_tcp"), | ||||
| 			}, | ||||
| 		}, | ||||
| 		{ | ||||
| @@ -79,7 +79,7 @@ func TestNetAttributesFromHTTPRequest(t *testing.T) { | ||||
| 			}, | ||||
| 			header: nil, | ||||
| 			expected: []attribute.KeyValue{ | ||||
| 				attribute.String("net.transport", "IP.UDP"), | ||||
| 				attribute.String("net.transport", "ip_udp"), | ||||
| 			}, | ||||
| 		}, | ||||
| 		{ | ||||
| @@ -95,7 +95,7 @@ func TestNetAttributesFromHTTPRequest(t *testing.T) { | ||||
| 			}, | ||||
| 			header: nil, | ||||
| 			expected: []attribute.KeyValue{ | ||||
| 				attribute.String("net.transport", "IP"), | ||||
| 				attribute.String("net.transport", "ip"), | ||||
| 			}, | ||||
| 		}, | ||||
| 		{ | ||||
| @@ -111,7 +111,7 @@ func TestNetAttributesFromHTTPRequest(t *testing.T) { | ||||
| 			}, | ||||
| 			header: nil, | ||||
| 			expected: []attribute.KeyValue{ | ||||
| 				attribute.String("net.transport", "Unix"), | ||||
| 				attribute.String("net.transport", "unix"), | ||||
| 			}, | ||||
| 		}, | ||||
| 		{ | ||||
| @@ -143,7 +143,7 @@ func TestNetAttributesFromHTTPRequest(t *testing.T) { | ||||
| 			}, | ||||
| 			header: nil, | ||||
| 			expected: []attribute.KeyValue{ | ||||
| 				attribute.String("net.transport", "IP.TCP"), | ||||
| 				attribute.String("net.transport", "ip_tcp"), | ||||
| 				attribute.String("net.peer.ip", "1.2.3.4"), | ||||
| 				attribute.Int("net.peer.port", 56), | ||||
| 			}, | ||||
| @@ -161,7 +161,7 @@ func TestNetAttributesFromHTTPRequest(t *testing.T) { | ||||
| 			}, | ||||
| 			header: nil, | ||||
| 			expected: []attribute.KeyValue{ | ||||
| 				attribute.String("net.transport", "IP.TCP"), | ||||
| 				attribute.String("net.transport", "ip_tcp"), | ||||
| 				attribute.String("net.peer.name", "example.com"), | ||||
| 				attribute.Int("net.peer.port", 56), | ||||
| 			}, | ||||
| @@ -179,7 +179,7 @@ func TestNetAttributesFromHTTPRequest(t *testing.T) { | ||||
| 			}, | ||||
| 			header: nil, | ||||
| 			expected: []attribute.KeyValue{ | ||||
| 				attribute.String("net.transport", "IP.TCP"), | ||||
| 				attribute.String("net.transport", "ip_tcp"), | ||||
| 				attribute.String("net.peer.ip", "1.2.3.4"), | ||||
| 			}, | ||||
| 		}, | ||||
| @@ -196,7 +196,7 @@ func TestNetAttributesFromHTTPRequest(t *testing.T) { | ||||
| 			}, | ||||
| 			header: nil, | ||||
| 			expected: []attribute.KeyValue{ | ||||
| 				attribute.String("net.transport", "IP.TCP"), | ||||
| 				attribute.String("net.transport", "ip_tcp"), | ||||
| 				attribute.String("net.peer.name", "example.com"), | ||||
| 			}, | ||||
| 		}, | ||||
| @@ -213,7 +213,7 @@ func TestNetAttributesFromHTTPRequest(t *testing.T) { | ||||
| 			}, | ||||
| 			header: nil, | ||||
| 			expected: []attribute.KeyValue{ | ||||
| 				attribute.String("net.transport", "IP.TCP"), | ||||
| 				attribute.String("net.transport", "ip_tcp"), | ||||
| 			}, | ||||
| 		}, | ||||
| 		{ | ||||
| @@ -229,7 +229,7 @@ func TestNetAttributesFromHTTPRequest(t *testing.T) { | ||||
| 			}, | ||||
| 			header: nil, | ||||
| 			expected: []attribute.KeyValue{ | ||||
| 				attribute.String("net.transport", "IP.TCP"), | ||||
| 				attribute.String("net.transport", "ip_tcp"), | ||||
| 				attribute.String("net.peer.ip", "1.2.3.4"), | ||||
| 				attribute.Int("net.peer.port", 56), | ||||
| 				attribute.String("net.host.name", "example.com"), | ||||
| @@ -248,7 +248,7 @@ func TestNetAttributesFromHTTPRequest(t *testing.T) { | ||||
| 			}, | ||||
| 			header: nil, | ||||
| 			expected: []attribute.KeyValue{ | ||||
| 				attribute.String("net.transport", "IP.TCP"), | ||||
| 				attribute.String("net.transport", "ip_tcp"), | ||||
| 				attribute.String("net.peer.ip", "1.2.3.4"), | ||||
| 				attribute.Int("net.peer.port", 56), | ||||
| 				attribute.String("net.host.ip", "4.3.2.1"), | ||||
| @@ -267,7 +267,7 @@ func TestNetAttributesFromHTTPRequest(t *testing.T) { | ||||
| 			}, | ||||
| 			header: nil, | ||||
| 			expected: []attribute.KeyValue{ | ||||
| 				attribute.String("net.transport", "IP.TCP"), | ||||
| 				attribute.String("net.transport", "ip_tcp"), | ||||
| 				attribute.String("net.peer.ip", "1.2.3.4"), | ||||
| 				attribute.Int("net.peer.port", 56), | ||||
| 				attribute.String("net.host.name", "example.com"), | ||||
| @@ -287,7 +287,7 @@ func TestNetAttributesFromHTTPRequest(t *testing.T) { | ||||
| 			}, | ||||
| 			header: nil, | ||||
| 			expected: []attribute.KeyValue{ | ||||
| 				attribute.String("net.transport", "IP.TCP"), | ||||
| 				attribute.String("net.transport", "ip_tcp"), | ||||
| 				attribute.String("net.peer.ip", "1.2.3.4"), | ||||
| 				attribute.Int("net.peer.port", 56), | ||||
| 				attribute.String("net.host.ip", "4.3.2.1"), | ||||
| @@ -307,7 +307,7 @@ func TestNetAttributesFromHTTPRequest(t *testing.T) { | ||||
| 			}, | ||||
| 			header: nil, | ||||
| 			expected: []attribute.KeyValue{ | ||||
| 				attribute.String("net.transport", "IP.TCP"), | ||||
| 				attribute.String("net.transport", "ip_tcp"), | ||||
| 				attribute.String("net.peer.ip", "1.2.3.4"), | ||||
| 				attribute.Int("net.peer.port", 56), | ||||
| 				attribute.String("net.host.name", "example.com"), | ||||
| @@ -326,7 +326,7 @@ func TestNetAttributesFromHTTPRequest(t *testing.T) { | ||||
| 			}, | ||||
| 			header: nil, | ||||
| 			expected: []attribute.KeyValue{ | ||||
| 				attribute.String("net.transport", "IP.TCP"), | ||||
| 				attribute.String("net.transport", "ip_tcp"), | ||||
| 				attribute.String("net.peer.ip", "1.2.3.4"), | ||||
| 				attribute.Int("net.peer.port", 56), | ||||
| 				attribute.String("net.host.ip", "4.3.2.1"), | ||||
| @@ -345,7 +345,7 @@ func TestNetAttributesFromHTTPRequest(t *testing.T) { | ||||
| 			}, | ||||
| 			header: nil, | ||||
| 			expected: []attribute.KeyValue{ | ||||
| 				attribute.String("net.transport", "IP.TCP"), | ||||
| 				attribute.String("net.transport", "ip_tcp"), | ||||
| 				attribute.String("net.peer.ip", "1.2.3.4"), | ||||
| 				attribute.Int("net.peer.port", 56), | ||||
| 			}, | ||||
| @@ -365,7 +365,7 @@ func TestNetAttributesFromHTTPRequest(t *testing.T) { | ||||
| 				"Host": []string{"4.3.2.1:78"}, | ||||
| 			}, | ||||
| 			expected: []attribute.KeyValue{ | ||||
| 				attribute.String("net.transport", "IP.TCP"), | ||||
| 				attribute.String("net.transport", "ip_tcp"), | ||||
| 				attribute.String("net.peer.ip", "1.2.3.4"), | ||||
| 				attribute.Int("net.peer.port", 56), | ||||
| 				attribute.String("net.host.ip", "4.3.2.1"), | ||||
| @@ -386,7 +386,7 @@ func TestNetAttributesFromHTTPRequest(t *testing.T) { | ||||
| 			}, | ||||
| 			header: nil, | ||||
| 			expected: []attribute.KeyValue{ | ||||
| 				attribute.String("net.transport", "IP.TCP"), | ||||
| 				attribute.String("net.transport", "ip_tcp"), | ||||
| 				attribute.String("net.peer.ip", "1.2.3.4"), | ||||
| 				attribute.Int("net.peer.port", 56), | ||||
| 				attribute.String("net.host.ip", "4.3.2.1"), | ||||
|   | ||||
| @@ -12,246 +12,763 @@ | ||||
| // See the License for the specific language governing permissions and | ||||
| // limitations under the License. | ||||
|  | ||||
| // Code generated from semantic convention specification. DO NOT EDIT. | ||||
|  | ||||
| package semconv // import "go.opentelemetry.io/otel/semconv" | ||||
|  | ||||
| import "go.opentelemetry.io/otel/attribute" | ||||
|  | ||||
| // Semantic conventions for service resource attribute keys. | ||||
| // A cloud environment (e.g. GCP, Azure, AWS) | ||||
| const ( | ||||
| 	// Name of the service. | ||||
| 	ServiceNameKey = attribute.Key("service.name") | ||||
|  | ||||
| 	// A namespace for `service.name`. This needs to have meaning that helps | ||||
| 	// to distinguish a group of services. For example, the team name that | ||||
| 	// owns a group of services. `service.name` is expected to be unique | ||||
| 	// within the same namespace. | ||||
| 	ServiceNamespaceKey = attribute.Key("service.namespace") | ||||
|  | ||||
| 	// A unique identifier of the service instance. In conjunction with the | ||||
| 	// `service.name` and `service.namespace` this must be unique. | ||||
| 	ServiceInstanceIDKey = attribute.Key("service.instance.id") | ||||
|  | ||||
| 	// The version of the service API. | ||||
| 	ServiceVersionKey = attribute.Key("service.version") | ||||
| 	// Name of the cloud provider. | ||||
| 	// | ||||
| 	// Type: Enum | ||||
| 	// Required: No | ||||
| 	// Examples: 'gcp' | ||||
| 	CloudProviderKey = attribute.Key("cloud.provider") | ||||
| 	// The cloud account ID the resource is assigned to. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: '111111111111', 'opentelemetry' | ||||
| 	CloudAccountIDKey = attribute.Key("cloud.account.id") | ||||
| 	// The geographical region the resource is running. Refer to your provider's docs | ||||
| 	// to see the available regions, for example [AWS | ||||
| 	// regions](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/), | ||||
| 	// [Azure regions](https://azure.microsoft.com/en-us/global- | ||||
| 	// infrastructure/geographies/), or [Google Cloud | ||||
| 	// regions](https://cloud.google.com/about/locations). | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: 'us-central1', 'us-east-1' | ||||
| 	CloudRegionKey = attribute.Key("cloud.region") | ||||
| 	// Cloud regions often have multiple, isolated locations known as zones to | ||||
| 	// increase availability. Availability zone represents the zone where the resource | ||||
| 	// is running. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: 'us-east-1c' | ||||
| 	// Note: Availability zones are called "zones" on Google Cloud. | ||||
| 	CloudAvailabilityZoneKey = attribute.Key("cloud.availability_zone") | ||||
| 	// The cloud platform in use. | ||||
| 	// | ||||
| 	// Type: Enum | ||||
| 	// Required: No | ||||
| 	// Examples: 'aws_ec2', 'azure_vm', 'gcp_compute_engine' | ||||
| 	// Note: The prefix of the service SHOULD match the one specified in | ||||
| 	// `cloud.provider`. | ||||
| 	CloudPlatformKey = attribute.Key("cloud.platform") | ||||
| ) | ||||
|  | ||||
| // Semantic conventions for telemetry SDK resource attribute keys. | ||||
| const ( | ||||
| 	// The name of the telemetry SDK. | ||||
| 	// | ||||
| 	// The default OpenTelemetry SDK provided by the OpenTelemetry project | ||||
| 	// MUST set telemetry.sdk.name to the value `opentelemetry`. | ||||
| 	// | ||||
| 	// If another SDK is used, this attribute MUST be set to the import path | ||||
| 	// of that SDK's package. | ||||
| 	// | ||||
| 	// The value `opentelemetry` is reserved and MUST NOT be used by | ||||
| 	// non-OpenTelemetry SDKs. | ||||
| 	TelemetrySDKNameKey = attribute.Key("telemetry.sdk.name") | ||||
|  | ||||
| 	// The language of the telemetry SDK. | ||||
| 	TelemetrySDKLanguageKey = attribute.Key("telemetry.sdk.language") | ||||
|  | ||||
| 	// The version string of the telemetry SDK. | ||||
| 	TelemetrySDKVersionKey = attribute.Key("telemetry.sdk.version") | ||||
| ) | ||||
|  | ||||
| // Semantic conventions for telemetry SDK resource attributes. | ||||
| var ( | ||||
| 	TelemetrySDKLanguageGo = TelemetrySDKLanguageKey.String("go") | ||||
| 	// Amazon Web Services | ||||
| 	CloudProviderAWS = CloudProviderKey.String("aws") | ||||
| 	// Microsoft Azure | ||||
| 	CloudProviderAzure = CloudProviderKey.String("azure") | ||||
| 	// Google Cloud Platform | ||||
| 	CloudProviderGCP = CloudProviderKey.String("gcp") | ||||
| ) | ||||
|  | ||||
| // Semantic conventions for container resource attribute keys. | ||||
| var ( | ||||
| 	// AWS Elastic Compute Cloud | ||||
| 	CloudPlatformAWSEC2 = CloudPlatformKey.String("aws_ec2") | ||||
| 	// AWS Elastic Container Service | ||||
| 	CloudPlatformAWSECS = CloudPlatformKey.String("aws_ecs") | ||||
| 	// AWS Elastic Kubernetes Service | ||||
| 	CloudPlatformAWSEKS = CloudPlatformKey.String("aws_eks") | ||||
| 	// AWS Lambda | ||||
| 	CloudPlatformAWSLambda = CloudPlatformKey.String("aws_lambda") | ||||
| 	// AWS Elastic Beanstalk | ||||
| 	CloudPlatformAWSElasticBeanstalk = CloudPlatformKey.String("aws_elastic_beanstalk") | ||||
| 	// Azure Virtual Machines | ||||
| 	CloudPlatformAzureVM = CloudPlatformKey.String("azure_vm") | ||||
| 	// Azure Container Instances | ||||
| 	CloudPlatformAzureContainerInstances = CloudPlatformKey.String("azure_container_instances") | ||||
| 	// Azure Kubernetes Service | ||||
| 	CloudPlatformAzureAKS = CloudPlatformKey.String("azure_aks") | ||||
| 	// Azure Functions | ||||
| 	CloudPlatformAzureFunctions = CloudPlatformKey.String("azure_functions") | ||||
| 	// Azure App Service | ||||
| 	CloudPlatformAzureAppService = CloudPlatformKey.String("azure_app_service") | ||||
| 	// Google Cloud Compute Engine (GCE) | ||||
| 	CloudPlatformGCPComputeEngine = CloudPlatformKey.String("gcp_compute_engine") | ||||
| 	// Google Cloud Run | ||||
| 	CloudPlatformGCPCloudRun = CloudPlatformKey.String("gcp_cloud_run") | ||||
| 	// Google Cloud Kubernetes Engine (GKE) | ||||
| 	CloudPlatformGCPKubernetesEngine = CloudPlatformKey.String("gcp_kubernetes_engine") | ||||
| 	// Google Cloud Functions (GCF) | ||||
| 	CloudPlatformGCPCloudFunctions = CloudPlatformKey.String("gcp_cloud_functions") | ||||
| 	// Google Cloud App Engine (GAE) | ||||
| 	CloudPlatformGCPAppEngine = CloudPlatformKey.String("gcp_app_engine") | ||||
| ) | ||||
|  | ||||
| // Resources used by AWS Elastic Container Service (ECS). | ||||
| const ( | ||||
| 	// A uniquely identifying name for the Container. | ||||
| 	// The Amazon Resource Name (ARN) of an [ECS container instance](https://docs.aws. | ||||
| 	// amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: 'arn:aws:ecs:us- | ||||
| 	// west-1:123456789123:container/32624152-9086-4f0e-acae-1a75b14fe4d9' | ||||
| 	AWSECSContainerARNKey = attribute.Key("aws.ecs.container.arn") | ||||
| 	// The ARN of an [ECS cluster](https://docs.aws.amazon.com/AmazonECS/latest/develo | ||||
| 	// perguide/clusters.html). | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' | ||||
| 	AWSECSClusterARNKey = attribute.Key("aws.ecs.cluster.arn") | ||||
| 	// The [launch type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/l | ||||
| 	// aunch_types.html) for an ECS task. | ||||
| 	// | ||||
| 	// Type: Enum | ||||
| 	// Required: No | ||||
| 	// Examples: 'ec2', 'fargate' | ||||
| 	AWSECSLaunchtypeKey = attribute.Key("aws.ecs.launchtype") | ||||
| 	// The ARN of an [ECS task definition](https://docs.aws.amazon.com/AmazonECS/lates | ||||
| 	// t/developerguide/task_definitions.html). | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: 'arn:aws:ecs:us- | ||||
| 	// west-1:123456789123:task/10838bed-421f-43ef-870a-f43feacbbb5b' | ||||
| 	AWSECSTaskARNKey = attribute.Key("aws.ecs.task.arn") | ||||
| 	// The task definition family this task definition is a member of. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: 'opentelemetry-family' | ||||
| 	AWSECSTaskFamilyKey = attribute.Key("aws.ecs.task.family") | ||||
| 	// The revision for this task definition. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: '8', '26' | ||||
| 	AWSECSTaskRevisionKey = attribute.Key("aws.ecs.task.revision") | ||||
| ) | ||||
|  | ||||
| var ( | ||||
| 	// ec2 | ||||
| 	AWSECSLaunchtypeEC2 = AWSECSLaunchtypeKey.String("ec2") | ||||
| 	// fargate | ||||
| 	AWSECSLaunchtypeFargate = AWSECSLaunchtypeKey.String("fargate") | ||||
| ) | ||||
|  | ||||
| // Resources used by AWS Elastic Kubernetes Service (EKS). | ||||
| const ( | ||||
| 	// The ARN of an EKS cluster. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' | ||||
| 	AWSEKSClusterARNKey = attribute.Key("aws.eks.cluster.arn") | ||||
| ) | ||||
|  | ||||
| // Resources specific to Amazon Web Services. | ||||
| const ( | ||||
| 	// The name(s) of the AWS log group(s) an application is writing to. | ||||
| 	// | ||||
| 	// Type: string[] | ||||
| 	// Required: No | ||||
| 	// Examples: '/aws/lambda/my-function', 'opentelemetry-service' | ||||
| 	// Note: Multiple log groups must be supported for cases like multi-container | ||||
| 	// applications, where a single application has sidecar containers, and each write | ||||
| 	// to their own log group. | ||||
| 	AWSLogGroupNamesKey = attribute.Key("aws.log.group.names") | ||||
| 	// The Amazon Resource Name(s) (ARN) of the AWS log group(s). | ||||
| 	// | ||||
| 	// Type: string[] | ||||
| 	// Required: No | ||||
| 	// Examples: 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:*' | ||||
| 	// Note: See the [log group ARN format | ||||
| 	// documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam- | ||||
| 	// access-control-overview-cwl.html#CWL_ARN_Format). | ||||
| 	AWSLogGroupARNsKey = attribute.Key("aws.log.group.arns") | ||||
| 	// The name(s) of the AWS log stream(s) an application is writing to. | ||||
| 	// | ||||
| 	// Type: string[] | ||||
| 	// Required: No | ||||
| 	// Examples: 'logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' | ||||
| 	AWSLogStreamNamesKey = attribute.Key("aws.log.stream.names") | ||||
| 	// The ARN(s) of the AWS log stream(s). | ||||
| 	// | ||||
| 	// Type: string[] | ||||
| 	// Required: No | ||||
| 	// Examples: 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:log- | ||||
| 	// stream:logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' | ||||
| 	// Note: See the [log stream ARN format | ||||
| 	// documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam- | ||||
| 	// access-control-overview-cwl.html#CWL_ARN_Format). One log group can contain | ||||
| 	// several log streams, so these ARNs necessarily identify both a log group and a | ||||
| 	// log stream. | ||||
| 	AWSLogStreamARNsKey = attribute.Key("aws.log.stream.arns") | ||||
| ) | ||||
|  | ||||
| // A container instance. | ||||
| const ( | ||||
| 	// Container name. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: 'opentelemetry-autoconf' | ||||
| 	ContainerNameKey = attribute.Key("container.name") | ||||
|  | ||||
| 	// Container ID, usually a UUID, as for example used to | ||||
| 	// identify Docker containers. The UUID might be abbreviated. | ||||
| 	// Container ID. Usually a UUID, as for example used to [identify Docker | ||||
| 	// containers](https://docs.docker.com/engine/reference/run/#container- | ||||
| 	// identification). The UUID might be abbreviated. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: 'a3bf90e006b2' | ||||
| 	ContainerIDKey = attribute.Key("container.id") | ||||
|  | ||||
| 	// The container runtime managing this container. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: 'docker', 'containerd', 'rkt' | ||||
| 	ContainerRuntimeKey = attribute.Key("container.runtime") | ||||
| 	// Name of the image the container was built on. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: 'gcr.io/opentelemetry/operator' | ||||
| 	ContainerImageNameKey = attribute.Key("container.image.name") | ||||
|  | ||||
| 	// Container image tag. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: '0.1' | ||||
| 	ContainerImageTagKey = attribute.Key("container.image.tag") | ||||
| ) | ||||
|  | ||||
| // Semantic conventions for Function-as-a-Service resource attribute keys. | ||||
| // The software deployment. | ||||
| const ( | ||||
| 	// A uniquely identifying name for the FaaS. | ||||
| 	// Name of the [deployment | ||||
| 	// environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka | ||||
| 	// deployment tier). | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: 'staging', 'production' | ||||
| 	DeploymentEnvironmentKey = attribute.Key("deployment.environment") | ||||
| ) | ||||
|  | ||||
| // A serverless instance. | ||||
| const ( | ||||
| 	// The name of the function being executed. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: Always | ||||
| 	// Examples: 'my-function' | ||||
| 	FaaSNameKey = attribute.Key("faas.name") | ||||
|  | ||||
| 	// The unique name of the function being executed. | ||||
| 	// The unique ID of the function being executed. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: Always | ||||
| 	// Examples: 'arn:aws:lambda:us-west-2:123456789012:function:my-function' | ||||
| 	// Note: For example, in AWS Lambda this field corresponds to the | ||||
| 	// [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and- | ||||
| 	// namespaces.html) value, in GCP to the URI of the resource, and in Azure to the | ||||
| 	// [FunctionDirectory](https://github.com/Azure/azure-functions- | ||||
| 	// host/wiki/Retrieving-information-about-the-currently-running-function) field. | ||||
| 	FaaSIDKey = attribute.Key("faas.id") | ||||
|  | ||||
| 	// The version of the function being executed. | ||||
| 	// The version string of the function being executed as defined in [Version | ||||
| 	// Attributes](../../resource/semantic_conventions/README.md#version-attributes). | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: '2.0.0' | ||||
| 	FaaSVersionKey = attribute.Key("faas.version") | ||||
|  | ||||
| 	// The execution environment identifier. | ||||
| 	// The execution environment ID as a string. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: 'my-function:instance-0001' | ||||
| 	FaaSInstanceKey = attribute.Key("faas.instance") | ||||
| 	// The amount of memory available to the serverless function in MiB. | ||||
| 	// | ||||
| 	// Type: int | ||||
| 	// Required: No | ||||
| 	// Examples: 128 | ||||
| 	// Note: It's recommended to set this attribute since e.g. too little memory can | ||||
| 	// easily stop a Java AWS Lambda function from working correctly. On AWS Lambda, | ||||
| 	// the environment variable `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` provides this | ||||
| 	// information. | ||||
| 	FaaSMaxMemoryKey = attribute.Key("faas.max_memory") | ||||
| ) | ||||
|  | ||||
| // Semantic conventions for operating system process resource attribute keys. | ||||
| // A host is defined as a general computing instance. | ||||
| const ( | ||||
| 	// Process identifier (PID). | ||||
| 	ProcessPIDKey = attribute.Key("process.pid") | ||||
| 	// The name of the process executable. On Linux based systems, can be | ||||
| 	// set to the `Name` in `proc/[pid]/status`. On Windows, can be set to | ||||
| 	// the base name of `GetProcessImageFileNameW`. | ||||
| 	ProcessExecutableNameKey = attribute.Key("process.executable.name") | ||||
| 	// The full path to the process executable. On Linux based systems, can | ||||
| 	// be set to the target of `proc/[pid]/exe`. On Windows, can be set to | ||||
| 	// the result of `GetProcessImageFileNameW`. | ||||
| 	ProcessExecutablePathKey = attribute.Key("process.executable.path") | ||||
| 	// The command used to launch the process (i.e. the command name). On | ||||
| 	// Linux based systems, can be set to the zeroth string in | ||||
| 	// `proc/[pid]/cmdline`. On Windows, can be set to the first parameter | ||||
| 	// extracted from `GetCommandLineW`. | ||||
| 	ProcessCommandKey = attribute.Key("process.command") | ||||
| 	// The full command used to launch the process. The value can be either | ||||
| 	// a list of strings representing the ordered list of arguments, or a | ||||
| 	// single string representing the full command. On Linux based systems, | ||||
| 	// can be set to the list of null-delimited strings extracted from | ||||
| 	// `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. | ||||
| const ( | ||||
| 	// A uniquely identifying name for the Kubernetes cluster. Kubernetes | ||||
| 	// does not have cluster names as an internal concept so this may be | ||||
| 	// set to any meaningful value within the environment. For example, | ||||
| 	// GKE clusters have a name which can be used for this attribute. | ||||
| 	K8SClusterNameKey = attribute.Key("k8s.cluster.name") | ||||
|  | ||||
| 	// The name of the Node. | ||||
| 	K8SNodeNameKey = attribute.Key("k8s.node.name") | ||||
|  | ||||
| 	// The UID of the Node. | ||||
| 	K8SNodeUIDKey = attribute.Key("k8s.node.uid") | ||||
|  | ||||
| 	// The name of the namespace that the pod is running in. | ||||
| 	K8SNamespaceNameKey = attribute.Key("k8s.namespace.name") | ||||
|  | ||||
| 	// The uid of the Pod. | ||||
| 	K8SPodUIDKey = attribute.Key("k8s.pod.uid") | ||||
|  | ||||
| 	// The name of the pod. | ||||
| 	K8SPodNameKey = attribute.Key("k8s.pod.name") | ||||
|  | ||||
| 	// The name of the Container in a Pod template. | ||||
| 	K8SContainerNameKey = attribute.Key("k8s.container.name") | ||||
|  | ||||
| 	// The uid of the ReplicaSet. | ||||
| 	K8SReplicaSetUIDKey = attribute.Key("k8s.replicaset.uid") | ||||
|  | ||||
| 	// The name of the ReplicaSet. | ||||
| 	K8SReplicaSetNameKey = attribute.Key("k8s.replicaset.name") | ||||
|  | ||||
| 	// The uid of the Deployment. | ||||
| 	K8SDeploymentUIDKey = attribute.Key("k8s.deployment.uid") | ||||
|  | ||||
| 	// The name of the deployment. | ||||
| 	K8SDeploymentNameKey = attribute.Key("k8s.deployment.name") | ||||
|  | ||||
| 	// The uid of the StatefulSet. | ||||
| 	K8SStatefulSetUIDKey = attribute.Key("k8s.statefulset.uid") | ||||
|  | ||||
| 	// The name of the StatefulSet. | ||||
| 	K8SStatefulSetNameKey = attribute.Key("k8s.statefulset.name") | ||||
|  | ||||
| 	// The uid of the DaemonSet. | ||||
| 	K8SDaemonSetUIDKey = attribute.Key("k8s.daemonset.uid") | ||||
|  | ||||
| 	// The name of the DaemonSet. | ||||
| 	K8SDaemonSetNameKey = attribute.Key("k8s.daemonset.name") | ||||
|  | ||||
| 	// The uid of the Job. | ||||
| 	K8SJobUIDKey = attribute.Key("k8s.job.uid") | ||||
|  | ||||
| 	// The name of the Job. | ||||
| 	K8SJobNameKey = attribute.Key("k8s.job.name") | ||||
|  | ||||
| 	// The uid of the CronJob. | ||||
| 	K8SCronJobUIDKey = attribute.Key("k8s.cronjob.uid") | ||||
|  | ||||
| 	// The name of the CronJob. | ||||
| 	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 | ||||
| 	HostNameKey = attribute.Key("host.name") | ||||
|  | ||||
| 	// Unique host ID. For cloud environments this will be the instance ID. | ||||
| 	// Unique host ID. For Cloud, this must be the instance_id assigned by the cloud | ||||
| 	// provider. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: 'opentelemetry-test' | ||||
| 	HostIDKey = attribute.Key("host.id") | ||||
|  | ||||
| 	// Type of host. For cloud environments this will be the machine type. | ||||
| 	// Name of the host. On Unix systems, it may contain what the hostname command | ||||
| 	// returns, or the fully qualified hostname, or another name specified by the | ||||
| 	// user. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: 'opentelemetry-test' | ||||
| 	HostNameKey = attribute.Key("host.name") | ||||
| 	// Type of host. For Cloud, this must be the machine type. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: 'n1-standard-1' | ||||
| 	HostTypeKey = attribute.Key("host.type") | ||||
|  | ||||
| 	// Name of the OS or VM image the host is running. | ||||
| 	// The CPU architecture the host system is running on. | ||||
| 	// | ||||
| 	// Type: Enum | ||||
| 	// Required: No | ||||
| 	HostArchKey = attribute.Key("host.arch") | ||||
| 	// Name of the VM image or OS install the host was instantiated from. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: 'infra-ami-eks-worker-node-7d4ec78312', 'CentOS-8-x86_64-1905' | ||||
| 	HostImageNameKey = attribute.Key("host.image.name") | ||||
|  | ||||
| 	// Identifier of the image the host is running. | ||||
| 	// VM image ID. For Cloud, this value is from the provider. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: 'ami-07b06b442921831e5' | ||||
| 	HostImageIDKey = attribute.Key("host.image.id") | ||||
|  | ||||
| 	// Version of the image the host is running. | ||||
| 	// The version string of the VM image as defined in [Version | ||||
| 	// Attributes](README.md#version-attributes). | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: '0.1' | ||||
| 	HostImageVersionKey = attribute.Key("host.image.version") | ||||
| ) | ||||
|  | ||||
| // Semantic conventions for cloud environment resource attribute keys. | ||||
| const ( | ||||
| 	// Name of the cloud provider. | ||||
| 	CloudProviderKey = attribute.Key("cloud.provider") | ||||
|  | ||||
| 	// The account ID from the cloud provider used for authorization. | ||||
| 	CloudAccountIDKey = attribute.Key("cloud.account.id") | ||||
|  | ||||
| 	// Geographical region where this resource is. | ||||
| 	CloudRegionKey = attribute.Key("cloud.region") | ||||
|  | ||||
| 	// Availability zone of the region where this resource is. | ||||
| 	CloudAvailabilityZoneKey = attribute.Key("cloud.availability_zone") | ||||
| ) | ||||
|  | ||||
| // Semantic conventions for common cloud provider resource attributes. | ||||
| var ( | ||||
| 	CloudProviderAWS   = CloudProviderKey.String("aws") | ||||
| 	CloudProviderAzure = CloudProviderKey.String("azure") | ||||
| 	CloudProviderGCP   = CloudProviderKey.String("gcp") | ||||
| 	// AMD64 | ||||
| 	HostArchAMD64 = HostArchKey.String("amd64") | ||||
| 	// ARM32 | ||||
| 	HostArchARM32 = HostArchKey.String("arm32") | ||||
| 	// ARM64 | ||||
| 	HostArchARM64 = HostArchKey.String("arm64") | ||||
| 	// Itanium | ||||
| 	HostArchIA64 = HostArchKey.String("ia64") | ||||
| 	// 32-bit PowerPC | ||||
| 	HostArchPPC32 = HostArchKey.String("ppc32") | ||||
| 	// 64-bit PowerPC | ||||
| 	HostArchPPC64 = HostArchKey.String("ppc64") | ||||
| 	// 32-bit x86 | ||||
| 	HostArchX86 = HostArchKey.String("x86") | ||||
| ) | ||||
|  | ||||
| // Semantic conventions for deployment attributes. | ||||
| // A Kubernetes Cluster. | ||||
| const ( | ||||
| 	// Name of the deployment environment (aka deployment tier); e.g. (staging, production). | ||||
| 	DeploymentEnvironmentKey = attribute.Key("deployment.environment") | ||||
| 	// The name of the cluster. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: 'opentelemetry-cluster' | ||||
| 	K8SClusterNameKey = attribute.Key("k8s.cluster.name") | ||||
| ) | ||||
|  | ||||
| // A Kubernetes Node object. | ||||
| const ( | ||||
| 	// The name of the Node. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: 'node-1' | ||||
| 	K8SNodeNameKey = attribute.Key("k8s.node.name") | ||||
| 	// The UID of the Node. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: '1eb3a0c6-0477-4080-a9cb-0cb7db65c6a2' | ||||
| 	K8SNodeUIDKey = attribute.Key("k8s.node.uid") | ||||
| ) | ||||
|  | ||||
| // A Kubernetes Namespace. | ||||
| const ( | ||||
| 	// The name of the namespace that the pod is running in. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: 'default' | ||||
| 	K8SNamespaceNameKey = attribute.Key("k8s.namespace.name") | ||||
| ) | ||||
|  | ||||
| // A Kubernetes Pod object. | ||||
| const ( | ||||
| 	// The UID of the Pod. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' | ||||
| 	K8SPodUIDKey = attribute.Key("k8s.pod.uid") | ||||
| 	// The name of the Pod. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: 'opentelemetry-pod-autoconf' | ||||
| 	K8SPodNameKey = attribute.Key("k8s.pod.name") | ||||
| ) | ||||
|  | ||||
| // A container in a [PodTemplate](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates). | ||||
| const ( | ||||
| 	// The name of the Container in a Pod template. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: 'redis' | ||||
| 	K8SContainerNameKey = attribute.Key("k8s.container.name") | ||||
| ) | ||||
|  | ||||
| // A Kubernetes ReplicaSet object. | ||||
| const ( | ||||
| 	// The UID of the ReplicaSet. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' | ||||
| 	K8SReplicasetUIDKey = attribute.Key("k8s.replicaset.uid") | ||||
| 	// The name of the ReplicaSet. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: 'opentelemetry' | ||||
| 	K8SReplicasetNameKey = attribute.Key("k8s.replicaset.name") | ||||
| ) | ||||
|  | ||||
| // A Kubernetes Deployment object. | ||||
| const ( | ||||
| 	// The UID of the Deployment. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' | ||||
| 	K8SDeploymentUIDKey = attribute.Key("k8s.deployment.uid") | ||||
| 	// The name of the Deployment. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: 'opentelemetry' | ||||
| 	K8SDeploymentNameKey = attribute.Key("k8s.deployment.name") | ||||
| ) | ||||
|  | ||||
| // A Kubernetes StatefulSet object. | ||||
| const ( | ||||
| 	// The UID of the StatefulSet. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' | ||||
| 	K8SStatefulsetUIDKey = attribute.Key("k8s.statefulset.uid") | ||||
| 	// The name of the StatefulSet. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: 'opentelemetry' | ||||
| 	K8SStatefulsetNameKey = attribute.Key("k8s.statefulset.name") | ||||
| ) | ||||
|  | ||||
| // A Kubernetes DaemonSet object. | ||||
| const ( | ||||
| 	// The UID of the DaemonSet. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' | ||||
| 	K8SDaemonsetUIDKey = attribute.Key("k8s.daemonset.uid") | ||||
| 	// The name of the DaemonSet. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: 'opentelemetry' | ||||
| 	K8SDaemonsetNameKey = attribute.Key("k8s.daemonset.name") | ||||
| ) | ||||
|  | ||||
| // A Kubernetes Job object. | ||||
| const ( | ||||
| 	// The UID of the Job. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' | ||||
| 	K8SJobUIDKey = attribute.Key("k8s.job.uid") | ||||
| 	// The name of the Job. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: 'opentelemetry' | ||||
| 	K8SJobNameKey = attribute.Key("k8s.job.name") | ||||
| ) | ||||
|  | ||||
| // A Kubernetes CronJob object. | ||||
| const ( | ||||
| 	// The UID of the CronJob. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' | ||||
| 	K8SCronJobUIDKey = attribute.Key("k8s.cronjob.uid") | ||||
| 	// The name of the CronJob. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: 'opentelemetry' | ||||
| 	K8SCronJobNameKey = attribute.Key("k8s.cronjob.name") | ||||
| ) | ||||
|  | ||||
| // The operating system (OS) on which the process represented by this resource is running. | ||||
| const ( | ||||
| 	// The operating system type. | ||||
| 	// | ||||
| 	// Type: Enum | ||||
| 	// Required: Always | ||||
| 	OSTypeKey = attribute.Key("os.type") | ||||
| 	// Human readable (not intended to be parsed) OS version information, like e.g. | ||||
| 	// reported by `ver` or `lsb_release -a` commands. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: 'Microsoft Windows [Version 10.0.18363.778]', 'Ubuntu 18.04.1 LTS' | ||||
| 	OSDescriptionKey = attribute.Key("os.description") | ||||
| ) | ||||
|  | ||||
| var ( | ||||
| 	// Microsoft Windows | ||||
| 	OSTypeWindows = OSTypeKey.String("windows") | ||||
| 	// Linux | ||||
| 	OSTypeLinux = OSTypeKey.String("linux") | ||||
| 	// Apple Darwin | ||||
| 	OSTypeDarwin = OSTypeKey.String("darwin") | ||||
| 	// FreeBSD | ||||
| 	OSTypeFreeBSD = OSTypeKey.String("freebsd") | ||||
| 	// NetBSD | ||||
| 	OSTypeNetBSD = OSTypeKey.String("netbsd") | ||||
| 	// OpenBSD | ||||
| 	OSTypeOpenBSD = OSTypeKey.String("openbsd") | ||||
| 	// DragonFly BSD | ||||
| 	OSTypeDragonflyBSD = OSTypeKey.String("dragonflybsd") | ||||
| 	// HP-UX (Hewlett Packard Unix) | ||||
| 	OSTypeHPUX = OSTypeKey.String("hpux") | ||||
| 	// AIX (Advanced Interactive eXecutive) | ||||
| 	OSTypeAIX = OSTypeKey.String("aix") | ||||
| 	// Oracle Solaris | ||||
| 	OSTypeSolaris = OSTypeKey.String("solaris") | ||||
| 	// IBM z/OS | ||||
| 	OSTypeZOS = OSTypeKey.String("z_os") | ||||
| ) | ||||
|  | ||||
| // An operating system process. | ||||
| const ( | ||||
| 	// Process identifier (PID). | ||||
| 	// | ||||
| 	// Type: int | ||||
| 	// Required: No | ||||
| 	// Examples: 1234 | ||||
| 	ProcessPIDKey = attribute.Key("process.pid") | ||||
| 	// The name of the process executable. On Linux based systems, can be set to the | ||||
| 	// `Name` in `proc/[pid]/status`. On Windows, can be set to the base name of | ||||
| 	// `GetProcessImageFileNameW`. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: See below | ||||
| 	// Examples: 'otelcol' | ||||
| 	ProcessExecutableNameKey = attribute.Key("process.executable.name") | ||||
| 	// The full path to the process executable. On Linux based systems, can be set to | ||||
| 	// the target of `proc/[pid]/exe`. On Windows, can be set to the result of | ||||
| 	// `GetProcessImageFileNameW`. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: See below | ||||
| 	// Examples: '/usr/bin/cmd/otelcol' | ||||
| 	ProcessExecutablePathKey = attribute.Key("process.executable.path") | ||||
| 	// The command used to launch the process (i.e. the command name). On Linux based | ||||
| 	// systems, can be set to the zeroth string in `proc/[pid]/cmdline`. On Windows, | ||||
| 	// can be set to the first parameter extracted from `GetCommandLineW`. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: See below | ||||
| 	// Examples: 'cmd/otelcol' | ||||
| 	ProcessCommandKey = attribute.Key("process.command") | ||||
| 	// The full command used to launch the process as a single string representing the | ||||
| 	// full command. On Windows, can be set to the result of `GetCommandLineW`. Do not | ||||
| 	// set this if you have to assemble it just for monitoring; use | ||||
| 	// `process.command_args` instead. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: See below | ||||
| 	// Examples: 'C:\\cmd\\otecol --config="my directory\\config.yaml"' | ||||
| 	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`. | ||||
| 	// | ||||
| 	// Type: string[] | ||||
| 	// Required: See below | ||||
| 	// Examples: 'cmd/otecol', '--config=config.yaml' | ||||
| 	ProcessCommandArgsKey = attribute.Key("process.command_args") | ||||
| 	// The username of the user that owns the process. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: 'root' | ||||
| 	ProcessOwnerKey = attribute.Key("process.owner") | ||||
| ) | ||||
|  | ||||
| // The single (language) runtime instance which is monitored. | ||||
| const ( | ||||
| 	// The name of the runtime of this process. For compiled native binaries, this | ||||
| 	// SHOULD be the name of the compiler. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: 'OpenJDK Runtime Environment' | ||||
| 	ProcessRuntimeNameKey = attribute.Key("process.runtime.name") | ||||
| 	// The version of the runtime of this process, as returned by the runtime without | ||||
| 	// modification. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: '14.0.2' | ||||
| 	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. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: 'Eclipse OpenJ9 Eclipse OpenJ9 VM openj9-0.21.0' | ||||
| 	ProcessRuntimeDescriptionKey = attribute.Key("process.runtime.description") | ||||
| ) | ||||
|  | ||||
| // A service instance. | ||||
| const ( | ||||
| 	// Logical name of the service. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: Always | ||||
| 	// Examples: 'shoppingcart' | ||||
| 	// Note: MUST be the same for all instances of horizontally scaled services. If | ||||
| 	// the value was not specified, SDKs MUST fallback to `unknown_service:` | ||||
| 	// concatenated with [`process.executable.name`](process.md#process), e.g. | ||||
| 	// `unknown_service:bash`. If `process.executable.name` is not available, the | ||||
| 	// value MUST be set to `unknown_service`. | ||||
| 	ServiceNameKey = attribute.Key("service.name") | ||||
| 	// A namespace for `service.name`. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: 'Shop' | ||||
| 	// Note: A string value having a meaning that helps to distinguish a group of | ||||
| 	// services, for example the team name that owns a group of services. | ||||
| 	// `service.name` is expected to be unique within the same namespace. If | ||||
| 	// `service.namespace` is not specified in the Resource then `service.name` is | ||||
| 	// expected to be unique for all services that have no explicit namespace defined | ||||
| 	// (so the empty/unspecified namespace is simply one more valid namespace). Zero- | ||||
| 	// length namespace string is assumed equal to unspecified namespace. | ||||
| 	ServiceNamespaceKey = attribute.Key("service.namespace") | ||||
| 	// The string ID of the service instance. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: '627cc493-f310-47de-96bd-71410b7dec09' | ||||
| 	// Note: MUST be unique for each instance of the same | ||||
| 	// `service.namespace,service.name` pair (in other words | ||||
| 	// `service.namespace,service.name,service.instance.id` triplet MUST be globally | ||||
| 	// unique). The ID helps to distinguish instances of the same service that exist | ||||
| 	// at the same time (e.g. instances of a horizontally scaled service). It is | ||||
| 	// preferable for the ID to be persistent and stay the same for the lifetime of | ||||
| 	// the service instance, however it is acceptable that the ID is ephemeral and | ||||
| 	// changes during important lifetime events for the service (e.g. service | ||||
| 	// restarts). If the service has no inherent unique ID that can be used as the | ||||
| 	// value of this attribute it is recommended to generate a random Version 1 or | ||||
| 	// Version 4 RFC 4122 UUID (services aiming for reproducible UUIDs may also use | ||||
| 	// Version 5, see RFC 4122 for more recommendations). | ||||
| 	ServiceInstanceIDKey = attribute.Key("service.instance.id") | ||||
| 	// The version string of the service API or implementation. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: '2.0.0' | ||||
| 	ServiceVersionKey = attribute.Key("service.version") | ||||
| ) | ||||
|  | ||||
| // The telemetry SDK used to capture data recorded by the instrumentation libraries. | ||||
| const ( | ||||
| 	// The name of the telemetry SDK as defined above. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: 'opentelemetry' | ||||
| 	TelemetrySDKNameKey = attribute.Key("telemetry.sdk.name") | ||||
| 	// The language of the telemetry SDK. | ||||
| 	// | ||||
| 	// Type: Enum | ||||
| 	// Required: No | ||||
| 	TelemetrySDKLanguageKey = attribute.Key("telemetry.sdk.language") | ||||
| 	// The version string of the telemetry SDK. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: '1.2.3' | ||||
| 	TelemetrySDKVersionKey = attribute.Key("telemetry.sdk.version") | ||||
| 	// The version string of the auto instrumentation agent, if used. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: '1.2.3' | ||||
| 	TelemetryAutoVersionKey = attribute.Key("telemetry.auto.version") | ||||
| ) | ||||
|  | ||||
| var ( | ||||
| 	// cpp | ||||
| 	TelemetrySDKLanguageCpp = TelemetrySDKLanguageKey.String("cpp") | ||||
| 	// dotnet | ||||
| 	TelemetrySDKLanguageDotnet = TelemetrySDKLanguageKey.String("dotnet") | ||||
| 	// erlang | ||||
| 	TelemetrySDKLanguageErlang = TelemetrySDKLanguageKey.String("erlang") | ||||
| 	// go | ||||
| 	TelemetrySDKLanguageGo = TelemetrySDKLanguageKey.String("go") | ||||
| 	// java | ||||
| 	TelemetrySDKLanguageJava = TelemetrySDKLanguageKey.String("java") | ||||
| 	// nodejs | ||||
| 	TelemetrySDKLanguageNodejs = TelemetrySDKLanguageKey.String("nodejs") | ||||
| 	// php | ||||
| 	TelemetrySDKLanguagePHP = TelemetrySDKLanguageKey.String("php") | ||||
| 	// python | ||||
| 	TelemetrySDKLanguagePython = TelemetrySDKLanguageKey.String("python") | ||||
| 	// ruby | ||||
| 	TelemetrySDKLanguageRuby = TelemetrySDKLanguageKey.String("ruby") | ||||
| 	// webjs | ||||
| 	TelemetrySDKLanguageWebjs = TelemetrySDKLanguageKey.String("webjs") | ||||
| ) | ||||
|  | ||||
| // Resource describing the packaged software running the application code. Web engines are typically executed using process.runtime. | ||||
| const ( | ||||
| 	// The name of the web engine. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: Always | ||||
| 	// Examples: 'WildFly' | ||||
| 	WebEngineNameKey = attribute.Key("webengine.name") | ||||
| 	// The version of the web engine. | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: '21.0.0' | ||||
| 	WebEngineVersionKey = attribute.Key("webengine.version") | ||||
| 	// Additional description of the web engine (e.g. detailed version and edition | ||||
| 	// information). | ||||
| 	// | ||||
| 	// Type: string | ||||
| 	// Required: No | ||||
| 	// Examples: 'WildFly Full 21.0.0.Final (WildFly Core 13.0.1.Final) - 2.2.2.Final' | ||||
| 	WebEngineDescriptionKey = attribute.Key("webengine.description") | ||||
| ) | ||||
|   | ||||
							
								
								
									
										1467
									
								
								semconv/trace.go
									
									
									
									
									
								
							
							
						
						
									
										1467
									
								
								semconv/trace.go
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Reference in New Issue
	
	Block a user