mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
rebase: update kubernetes to latest
updating the kubernetes release to the latest in main go.mod Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
committed by
mergify[bot]
parent
63c4c05b35
commit
5a66991bb3
3
vendor/go.opentelemetry.io/otel/sdk/README.md
generated
vendored
Normal file
3
vendor/go.opentelemetry.io/otel/sdk/README.md
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# SDK
|
||||
|
||||
[](https://pkg.go.dev/go.opentelemetry.io/otel/sdk)
|
3
vendor/go.opentelemetry.io/otel/sdk/instrumentation/README.md
generated
vendored
Normal file
3
vendor/go.opentelemetry.io/otel/sdk/instrumentation/README.md
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# SDK Instrumentation
|
||||
|
||||
[](https://pkg.go.dev/go.opentelemetry.io/otel/sdk/instrumentation)
|
13
vendor/go.opentelemetry.io/otel/sdk/instrumentation/doc.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/sdk/instrumentation/doc.go
generated
vendored
@ -1,16 +1,5 @@
|
||||
// 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.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Package instrumentation provides types to represent the code libraries that
|
||||
// provide OpenTelemetry instrumentation. These types are used in the
|
||||
|
13
vendor/go.opentelemetry.io/otel/sdk/instrumentation/library.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/sdk/instrumentation/library.go
generated
vendored
@ -1,16 +1,5 @@
|
||||
// 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.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package instrumentation // import "go.opentelemetry.io/otel/sdk/instrumentation"
|
||||
|
||||
|
13
vendor/go.opentelemetry.io/otel/sdk/instrumentation/scope.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/sdk/instrumentation/scope.go
generated
vendored
@ -1,16 +1,5 @@
|
||||
// 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.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package instrumentation // import "go.opentelemetry.io/otel/sdk/instrumentation"
|
||||
|
||||
|
15
vendor/go.opentelemetry.io/otel/sdk/internal/env/env.go
generated
vendored
15
vendor/go.opentelemetry.io/otel/sdk/internal/env/env.go
generated
vendored
@ -1,16 +1,5 @@
|
||||
// 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.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package env // import "go.opentelemetry.io/otel/sdk/internal/env"
|
||||
|
||||
@ -33,7 +22,7 @@ const (
|
||||
BatchSpanProcessorMaxQueueSizeKey = "OTEL_BSP_MAX_QUEUE_SIZE"
|
||||
// BatchSpanProcessorMaxExportBatchSizeKey is the maximum batch size (i.e.
|
||||
// 512). Note: it must be less than or equal to
|
||||
// EnvBatchSpanProcessorMaxQueueSize.
|
||||
// BatchSpanProcessorMaxQueueSize.
|
||||
BatchSpanProcessorMaxExportBatchSizeKey = "OTEL_BSP_MAX_EXPORT_BATCH_SIZE"
|
||||
|
||||
// AttributeValueLengthKey is the maximum allowed attribute value size.
|
||||
|
29
vendor/go.opentelemetry.io/otel/sdk/internal/gen.go
generated
vendored
29
vendor/go.opentelemetry.io/otel/sdk/internal/gen.go
generated
vendored
@ -1,29 +0,0 @@
|
||||
// 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 internal // import "go.opentelemetry.io/otel/sdk/internal"
|
||||
|
||||
//go:generate gotmpl --body=../../internal/shared/matchers/expectation.go.tmpl "--data={}" --out=matchers/expectation.go
|
||||
//go:generate gotmpl --body=../../internal/shared/matchers/expecter.go.tmpl "--data={}" --out=matchers/expecter.go
|
||||
//go:generate gotmpl --body=../../internal/shared/matchers/temporal_matcher.go.tmpl "--data={}" --out=matchers/temporal_matcher.go
|
||||
|
||||
//go:generate gotmpl --body=../../internal/shared/internaltest/alignment.go.tmpl "--data={}" --out=internaltest/alignment.go
|
||||
//go:generate gotmpl --body=../../internal/shared/internaltest/env.go.tmpl "--data={}" --out=internaltest/env.go
|
||||
//go:generate gotmpl --body=../../internal/shared/internaltest/env_test.go.tmpl "--data={}" --out=internaltest/env_test.go
|
||||
//go:generate gotmpl --body=../../internal/shared/internaltest/errors.go.tmpl "--data={}" --out=internaltest/errors.go
|
||||
//go:generate gotmpl --body=../../internal/shared/internaltest/harness.go.tmpl "--data={\"matchersImportPath\": \"go.opentelemetry.io/otel/sdk/internal/matchers\"}" --out=internaltest/harness.go
|
||||
//go:generate gotmpl --body=../../internal/shared/internaltest/text_map_carrier.go.tmpl "--data={}" --out=internaltest/text_map_carrier.go
|
||||
//go:generate gotmpl --body=../../internal/shared/internaltest/text_map_carrier_test.go.tmpl "--data={}" --out=internaltest/text_map_carrier_test.go
|
||||
//go:generate gotmpl --body=../../internal/shared/internaltest/text_map_propagator.go.tmpl "--data={}" --out=internaltest/text_map_propagator.go
|
||||
//go:generate gotmpl --body=../../internal/shared/internaltest/text_map_propagator_test.go.tmpl "--data={}" --out=internaltest/text_map_propagator_test.go
|
28
vendor/go.opentelemetry.io/otel/sdk/internal/internal.go
generated
vendored
28
vendor/go.opentelemetry.io/otel/sdk/internal/internal.go
generated
vendored
@ -1,28 +0,0 @@
|
||||
// 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 internal // import "go.opentelemetry.io/otel/sdk/internal"
|
||||
|
||||
import "time"
|
||||
|
||||
// MonotonicEndTime returns the end time at present
|
||||
// but offset from start, monotonically.
|
||||
//
|
||||
// The monotonic clock is used in subtractions hence
|
||||
// the duration since start added back to start gives
|
||||
// end as a monotonic time.
|
||||
// See https://golang.org/pkg/time/#hdr-Monotonic_Clocks
|
||||
func MonotonicEndTime(start time.Time) time.Time {
|
||||
return start.Add(time.Since(start))
|
||||
}
|
46
vendor/go.opentelemetry.io/otel/sdk/internal/x/README.md
generated
vendored
Normal file
46
vendor/go.opentelemetry.io/otel/sdk/internal/x/README.md
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
# Experimental Features
|
||||
|
||||
The SDK contains features that have not yet stabilized in the OpenTelemetry specification.
|
||||
These features are added to the OpenTelemetry Go SDK prior to stabilization in the specification so that users can start experimenting with them and provide feedback.
|
||||
|
||||
These feature may change in backwards incompatible ways as feedback is applied.
|
||||
See the [Compatibility and Stability](#compatibility-and-stability) section for more information.
|
||||
|
||||
## Features
|
||||
|
||||
- [Resource](#resource)
|
||||
|
||||
### Resource
|
||||
|
||||
[OpenTelemetry resource semantic conventions] include many attribute definitions that are defined as experimental.
|
||||
To have experimental semantic conventions be added by [resource detectors] set the `OTEL_GO_X_RESOURCE` environment variable.
|
||||
The value set must be the case-insensitive string of `"true"` to enable the feature.
|
||||
All other values are ignored.
|
||||
|
||||
<!-- TODO: document what attributes are added by which detector -->
|
||||
|
||||
[OpenTelemetry resource semantic conventions]: https://opentelemetry.io/docs/specs/semconv/resource/
|
||||
[resource detectors]: https://pkg.go.dev/go.opentelemetry.io/otel/sdk/resource#Detector
|
||||
|
||||
#### Examples
|
||||
|
||||
Enable experimental resource semantic conventions.
|
||||
|
||||
```console
|
||||
export OTEL_GO_X_RESOURCE=true
|
||||
```
|
||||
|
||||
Disable experimental resource semantic conventions.
|
||||
|
||||
```console
|
||||
unset OTEL_GO_X_RESOURCE
|
||||
```
|
||||
|
||||
## Compatibility and Stability
|
||||
|
||||
Experimental features do not fall within the scope of the OpenTelemetry Go versioning and stability [policy](../../../VERSIONING.md).
|
||||
These features may be removed or modified in successive version releases, including patch versions.
|
||||
|
||||
When an experimental feature is promoted to a stable feature, a migration path will be included in the changelog entry of the release.
|
||||
There is no guarantee that any environment variable feature flags that enabled the experimental feature will be supported by the stable version.
|
||||
If they are supported, they may be accompanied with a deprecation notice stating a timeline for the removal of that support.
|
66
vendor/go.opentelemetry.io/otel/sdk/internal/x/x.go
generated
vendored
Normal file
66
vendor/go.opentelemetry.io/otel/sdk/internal/x/x.go
generated
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
// Copyright The OpenTelemetry Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Package x contains support for OTel SDK experimental features.
|
||||
//
|
||||
// This package should only be used for features defined in the specification.
|
||||
// It should not be used for experiments or new project ideas.
|
||||
package x // import "go.opentelemetry.io/otel/sdk/internal/x"
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Resource is an experimental feature flag that defines if resource detectors
|
||||
// should be included experimental semantic conventions.
|
||||
//
|
||||
// To enable this feature set the OTEL_GO_X_RESOURCE environment variable
|
||||
// to the case-insensitive string value of "true" (i.e. "True" and "TRUE"
|
||||
// will also enable this).
|
||||
var Resource = newFeature("RESOURCE", func(v string) (string, bool) {
|
||||
if strings.ToLower(v) == "true" {
|
||||
return v, true
|
||||
}
|
||||
return "", false
|
||||
})
|
||||
|
||||
// Feature is an experimental feature control flag. It provides a uniform way
|
||||
// to interact with these feature flags and parse their values.
|
||||
type Feature[T any] struct {
|
||||
key string
|
||||
parse func(v string) (T, bool)
|
||||
}
|
||||
|
||||
func newFeature[T any](suffix string, parse func(string) (T, bool)) Feature[T] {
|
||||
const envKeyRoot = "OTEL_GO_X_"
|
||||
return Feature[T]{
|
||||
key: envKeyRoot + suffix,
|
||||
parse: parse,
|
||||
}
|
||||
}
|
||||
|
||||
// Key returns the environment variable key that needs to be set to enable the
|
||||
// feature.
|
||||
func (f Feature[T]) Key() string { return f.key }
|
||||
|
||||
// Lookup returns the user configured value for the feature and true if the
|
||||
// user has enabled the feature. Otherwise, if the feature is not enabled, a
|
||||
// zero-value and false are returned.
|
||||
func (f Feature[T]) Lookup() (v T, ok bool) {
|
||||
// https://github.com/open-telemetry/opentelemetry-specification/blob/62effed618589a0bec416a87e559c0a9d96289bb/specification/configuration/sdk-environment-variables.md#parsing-empty-value
|
||||
//
|
||||
// > The SDK MUST interpret an empty value of an environment variable the
|
||||
// > same way as when the variable is unset.
|
||||
vRaw := os.Getenv(f.key)
|
||||
if vRaw == "" {
|
||||
return v, ok
|
||||
}
|
||||
return f.parse(vRaw)
|
||||
}
|
||||
|
||||
// Enabled returns if the feature is enabled.
|
||||
func (f Feature[T]) Enabled() bool {
|
||||
_, ok := f.Lookup()
|
||||
return ok
|
||||
}
|
3
vendor/go.opentelemetry.io/otel/sdk/resource/README.md
generated
vendored
Normal file
3
vendor/go.opentelemetry.io/otel/sdk/resource/README.md
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# SDK Resource
|
||||
|
||||
[](https://pkg.go.dev/go.opentelemetry.io/otel/sdk/resource)
|
38
vendor/go.opentelemetry.io/otel/sdk/resource/auto.go
generated
vendored
38
vendor/go.opentelemetry.io/otel/sdk/resource/auto.go
generated
vendored
@ -1,16 +1,5 @@
|
||||
// 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.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
||||
|
||||
@ -41,8 +30,20 @@ type Detector interface {
|
||||
// must never be done outside of a new major release.
|
||||
}
|
||||
|
||||
// Detect calls all input detectors sequentially and merges each result with the previous one.
|
||||
// It returns the merged error too.
|
||||
// Detect returns a new [Resource] merged from all the Resources each of the
|
||||
// detectors produces. Each of the detectors are called sequentially, in the
|
||||
// order they are passed, merging the produced resource into the previous.
|
||||
//
|
||||
// This may return a partial Resource along with an error containing
|
||||
// [ErrPartialResource] if that error is returned from a detector. It may also
|
||||
// return a merge-conflicting Resource along with an error containing
|
||||
// [ErrSchemaURLConflict] if merging Resources from different detectors results
|
||||
// in a schema URL conflict. It is up to the caller to determine if this
|
||||
// returned Resource should be used or not.
|
||||
//
|
||||
// If one of the detectors returns an error that is not [ErrPartialResource],
|
||||
// the resource produced by the detector will not be merged and the returned
|
||||
// error will wrap that detector's error.
|
||||
func Detect(ctx context.Context, detectors ...Detector) (*Resource, error) {
|
||||
r := new(Resource)
|
||||
return r, detect(ctx, r, detectors)
|
||||
@ -50,6 +51,10 @@ func Detect(ctx context.Context, detectors ...Detector) (*Resource, error) {
|
||||
|
||||
// detect runs all detectors using ctx and merges the result into res. This
|
||||
// assumes res is allocated and not nil, it will panic otherwise.
|
||||
//
|
||||
// If the detectors or merging resources produces any errors (i.e.
|
||||
// [ErrPartialResource] [ErrSchemaURLConflict]), a single error wrapping all of
|
||||
// these errors will be returned. Otherwise, nil is returned.
|
||||
func detect(ctx context.Context, res *Resource, detectors []Detector) error {
|
||||
var (
|
||||
r *Resource
|
||||
@ -78,6 +83,11 @@ func detect(ctx context.Context, res *Resource, detectors []Detector) error {
|
||||
if len(errs) == 0 {
|
||||
return nil
|
||||
}
|
||||
if errors.Is(errs, ErrSchemaURLConflict) {
|
||||
// If there has been a merge conflict, ensure the resource has no
|
||||
// schema URL.
|
||||
res.schemaURL = ""
|
||||
}
|
||||
return errs
|
||||
}
|
||||
|
||||
|
36
vendor/go.opentelemetry.io/otel/sdk/resource/builtin.go
generated
vendored
36
vendor/go.opentelemetry.io/otel/sdk/resource/builtin.go
generated
vendored
@ -1,16 +1,5 @@
|
||||
// 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.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
||||
|
||||
@ -20,9 +9,11 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/google/uuid"
|
||||
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/sdk"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.26.0"
|
||||
)
|
||||
|
||||
type (
|
||||
@ -47,6 +38,8 @@ type (
|
||||
}
|
||||
|
||||
defaultServiceNameDetector struct{}
|
||||
|
||||
defaultServiceInstanceIDDetector struct{}
|
||||
)
|
||||
|
||||
var (
|
||||
@ -54,6 +47,7 @@ var (
|
||||
_ Detector = host{}
|
||||
_ Detector = stringDetector{}
|
||||
_ Detector = defaultServiceNameDetector{}
|
||||
_ Detector = defaultServiceInstanceIDDetector{}
|
||||
)
|
||||
|
||||
// Detect returns a *Resource that describes the OpenTelemetry SDK used.
|
||||
@ -106,3 +100,19 @@ func (defaultServiceNameDetector) Detect(ctx context.Context) (*Resource, error)
|
||||
},
|
||||
).Detect(ctx)
|
||||
}
|
||||
|
||||
// Detect implements Detector.
|
||||
func (defaultServiceInstanceIDDetector) Detect(ctx context.Context) (*Resource, error) {
|
||||
return StringDetector(
|
||||
semconv.SchemaURL,
|
||||
semconv.ServiceInstanceIDKey,
|
||||
func() (string, error) {
|
||||
version4Uuid, err := uuid.NewRandom()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return version4Uuid.String(), nil
|
||||
},
|
||||
).Detect(ctx)
|
||||
}
|
||||
|
13
vendor/go.opentelemetry.io/otel/sdk/resource/config.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/sdk/resource/config.go
generated
vendored
@ -1,16 +1,5 @@
|
||||
// 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.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
||||
|
||||
|
17
vendor/go.opentelemetry.io/otel/sdk/resource/container.go
generated
vendored
17
vendor/go.opentelemetry.io/otel/sdk/resource/container.go
generated
vendored
@ -1,16 +1,5 @@
|
||||
// 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.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
||||
|
||||
@ -22,14 +11,14 @@ import (
|
||||
"os"
|
||||
"regexp"
|
||||
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.26.0"
|
||||
)
|
||||
|
||||
type containerIDProvider func() (string, error)
|
||||
|
||||
var (
|
||||
containerID containerIDProvider = getContainerIDFromCGroup
|
||||
cgroupContainerIDRe = regexp.MustCompile(`^.*/(?:.*-)?([0-9a-f]+)(?:\.|\s*$)`)
|
||||
cgroupContainerIDRe = regexp.MustCompile(`^.*/(?:.*[-:])?([0-9a-f]+)(?:\.|\s*$)`)
|
||||
)
|
||||
|
||||
type cgroupContainerIDDetector struct{}
|
||||
|
13
vendor/go.opentelemetry.io/otel/sdk/resource/doc.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/sdk/resource/doc.go
generated
vendored
@ -1,16 +1,5 @@
|
||||
// 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.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Package resource provides detecting and representing resources.
|
||||
//
|
||||
|
15
vendor/go.opentelemetry.io/otel/sdk/resource/env.go
generated
vendored
15
vendor/go.opentelemetry.io/otel/sdk/resource/env.go
generated
vendored
@ -1,16 +1,5 @@
|
||||
// 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.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
||||
|
||||
@ -23,7 +12,7 @@ import (
|
||||
|
||||
"go.opentelemetry.io/otel"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.26.0"
|
||||
)
|
||||
|
||||
const (
|
||||
|
15
vendor/go.opentelemetry.io/otel/sdk/resource/host_id.go
generated
vendored
15
vendor/go.opentelemetry.io/otel/sdk/resource/host_id.go
generated
vendored
@ -1,16 +1,5 @@
|
||||
// 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.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
||||
|
||||
@ -19,7 +8,7 @@ import (
|
||||
"errors"
|
||||
"strings"
|
||||
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.26.0"
|
||||
)
|
||||
|
||||
type hostIDProvider func() (string, error)
|
||||
|
13
vendor/go.opentelemetry.io/otel/sdk/resource/host_id_bsd.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/sdk/resource/host_id_bsd.go
generated
vendored
@ -1,16 +1,5 @@
|
||||
// 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.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
//go:build dragonfly || freebsd || netbsd || openbsd || solaris
|
||||
// +build dragonfly freebsd netbsd openbsd solaris
|
||||
|
13
vendor/go.opentelemetry.io/otel/sdk/resource/host_id_darwin.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/sdk/resource/host_id_darwin.go
generated
vendored
@ -1,16 +1,5 @@
|
||||
// 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.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
||||
|
||||
|
13
vendor/go.opentelemetry.io/otel/sdk/resource/host_id_exec.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/sdk/resource/host_id_exec.go
generated
vendored
@ -1,16 +1,5 @@
|
||||
// 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.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
//go:build darwin || dragonfly || freebsd || netbsd || openbsd || solaris
|
||||
|
||||
|
13
vendor/go.opentelemetry.io/otel/sdk/resource/host_id_linux.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/sdk/resource/host_id_linux.go
generated
vendored
@ -1,16 +1,5 @@
|
||||
// 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.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
//go:build linux
|
||||
// +build linux
|
||||
|
13
vendor/go.opentelemetry.io/otel/sdk/resource/host_id_readfile.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/sdk/resource/host_id_readfile.go
generated
vendored
@ -1,16 +1,5 @@
|
||||
// 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.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
//go:build linux || dragonfly || freebsd || netbsd || openbsd || solaris
|
||||
|
||||
|
23
vendor/go.opentelemetry.io/otel/sdk/resource/host_id_unsupported.go
generated
vendored
23
vendor/go.opentelemetry.io/otel/sdk/resource/host_id_unsupported.go
generated
vendored
@ -1,25 +1,8 @@
|
||||
// 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.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// +build !darwin
|
||||
// +build !dragonfly
|
||||
// +build !freebsd
|
||||
// +build !linux
|
||||
// +build !netbsd
|
||||
// +build !openbsd
|
||||
// +build !solaris
|
||||
// +build !windows
|
||||
//go:build !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !windows
|
||||
// +build !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows
|
||||
|
||||
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
||||
|
||||
|
13
vendor/go.opentelemetry.io/otel/sdk/resource/host_id_windows.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/sdk/resource/host_id_windows.go
generated
vendored
@ -1,16 +1,5 @@
|
||||
// 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.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
//go:build windows
|
||||
// +build windows
|
||||
|
15
vendor/go.opentelemetry.io/otel/sdk/resource/os.go
generated
vendored
15
vendor/go.opentelemetry.io/otel/sdk/resource/os.go
generated
vendored
@ -1,16 +1,5 @@
|
||||
// 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.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
||||
|
||||
@ -19,7 +8,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.26.0"
|
||||
)
|
||||
|
||||
type osDescriptionProvider func() (string, error)
|
||||
|
13
vendor/go.opentelemetry.io/otel/sdk/resource/os_release_darwin.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/sdk/resource/os_release_darwin.go
generated
vendored
@ -1,16 +1,5 @@
|
||||
// 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.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
||||
|
||||
|
13
vendor/go.opentelemetry.io/otel/sdk/resource/os_release_unix.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/sdk/resource/os_release_unix.go
generated
vendored
@ -1,16 +1,5 @@
|
||||
// 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.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
//go:build aix || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
|
||||
// +build aix dragonfly freebsd linux netbsd openbsd solaris zos
|
||||
|
13
vendor/go.opentelemetry.io/otel/sdk/resource/os_unix.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/sdk/resource/os_unix.go
generated
vendored
@ -1,16 +1,5 @@
|
||||
// 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.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
|
||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
|
||||
|
25
vendor/go.opentelemetry.io/otel/sdk/resource/os_unsupported.go
generated
vendored
25
vendor/go.opentelemetry.io/otel/sdk/resource/os_unsupported.go
generated
vendored
@ -1,27 +1,8 @@
|
||||
// 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.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// +build !aix
|
||||
// +build !darwin
|
||||
// +build !dragonfly
|
||||
// +build !freebsd
|
||||
// +build !linux
|
||||
// +build !netbsd
|
||||
// +build !openbsd
|
||||
// +build !solaris
|
||||
// +build !windows
|
||||
// +build !zos
|
||||
//go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !windows && !zos
|
||||
// +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows,!zos
|
||||
|
||||
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
||||
|
||||
|
13
vendor/go.opentelemetry.io/otel/sdk/resource/os_windows.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/sdk/resource/os_windows.go
generated
vendored
@ -1,16 +1,5 @@
|
||||
// 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.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
||||
|
||||
|
15
vendor/go.opentelemetry.io/otel/sdk/resource/process.go
generated
vendored
15
vendor/go.opentelemetry.io/otel/sdk/resource/process.go
generated
vendored
@ -1,16 +1,5 @@
|
||||
// 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.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
||||
|
||||
@ -22,7 +11,7 @@ import (
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.26.0"
|
||||
)
|
||||
|
||||
type (
|
||||
|
103
vendor/go.opentelemetry.io/otel/sdk/resource/resource.go
generated
vendored
103
vendor/go.opentelemetry.io/otel/sdk/resource/resource.go
generated
vendored
@ -1,26 +1,17 @@
|
||||
// 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.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
"go.opentelemetry.io/otel"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/sdk/internal/x"
|
||||
)
|
||||
|
||||
// Resource describes an entity about which identifying information
|
||||
@ -40,9 +31,20 @@ var (
|
||||
defaultResourceOnce sync.Once
|
||||
)
|
||||
|
||||
var errMergeConflictSchemaURL = errors.New("cannot merge resource due to conflicting Schema URL")
|
||||
// ErrSchemaURLConflict is an error returned when two Resources are merged
|
||||
// together that contain different, non-empty, schema URLs.
|
||||
var ErrSchemaURLConflict = errors.New("conflicting Schema URL")
|
||||
|
||||
// New returns a Resource combined from the user-provided detectors.
|
||||
// New returns a [Resource] built using opts.
|
||||
//
|
||||
// This may return a partial Resource along with an error containing
|
||||
// [ErrPartialResource] if options that provide a [Detector] are used and that
|
||||
// error is returned from one or more of the Detectors. It may also return a
|
||||
// merge-conflict Resource along with an error containing
|
||||
// [ErrSchemaURLConflict] if merging Resources from the opts results in a
|
||||
// schema URL conflict (see [Resource.Merge] for more information). It is up to
|
||||
// the caller to determine if this returned Resource should be used or not
|
||||
// based on these errors.
|
||||
func New(ctx context.Context, opts ...Option) (*Resource, error) {
|
||||
cfg := config{}
|
||||
for _, opt := range opts {
|
||||
@ -98,7 +100,7 @@ func (r *Resource) String() string {
|
||||
return r.attrs.Encoded(attribute.DefaultEncoder())
|
||||
}
|
||||
|
||||
// MarshalLog is the marshaling function used by the logging system to represent this exporter.
|
||||
// MarshalLog is the marshaling function used by the logging system to represent this Resource.
|
||||
func (r *Resource) MarshalLog() interface{} {
|
||||
return struct {
|
||||
Attributes attribute.Set
|
||||
@ -146,16 +148,29 @@ func (r *Resource) Equal(eq *Resource) bool {
|
||||
return r.Equivalent() == eq.Equivalent()
|
||||
}
|
||||
|
||||
// Merge creates a new resource by combining resource a and b.
|
||||
// Merge creates a new [Resource] by merging a and b.
|
||||
//
|
||||
// If there are common keys between resource a and b, then the value
|
||||
// from resource b will overwrite the value from resource a, even
|
||||
// if resource b's value is empty.
|
||||
// If there are common keys between a and b, then the value from b will
|
||||
// overwrite the value from a, even if b's value is empty.
|
||||
//
|
||||
// The SchemaURL of the resources will be merged according to the spec rules:
|
||||
// https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/resource/sdk.md#merge
|
||||
// If the resources have different non-empty schemaURL an empty resource and an error
|
||||
// will be returned.
|
||||
// The SchemaURL of the resources will be merged according to the
|
||||
// [OpenTelemetry specification rules]:
|
||||
//
|
||||
// - If a's schema URL is empty then the returned Resource's schema URL will
|
||||
// be set to the schema URL of b,
|
||||
// - Else if b's schema URL is empty then the returned Resource's schema URL
|
||||
// will be set to the schema URL of a,
|
||||
// - Else if the schema URLs of a and b are the same then that will be the
|
||||
// schema URL of the returned Resource,
|
||||
// - Else this is a merging error. If the resources have different,
|
||||
// non-empty, schema URLs an error containing [ErrSchemaURLConflict] will
|
||||
// be returned with the merged Resource. The merged Resource will have an
|
||||
// empty schema URL. It may be the case that some unintended attributes
|
||||
// have been overwritten or old semantic conventions persisted in the
|
||||
// returned Resource. It is up to the caller to determine if this returned
|
||||
// Resource should be used or not.
|
||||
//
|
||||
// [OpenTelemetry specification rules]: https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/resource/sdk.md#merge
|
||||
func Merge(a, b *Resource) (*Resource, error) {
|
||||
if a == nil && b == nil {
|
||||
return Empty(), nil
|
||||
@ -167,19 +182,6 @@ func Merge(a, b *Resource) (*Resource, error) {
|
||||
return a, nil
|
||||
}
|
||||
|
||||
// Merge the schema URL.
|
||||
var schemaURL string
|
||||
switch true {
|
||||
case a.schemaURL == "":
|
||||
schemaURL = b.schemaURL
|
||||
case b.schemaURL == "":
|
||||
schemaURL = a.schemaURL
|
||||
case a.schemaURL == b.schemaURL:
|
||||
schemaURL = a.schemaURL
|
||||
default:
|
||||
return Empty(), errMergeConflictSchemaURL
|
||||
}
|
||||
|
||||
// Note: 'b' attributes will overwrite 'a' with last-value-wins in attribute.Key()
|
||||
// Meaning this is equivalent to: append(a.Attributes(), b.Attributes()...)
|
||||
mi := attribute.NewMergeIterator(b.Set(), a.Set())
|
||||
@ -187,8 +189,23 @@ func Merge(a, b *Resource) (*Resource, error) {
|
||||
for mi.Next() {
|
||||
combine = append(combine, mi.Attribute())
|
||||
}
|
||||
merged := NewWithAttributes(schemaURL, combine...)
|
||||
return merged, nil
|
||||
|
||||
switch {
|
||||
case a.schemaURL == "":
|
||||
return NewWithAttributes(b.schemaURL, combine...), nil
|
||||
case b.schemaURL == "":
|
||||
return NewWithAttributes(a.schemaURL, combine...), nil
|
||||
case a.schemaURL == b.schemaURL:
|
||||
return NewWithAttributes(a.schemaURL, combine...), nil
|
||||
}
|
||||
// Return the merged resource with an appropriate error. It is up to
|
||||
// the user to decide if the returned resource can be used or not.
|
||||
return NewSchemaless(combine...), fmt.Errorf(
|
||||
"%w: %s and %s",
|
||||
ErrSchemaURLConflict,
|
||||
a.schemaURL,
|
||||
b.schemaURL,
|
||||
)
|
||||
}
|
||||
|
||||
// Empty returns an instance of Resource with no attributes. It is
|
||||
@ -202,11 +219,17 @@ func Empty() *Resource {
|
||||
func Default() *Resource {
|
||||
defaultResourceOnce.Do(func() {
|
||||
var err error
|
||||
defaultResource, err = Detect(
|
||||
context.Background(),
|
||||
defaultDetectors := []Detector{
|
||||
defaultServiceNameDetector{},
|
||||
fromEnv{},
|
||||
telemetrySDK{},
|
||||
}
|
||||
if x.Resource.Enabled() {
|
||||
defaultDetectors = append([]Detector{defaultServiceInstanceIDDetector{}}, defaultDetectors...)
|
||||
}
|
||||
defaultResource, err = Detect(
|
||||
context.Background(),
|
||||
defaultDetectors...,
|
||||
)
|
||||
if err != nil {
|
||||
otel.Handle(err)
|
||||
|
3
vendor/go.opentelemetry.io/otel/sdk/trace/README.md
generated
vendored
Normal file
3
vendor/go.opentelemetry.io/otel/sdk/trace/README.md
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# SDK Trace
|
||||
|
||||
[](https://pkg.go.dev/go.opentelemetry.io/otel/sdk/trace)
|
17
vendor/go.opentelemetry.io/otel/sdk/trace/batch_span_processor.go
generated
vendored
17
vendor/go.opentelemetry.io/otel/sdk/trace/batch_span_processor.go
generated
vendored
@ -1,16 +1,5 @@
|
||||
// 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.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package trace // import "go.opentelemetry.io/otel/sdk/trace"
|
||||
|
||||
@ -392,7 +381,7 @@ func (bsp *batchSpanProcessor) enqueueBlockOnQueueFull(ctx context.Context, sd R
|
||||
}
|
||||
}
|
||||
|
||||
func (bsp *batchSpanProcessor) enqueueDrop(ctx context.Context, sd ReadOnlySpan) bool {
|
||||
func (bsp *batchSpanProcessor) enqueueDrop(_ context.Context, sd ReadOnlySpan) bool {
|
||||
if !sd.SpanContext().IsSampled() {
|
||||
return false
|
||||
}
|
||||
@ -406,7 +395,7 @@ func (bsp *batchSpanProcessor) enqueueDrop(ctx context.Context, sd ReadOnlySpan)
|
||||
return false
|
||||
}
|
||||
|
||||
// MarshalLog is the marshaling function used by the logging system to represent this exporter.
|
||||
// MarshalLog is the marshaling function used by the logging system to represent this Span Processor.
|
||||
func (bsp *batchSpanProcessor) MarshalLog() interface{} {
|
||||
return struct {
|
||||
Type string
|
||||
|
13
vendor/go.opentelemetry.io/otel/sdk/trace/doc.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/sdk/trace/doc.go
generated
vendored
@ -1,16 +1,5 @@
|
||||
// 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.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/*
|
||||
Package trace contains support for OpenTelemetry distributed tracing.
|
||||
|
13
vendor/go.opentelemetry.io/otel/sdk/trace/event.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/sdk/trace/event.go
generated
vendored
@ -1,16 +1,5 @@
|
||||
// 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.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package trace // import "go.opentelemetry.io/otel/sdk/trace"
|
||||
|
||||
|
49
vendor/go.opentelemetry.io/otel/sdk/trace/evictedqueue.go
generated
vendored
49
vendor/go.opentelemetry.io/otel/sdk/trace/evictedqueue.go
generated
vendored
@ -1,36 +1,45 @@
|
||||
// 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.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package trace // import "go.opentelemetry.io/otel/sdk/trace"
|
||||
|
||||
import (
|
||||
"slices"
|
||||
"sync"
|
||||
|
||||
"go.opentelemetry.io/otel/internal/global"
|
||||
)
|
||||
|
||||
// evictedQueue is a FIFO queue with a configurable capacity.
|
||||
type evictedQueue struct {
|
||||
queue []interface{}
|
||||
type evictedQueue[T any] struct {
|
||||
queue []T
|
||||
capacity int
|
||||
droppedCount int
|
||||
logDropped func()
|
||||
}
|
||||
|
||||
func newEvictedQueue(capacity int) evictedQueue {
|
||||
func newEvictedQueueEvent(capacity int) evictedQueue[Event] {
|
||||
// Do not pre-allocate queue, do this lazily.
|
||||
return evictedQueue{capacity: capacity}
|
||||
return evictedQueue[Event]{
|
||||
capacity: capacity,
|
||||
logDropped: sync.OnceFunc(func() { global.Warn("limit reached: dropping trace trace.Event") }),
|
||||
}
|
||||
}
|
||||
|
||||
func newEvictedQueueLink(capacity int) evictedQueue[Link] {
|
||||
// Do not pre-allocate queue, do this lazily.
|
||||
return evictedQueue[Link]{
|
||||
capacity: capacity,
|
||||
logDropped: sync.OnceFunc(func() { global.Warn("limit reached: dropping trace trace.Link") }),
|
||||
}
|
||||
}
|
||||
|
||||
// add adds value to the evictedQueue eq. If eq is at capacity, the oldest
|
||||
// queued value will be discarded and the drop count incremented.
|
||||
func (eq *evictedQueue) add(value interface{}) {
|
||||
func (eq *evictedQueue[T]) add(value T) {
|
||||
if eq.capacity == 0 {
|
||||
eq.droppedCount++
|
||||
eq.logDropped()
|
||||
return
|
||||
}
|
||||
|
||||
@ -39,6 +48,12 @@ func (eq *evictedQueue) add(value interface{}) {
|
||||
copy(eq.queue[:eq.capacity-1], eq.queue[1:])
|
||||
eq.queue = eq.queue[:eq.capacity-1]
|
||||
eq.droppedCount++
|
||||
eq.logDropped()
|
||||
}
|
||||
eq.queue = append(eq.queue, value)
|
||||
}
|
||||
|
||||
// copy returns a copy of the evictedQueue.
|
||||
func (eq *evictedQueue[T]) copy() []T {
|
||||
return slices.Clone(eq.queue)
|
||||
}
|
||||
|
34
vendor/go.opentelemetry.io/otel/sdk/trace/id_generator.go
generated
vendored
34
vendor/go.opentelemetry.io/otel/sdk/trace/id_generator.go
generated
vendored
@ -1,16 +1,5 @@
|
||||
// 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.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package trace // import "go.opentelemetry.io/otel/sdk/trace"
|
||||
|
||||
@ -52,7 +41,12 @@ func (gen *randomIDGenerator) NewSpanID(ctx context.Context, traceID trace.Trace
|
||||
gen.Lock()
|
||||
defer gen.Unlock()
|
||||
sid := trace.SpanID{}
|
||||
_, _ = gen.randSource.Read(sid[:])
|
||||
for {
|
||||
_, _ = gen.randSource.Read(sid[:])
|
||||
if sid.IsValid() {
|
||||
break
|
||||
}
|
||||
}
|
||||
return sid
|
||||
}
|
||||
|
||||
@ -62,9 +56,19 @@ func (gen *randomIDGenerator) NewIDs(ctx context.Context) (trace.TraceID, trace.
|
||||
gen.Lock()
|
||||
defer gen.Unlock()
|
||||
tid := trace.TraceID{}
|
||||
_, _ = gen.randSource.Read(tid[:])
|
||||
sid := trace.SpanID{}
|
||||
_, _ = gen.randSource.Read(sid[:])
|
||||
for {
|
||||
_, _ = gen.randSource.Read(tid[:])
|
||||
if tid.IsValid() {
|
||||
break
|
||||
}
|
||||
}
|
||||
for {
|
||||
_, _ = gen.randSource.Read(sid[:])
|
||||
if sid.IsValid() {
|
||||
break
|
||||
}
|
||||
}
|
||||
return tid, sid
|
||||
}
|
||||
|
||||
|
13
vendor/go.opentelemetry.io/otel/sdk/trace/link.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/sdk/trace/link.go
generated
vendored
@ -1,16 +1,5 @@
|
||||
// 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.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package trace // import "go.opentelemetry.io/otel/sdk/trace"
|
||||
|
||||
|
17
vendor/go.opentelemetry.io/otel/sdk/trace/provider.go
generated
vendored
17
vendor/go.opentelemetry.io/otel/sdk/trace/provider.go
generated
vendored
@ -1,16 +1,5 @@
|
||||
// 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.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package trace // import "go.opentelemetry.io/otel/sdk/trace"
|
||||
|
||||
@ -55,7 +44,7 @@ type tracerProviderConfig struct {
|
||||
resource *resource.Resource
|
||||
}
|
||||
|
||||
// MarshalLog is the marshaling function used by the logging system to represent this exporter.
|
||||
// MarshalLog is the marshaling function used by the logging system to represent this Provider.
|
||||
func (cfg tracerProviderConfig) MarshalLog() interface{} {
|
||||
return struct {
|
||||
SpanProcessors []SpanProcessor
|
||||
@ -302,7 +291,7 @@ func (p *TracerProvider) Shutdown(ctx context.Context) error {
|
||||
retErr = err
|
||||
} else {
|
||||
// Poor man's list of errors
|
||||
retErr = fmt.Errorf("%v; %v", retErr, err)
|
||||
retErr = fmt.Errorf("%w; %w", retErr, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
13
vendor/go.opentelemetry.io/otel/sdk/trace/sampler_env.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/sdk/trace/sampler_env.go
generated
vendored
@ -1,16 +1,5 @@
|
||||
// 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.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package trace // import "go.opentelemetry.io/otel/sdk/trace"
|
||||
|
||||
|
13
vendor/go.opentelemetry.io/otel/sdk/trace/sampling.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/sdk/trace/sampling.go
generated
vendored
@ -1,16 +1,5 @@
|
||||
// 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.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package trace // import "go.opentelemetry.io/otel/sdk/trace"
|
||||
|
||||
|
50
vendor/go.opentelemetry.io/otel/sdk/trace/simple_span_processor.go
generated
vendored
50
vendor/go.opentelemetry.io/otel/sdk/trace/simple_span_processor.go
generated
vendored
@ -1,16 +1,5 @@
|
||||
// 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.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package trace // import "go.opentelemetry.io/otel/sdk/trace"
|
||||
|
||||
@ -36,10 +25,10 @@ var _ SpanProcessor = (*simpleSpanProcessor)(nil)
|
||||
// send completed spans to the exporter immediately.
|
||||
//
|
||||
// This SpanProcessor is not recommended for production use. The synchronous
|
||||
// nature of this SpanProcessor make it good for testing, debugging, or
|
||||
// showing examples of other feature, but it will be slow and have a high
|
||||
// computation resource usage overhead. The BatchSpanProcessor is recommended
|
||||
// for production use instead.
|
||||
// nature of this SpanProcessor makes it good for testing, debugging, or showing
|
||||
// examples of other features, but it will be slow and have a high computation
|
||||
// resource usage overhead. The BatchSpanProcessor is recommended for production
|
||||
// use instead.
|
||||
func NewSimpleSpanProcessor(exporter SpanExporter) SpanProcessor {
|
||||
ssp := &simpleSpanProcessor{
|
||||
exporter: exporter,
|
||||
@ -80,10 +69,10 @@ func (ssp *simpleSpanProcessor) Shutdown(ctx context.Context) error {
|
||||
//
|
||||
// A closure is used to keep reference to the exporter and then the
|
||||
// field is zeroed. This ensures the simpleSpanProcessor is shut down
|
||||
// before the exporter. This order is important as it avoids a
|
||||
// potential deadlock. If the exporter shut down operation generates a
|
||||
// span, that span would need to be exported. Meaning, OnEnd would be
|
||||
// called and try acquiring the lock that is held here.
|
||||
// before the exporter. This order is important as it avoids a potential
|
||||
// deadlock. If the exporter shut down operation generates a span, that
|
||||
// span would need to be exported. Meaning, OnEnd would be called and
|
||||
// try acquiring the lock that is held here.
|
||||
ssp.exporterMu.Lock()
|
||||
done, shutdown := stopFunc(ssp.exporter)
|
||||
ssp.exporter = nil
|
||||
@ -95,15 +84,15 @@ func (ssp *simpleSpanProcessor) Shutdown(ctx context.Context) error {
|
||||
select {
|
||||
case err = <-done:
|
||||
case <-ctx.Done():
|
||||
// It is possible for the exporter to have immediately shut down
|
||||
// and the context to be done simultaneously. In that case this
|
||||
// outer select statement will randomly choose a case. This will
|
||||
// result in a different returned error for similar scenarios.
|
||||
// Instead, double check if the exporter shut down at the same
|
||||
// time and return that error if so. This will ensure consistency
|
||||
// as well as ensure the caller knows the exporter shut down
|
||||
// successfully (they can already determine if the deadline is
|
||||
// expired given they passed the context).
|
||||
// It is possible for the exporter to have immediately shut down and
|
||||
// the context to be done simultaneously. In that case this outer
|
||||
// select statement will randomly choose a case. This will result in
|
||||
// a different returned error for similar scenarios. Instead, double
|
||||
// check if the exporter shut down at the same time and return that
|
||||
// error if so. This will ensure consistency as well as ensure
|
||||
// the caller knows the exporter shut down successfully (they can
|
||||
// already determine if the deadline is expired given they passed
|
||||
// the context).
|
||||
select {
|
||||
case err = <-done:
|
||||
default:
|
||||
@ -119,7 +108,8 @@ func (ssp *simpleSpanProcessor) ForceFlush(context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalLog is the marshaling function used by the logging system to represent this Span Processor.
|
||||
// MarshalLog is the marshaling function used by the logging system to represent
|
||||
// this Span Processor.
|
||||
func (ssp *simpleSpanProcessor) MarshalLog() interface{} {
|
||||
return struct {
|
||||
Type string
|
||||
|
13
vendor/go.opentelemetry.io/otel/sdk/trace/snapshot.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/sdk/trace/snapshot.go
generated
vendored
@ -1,16 +1,5 @@
|
||||
// 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.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package trace // import "go.opentelemetry.io/otel/sdk/trace"
|
||||
|
||||
|
97
vendor/go.opentelemetry.io/otel/sdk/trace/span.go
generated
vendored
97
vendor/go.opentelemetry.io/otel/sdk/trace/span.go
generated
vendored
@ -1,16 +1,5 @@
|
||||
// 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.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package trace // import "go.opentelemetry.io/otel/sdk/trace"
|
||||
|
||||
@ -20,6 +9,7 @@ import (
|
||||
"reflect"
|
||||
"runtime"
|
||||
rt "runtime/trace"
|
||||
"slices"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
@ -27,10 +17,10 @@ import (
|
||||
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/codes"
|
||||
"go.opentelemetry.io/otel/internal/global"
|
||||
"go.opentelemetry.io/otel/sdk/instrumentation"
|
||||
"go.opentelemetry.io/otel/sdk/internal"
|
||||
"go.opentelemetry.io/otel/sdk/resource"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.26.0"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
"go.opentelemetry.io/otel/trace/embedded"
|
||||
)
|
||||
@ -147,12 +137,13 @@ type recordingSpan struct {
|
||||
// ReadOnlySpan exported when the span ends.
|
||||
attributes []attribute.KeyValue
|
||||
droppedAttributes int
|
||||
logDropAttrsOnce sync.Once
|
||||
|
||||
// events are stored in FIFO queue capped by configured limit.
|
||||
events evictedQueue
|
||||
events evictedQueue[Event]
|
||||
|
||||
// links are stored in FIFO queue capped by configured limit.
|
||||
links evictedQueue
|
||||
links evictedQueue[Link]
|
||||
|
||||
// executionTracerTaskEnd ends the execution tracer span.
|
||||
executionTracerTaskEnd func()
|
||||
@ -229,7 +220,7 @@ func (s *recordingSpan) SetAttributes(attributes ...attribute.KeyValue) {
|
||||
limit := s.tracer.provider.spanLimits.AttributeCountLimit
|
||||
if limit == 0 {
|
||||
// No attributes allowed.
|
||||
s.droppedAttributes += len(attributes)
|
||||
s.addDroppedAttr(len(attributes))
|
||||
return
|
||||
}
|
||||
|
||||
@ -242,10 +233,11 @@ func (s *recordingSpan) SetAttributes(attributes ...attribute.KeyValue) {
|
||||
|
||||
// Otherwise, add without deduplication. When attributes are read they
|
||||
// will be deduplicated, optimizing the operation.
|
||||
s.attributes = slices.Grow(s.attributes, len(s.attributes)+len(attributes))
|
||||
for _, a := range attributes {
|
||||
if !a.Valid() {
|
||||
// Drop all invalid attributes.
|
||||
s.droppedAttributes++
|
||||
s.addDroppedAttr(1)
|
||||
continue
|
||||
}
|
||||
a = truncateAttr(s.tracer.provider.spanLimits.AttributeValueLengthLimit, a)
|
||||
@ -253,6 +245,22 @@ func (s *recordingSpan) SetAttributes(attributes ...attribute.KeyValue) {
|
||||
}
|
||||
}
|
||||
|
||||
// Declared as a var so tests can override.
|
||||
var logDropAttrs = func() {
|
||||
global.Warn("limit reached: dropping trace Span attributes")
|
||||
}
|
||||
|
||||
// addDroppedAttr adds incr to the count of dropped attributes.
|
||||
//
|
||||
// The first, and only the first, time this method is called a warning will be
|
||||
// logged.
|
||||
//
|
||||
// This method assumes s.mu.Lock is held by the caller.
|
||||
func (s *recordingSpan) addDroppedAttr(incr int) {
|
||||
s.droppedAttributes += incr
|
||||
s.logDropAttrsOnce.Do(logDropAttrs)
|
||||
}
|
||||
|
||||
// addOverCapAttrs adds the attributes attrs to the span s while
|
||||
// de-duplicating the attributes of s and attrs and dropping attributes that
|
||||
// exceed the limit.
|
||||
@ -277,10 +285,12 @@ func (s *recordingSpan) addOverCapAttrs(limit int, attrs []attribute.KeyValue) {
|
||||
|
||||
// Now that s.attributes is deduplicated, adding unique attributes up to
|
||||
// the capacity of s will not over allocate s.attributes.
|
||||
sum := len(attrs) + len(s.attributes)
|
||||
s.attributes = slices.Grow(s.attributes, min(sum, limit))
|
||||
for _, a := range attrs {
|
||||
if !a.Valid() {
|
||||
// Drop all invalid attributes.
|
||||
s.droppedAttributes++
|
||||
s.addDroppedAttr(1)
|
||||
continue
|
||||
}
|
||||
|
||||
@ -293,7 +303,7 @@ func (s *recordingSpan) addOverCapAttrs(limit int, attrs []attribute.KeyValue) {
|
||||
if len(s.attributes) >= limit {
|
||||
// Do not just drop all of the remaining attributes, make sure
|
||||
// updates are checked and performed.
|
||||
s.droppedAttributes++
|
||||
s.addDroppedAttr(1)
|
||||
} else {
|
||||
a = truncateAttr(s.tracer.provider.spanLimits.AttributeValueLengthLimit, a)
|
||||
s.attributes = append(s.attributes, a)
|
||||
@ -374,7 +384,7 @@ func (s *recordingSpan) End(options ...trace.SpanEndOption) {
|
||||
|
||||
// Store the end time as soon as possible to avoid artificially increasing
|
||||
// the span's duration in case some operation below takes a while.
|
||||
et := internal.MonotonicEndTime(s.startTime)
|
||||
et := monotonicEndTime(s.startTime)
|
||||
|
||||
// Do relative expensive check now that we have an end time and see if we
|
||||
// need to do any more processing.
|
||||
@ -425,6 +435,16 @@ func (s *recordingSpan) End(options ...trace.SpanEndOption) {
|
||||
}
|
||||
}
|
||||
|
||||
// monotonicEndTime returns the end time at present but offset from start,
|
||||
// monotonically.
|
||||
//
|
||||
// The monotonic clock is used in subtractions hence the duration since start
|
||||
// added back to start gives end as a monotonic time. See
|
||||
// https://golang.org/pkg/time/#hdr-Monotonic_Clocks
|
||||
func monotonicEndTime(start time.Time) time.Time {
|
||||
return start.Add(time.Since(start))
|
||||
}
|
||||
|
||||
// RecordError will record err as a span event for this span. An additional call to
|
||||
// SetStatus is required if the Status of the Span should be set to Error, this method
|
||||
// does not change the Span status. If this span is not being recorded or err is nil
|
||||
@ -592,7 +612,7 @@ func (s *recordingSpan) Links() []Link {
|
||||
if len(s.links.queue) == 0 {
|
||||
return []Link{}
|
||||
}
|
||||
return s.interfaceArrayToLinksArray()
|
||||
return s.links.copy()
|
||||
}
|
||||
|
||||
// Events returns the events of this span.
|
||||
@ -602,7 +622,7 @@ func (s *recordingSpan) Events() []Event {
|
||||
if len(s.events.queue) == 0 {
|
||||
return []Event{}
|
||||
}
|
||||
return s.interfaceArrayToEventArray()
|
||||
return s.events.copy()
|
||||
}
|
||||
|
||||
// Status returns the status of this span.
|
||||
@ -636,8 +656,12 @@ func (s *recordingSpan) Resource() *resource.Resource {
|
||||
return s.tracer.provider.resource
|
||||
}
|
||||
|
||||
func (s *recordingSpan) addLink(link trace.Link) {
|
||||
if !s.IsRecording() || !link.SpanContext.IsValid() {
|
||||
func (s *recordingSpan) AddLink(link trace.Link) {
|
||||
if !s.IsRecording() {
|
||||
return
|
||||
}
|
||||
if !link.SpanContext.IsValid() && len(link.Attributes) == 0 &&
|
||||
link.SpanContext.TraceState().Len() == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
@ -720,32 +744,16 @@ func (s *recordingSpan) snapshot() ReadOnlySpan {
|
||||
}
|
||||
sd.droppedAttributeCount = s.droppedAttributes
|
||||
if len(s.events.queue) > 0 {
|
||||
sd.events = s.interfaceArrayToEventArray()
|
||||
sd.events = s.events.copy()
|
||||
sd.droppedEventCount = s.events.droppedCount
|
||||
}
|
||||
if len(s.links.queue) > 0 {
|
||||
sd.links = s.interfaceArrayToLinksArray()
|
||||
sd.links = s.links.copy()
|
||||
sd.droppedLinkCount = s.links.droppedCount
|
||||
}
|
||||
return &sd
|
||||
}
|
||||
|
||||
func (s *recordingSpan) interfaceArrayToLinksArray() []Link {
|
||||
linkArr := make([]Link, 0)
|
||||
for _, value := range s.links.queue {
|
||||
linkArr = append(linkArr, value.(Link))
|
||||
}
|
||||
return linkArr
|
||||
}
|
||||
|
||||
func (s *recordingSpan) interfaceArrayToEventArray() []Event {
|
||||
eventArr := make([]Event, 0)
|
||||
for _, value := range s.events.queue {
|
||||
eventArr = append(eventArr, value.(Event))
|
||||
}
|
||||
return eventArr
|
||||
}
|
||||
|
||||
func (s *recordingSpan) addChild() {
|
||||
if !s.IsRecording() {
|
||||
return
|
||||
@ -810,6 +818,9 @@ func (nonRecordingSpan) RecordError(error, ...trace.EventOption) {}
|
||||
// AddEvent does nothing.
|
||||
func (nonRecordingSpan) AddEvent(string, ...trace.EventOption) {}
|
||||
|
||||
// AddLink does nothing.
|
||||
func (nonRecordingSpan) AddLink(trace.Link) {}
|
||||
|
||||
// SetName does nothing.
|
||||
func (nonRecordingSpan) SetName(string) {}
|
||||
|
||||
|
13
vendor/go.opentelemetry.io/otel/sdk/trace/span_exporter.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/sdk/trace/span_exporter.go
generated
vendored
@ -1,16 +1,5 @@
|
||||
// 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.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package trace // import "go.opentelemetry.io/otel/sdk/trace"
|
||||
|
||||
|
13
vendor/go.opentelemetry.io/otel/sdk/trace/span_limits.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/sdk/trace/span_limits.go
generated
vendored
@ -1,16 +1,5 @@
|
||||
// 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.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package trace // import "go.opentelemetry.io/otel/sdk/trace"
|
||||
|
||||
|
13
vendor/go.opentelemetry.io/otel/sdk/trace/span_processor.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/sdk/trace/span_processor.go
generated
vendored
@ -1,16 +1,5 @@
|
||||
// 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.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package trace // import "go.opentelemetry.io/otel/sdk/trace"
|
||||
|
||||
|
19
vendor/go.opentelemetry.io/otel/sdk/trace/tracer.go
generated
vendored
19
vendor/go.opentelemetry.io/otel/sdk/trace/tracer.go
generated
vendored
@ -1,16 +1,5 @@
|
||||
// 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.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package trace // import "go.opentelemetry.io/otel/sdk/trace"
|
||||
|
||||
@ -143,13 +132,13 @@ func (tr *tracer) newRecordingSpan(psc, sc trace.SpanContext, name string, sr Sa
|
||||
spanKind: trace.ValidateSpanKind(config.SpanKind()),
|
||||
name: name,
|
||||
startTime: startTime,
|
||||
events: newEvictedQueue(tr.provider.spanLimits.EventCountLimit),
|
||||
links: newEvictedQueue(tr.provider.spanLimits.LinkCountLimit),
|
||||
events: newEvictedQueueEvent(tr.provider.spanLimits.EventCountLimit),
|
||||
links: newEvictedQueueLink(tr.provider.spanLimits.LinkCountLimit),
|
||||
tracer: tr,
|
||||
}
|
||||
|
||||
for _, l := range config.Links() {
|
||||
s.addLink(l)
|
||||
s.AddLink(l)
|
||||
}
|
||||
|
||||
s.SetAttributes(sr.Attributes...)
|
||||
|
13
vendor/go.opentelemetry.io/otel/sdk/trace/version.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/sdk/trace/version.go
generated
vendored
@ -1,16 +1,5 @@
|
||||
// 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.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package trace // import "go.opentelemetry.io/otel/sdk/trace"
|
||||
|
||||
|
15
vendor/go.opentelemetry.io/otel/sdk/version.go
generated
vendored
15
vendor/go.opentelemetry.io/otel/sdk/version.go
generated
vendored
@ -1,20 +1,9 @@
|
||||
// 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.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package sdk // import "go.opentelemetry.io/otel/sdk"
|
||||
|
||||
// Version is the current release version of the OpenTelemetry SDK in use.
|
||||
func Version() string {
|
||||
return "1.21.0"
|
||||
return "1.28.0"
|
||||
}
|
||||
|
Reference in New Issue
Block a user