Source File
resource.go
Belonging Package
go.opentelemetry.io/auto/sdk/internal/telemetry
// Copyright The OpenTelemetry Authors// SPDX-License-Identifier: Apache-2.0package telemetryimport ()// Resource information.type Resource struct {// Attrs are the set of attributes that describe the resource. Attribute// keys MUST be unique (it is not allowed to have more than one attribute// with the same key).Attrs []Attr `json:"attributes,omitempty"`// DroppedAttrs is the number of dropped attributes. If the value// is 0, then no attributes were dropped.DroppedAttrs uint32 `json:"droppedAttributesCount,omitempty"`}// UnmarshalJSON decodes the OTLP formatted JSON contained in data into r.func ( *Resource) ( []byte) error {:= json.NewDecoder(bytes.NewReader()), := .Token()if != nil {return}if != json.Delim('{') {return errors.New("invalid Resource type")}for .More() {, := .Token()if != nil {if errors.Is(, io.EOF) {// Empty.return nil}return}, := .(string)if ! {return fmt.Errorf("invalid Resource field: %#v", )}switch {case "attributes":= .Decode(&.Attrs)case "droppedAttributesCount", "dropped_attributes_count":= .Decode(&.DroppedAttrs)default:// Skip unknown.}if != nil {return}}return nil}
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |