lazydocker/vendor/go.opentelemetry.io/auto/sdk/internal/telemetry/scope.go
NITIN VARMA MANTHENA 1c9dca459a Upgrade Docker client to v29.0.2
Updates github.com/docker/cli from v27.1.1 to v29.0.2 to use the latest Docker client API.

  This upgrade includes required dependency updates:
  - Added github.com/moby/moby/client v0.1.0
  - Added github.com/moby/moby/api v1.52.0
  - Updated github.com/docker/go-connections v0.5.0 → v0.6.0
  - Updated github.com/opencontainers/image-spec v1.1.0 → v1.1.1
  - Updated OpenTelemetry packages (v1.28.0 → v1.35.0)
  - Updated golang.org/x/sys v0.24.0 → v0.33.0

  All changes tested and build verified successfully.
2025-11-17 15:16:16 -05:00

67 lines
1.4 KiB
Go

// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
package telemetry
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io"
)
// Scope is the identifying values of the instrumentation scope.
type Scope struct {
Name string `json:"name,omitempty"`
Version string `json:"version,omitempty"`
Attrs []Attr `json:"attributes,omitempty"`
DroppedAttrs uint32 `json:"droppedAttributesCount,omitempty"`
}
// UnmarshalJSON decodes the OTLP formatted JSON contained in data into r.
func (s *Scope) UnmarshalJSON(data []byte) error {
decoder := json.NewDecoder(bytes.NewReader(data))
t, err := decoder.Token()
if err != nil {
return err
}
if t != json.Delim('{') {
return errors.New("invalid Scope type")
}
for decoder.More() {
keyIface, err := decoder.Token()
if err != nil {
if errors.Is(err, io.EOF) {
// Empty.
return nil
}
return err
}
key, ok := keyIface.(string)
if !ok {
return fmt.Errorf("invalid Scope field: %#v", keyIface)
}
switch key {
case "name":
err = decoder.Decode(&s.Name)
case "version":
err = decoder.Decode(&s.Version)
case "attributes":
err = decoder.Decode(&s.Attrs)
case "droppedAttributesCount", "dropped_attributes_count":
err = decoder.Decode(&s.DroppedAttrs)
default:
// Skip unknown.
}
if err != nil {
return err
}
}
return nil
}