mirror of
https://github.com/go-gitea/gitea
synced 2025-09-28 03:28:13 +00:00
[Vendor] Update directly used dependencys (#15593)
* update github.com/blevesearch/bleve v2.0.2 -> v2.0.3 * github.com/denisenkom/go-mssqldb v0.9.0 -> v0.10.0 * github.com/editorconfig/editorconfig-core-go v2.4.1 -> v2.4.2 * github.com/go-chi/cors v1.1.1 -> v1.2.0 * github.com/go-git/go-billy v5.0.0 -> v5.1.0 * github.com/go-git/go-git v5.2.0 -> v5.3.0 * github.com/go-ldap/ldap v3.2.4 -> v3.3.0 * github.com/go-redis/redis v8.6.0 -> v8.8.2 * github.com/go-sql-driver/mysql v1.5.0 -> v1.6.0 * github.com/go-swagger/go-swagger v0.26.1 -> v0.27.0 * github.com/lib/pq v1.9.0 -> v1.10.1 * github.com/mattn/go-sqlite3 v1.14.6 -> v1.14.7 * github.com/go-testfixtures/testfixtures v3.5.0 -> v3.6.0 * github.com/issue9/identicon v1.0.1 -> v1.2.0 * github.com/klauspost/compress v1.11.8 -> v1.12.1 * github.com/mgechev/revive v1.0.3 -> v1.0.6 * github.com/microcosm-cc/bluemonday v1.0.7 -> v1.0.8 * github.com/niklasfasching/go-org v1.4.0 -> v1.5.0 * github.com/olivere/elastic v7.0.22 -> v7.0.24 * github.com/pelletier/go-toml v1.8.1 -> v1.9.0 * github.com/prometheus/client_golang v1.9.0 -> v1.10.0 * github.com/xanzy/go-gitlab v0.44.0 -> v0.48.0 * github.com/yuin/goldmark v1.3.3 -> v1.3.5 * github.com/6543/go-version v1.2.4 -> v1.3.1 * do github.com/lib/pq v1.10.0 -> v1.10.1 again ...
This commit is contained in:
125
vendor/go.opentelemetry.io/otel/CHANGELOG.md
generated
vendored
125
vendor/go.opentelemetry.io/otel/CHANGELOG.md
generated
vendored
@@ -8,16 +8,133 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [0.19.0] - 2020-03-18
|
||||
|
||||
### Added
|
||||
|
||||
- Added `Marshaler` config option to `otlphttp` to enable otlp over json or protobufs. (#1586)
|
||||
- A `ForceFlush` method to the `"go.opentelemetry.io/otel/sdk/trace".TracerProvider` to flush all registered `SpanProcessor`s. (#1608)
|
||||
- Added `WithSampler` and `WithSpanLimits` to tracer provider. (#1633, #1702)
|
||||
- `"go.opentelemetry.io/otel/trace".SpanContext` now has a `remote` property, and `IsRemote()` predicate, that is true when the `SpanContext` has been extracted from remote context data. (#1701)
|
||||
- A `Valid` method to the `"go.opentelemetry.io/otel/attribute".KeyValue` type. (#1703)
|
||||
|
||||
### Changed
|
||||
|
||||
- `trace.SpanContext` is now immutable and has no exported fields. (#1573)
|
||||
- `trace.NewSpanContext()` can be used in conjunction with the `trace.SpanContextConfig` struct to initialize a new `SpanContext` where all values are known.
|
||||
- Update the `ForceFlush` method signature to the `"go.opentelemetry.io/otel/sdk/trace".SpanProcessor` to accept a `context.Context` and return an error. (#1608)
|
||||
- Update the `Shutdown` method to the `"go.opentelemetry.io/otel/sdk/trace".TracerProvider` return an error on shutdown failure. (#1608)
|
||||
- The SimpleSpanProcessor will now shut down the enclosed `SpanExporter` and gracefully ignore subsequent calls to `OnEnd` after `Shutdown` is called. (#1612)
|
||||
- `"go.opentelemetry.io/sdk/metric/controller.basic".WithPusher` is replaced with `WithExporter` to provide consistent naming across project. (#1656)
|
||||
- Added non-empty string check for trace `Attribute` keys. (#1659)
|
||||
- Add `description` to SpanStatus only when `StatusCode` is set to error. (#1662)
|
||||
- Jaeger exporter falls back to `resource.Default`'s `service.name` if the exported Span does not have one. (#1673)
|
||||
- Jaeger exporter populates Jaeger's Span Process from Resource. (#1673)
|
||||
- Renamed the `LabelSet` method of `"go.opentelemetry.io/otel/sdk/resource".Resource` to `Set`. (#1692)
|
||||
- Changed `WithSDK` to `WithSDKOptions` to accept variadic arguments of `TracerProviderOption` type in `go.opentelemetry.io/otel/exporters/trace/jaeger` package. (#1693)
|
||||
- Changed `WithSDK` to `WithSDKOptions` to accept variadic arguments of `TracerProviderOption` type in `go.opentelemetry.io/otel/exporters/trace/zipkin` package. (#1693)
|
||||
- `"go.opentelemetry.io/otel/sdk/resource".NewWithAttributes` will now drop any invalid attributes passed. (#1703)
|
||||
- `"go.opentelemetry.io/otel/sdk/resource".StringDetector` will now error if the produced attribute is invalid. (#1703)
|
||||
|
||||
### Removed
|
||||
|
||||
- Removed `serviceName` parameter from Zipkin exporter and uses resource instead. (#1549)
|
||||
- Removed `WithConfig` from tracer provider to avoid overriding configuration. (#1633)
|
||||
- Removed the exported `SimpleSpanProcessor` and `BatchSpanProcessor` structs.
|
||||
These are now returned as a SpanProcessor interface from their respective constructors. (#1638)
|
||||
- Removed `WithRecord()` from `trace.SpanOption` when creating a span. (#1660)
|
||||
- Removed setting status to `Error` while recording an error as a span event in `RecordError`. (#1663)
|
||||
- Removed `jaeger.WithProcess` configuration option. (#1673)
|
||||
- Removed `ApplyConfig` method from `"go.opentelemetry.io/otel/sdk/trace".TracerProvider` and the now unneeded `Config` struct. (#1693)
|
||||
|
||||
### Fixed
|
||||
|
||||
- Jaeger Exporter: Ensure mapping between OTEL and Jaeger span data complies with the specification. (#1626)
|
||||
- `SamplingResult.TraceState` is correctly propagated to a newly created span's `SpanContext`. (#1655)
|
||||
- The `otel-collector` example now correctly flushes metric events prior to shutting down the exporter. (#1678)
|
||||
- Do not set span status message in `SpanStatusFromHTTPStatusCode` if it can be inferred from `http.status_code`. (#1681)
|
||||
- Synchronization issues in global trace delegate implementation. (#1686)
|
||||
- Reduced excess memory usage by global `TracerProvider`. (#1687)
|
||||
|
||||
## [0.18.0] - 2020-03-03
|
||||
|
||||
### Added
|
||||
|
||||
- Added `resource.Default()` for use with meter and tracer providers. (#1507)
|
||||
- `AttributePerEventCountLimit` and `AttributePerLinkCountLimit` for `SpanLimits`. (#1535)
|
||||
- Added `Keys()` method to `propagation.TextMapCarrier` and `propagation.HeaderCarrier` to adapt `http.Header` to this interface. (#1544)
|
||||
- Added `code` attributes to `go.opentelemetry.io/otel/semconv` package. (#1558)
|
||||
- Compatibility testing suite in the CI system for the following systems. (#1567)
|
||||
| OS | Go Version | Architecture |
|
||||
| ------- | ---------- | ------------ |
|
||||
| Ubuntu | 1.15 | amd64 |
|
||||
| Ubuntu | 1.14 | amd64 |
|
||||
| Ubuntu | 1.15 | 386 |
|
||||
| Ubuntu | 1.14 | 386 |
|
||||
| MacOS | 1.15 | amd64 |
|
||||
| MacOS | 1.14 | amd64 |
|
||||
| Windows | 1.15 | amd64 |
|
||||
| Windows | 1.14 | amd64 |
|
||||
| Windows | 1.15 | 386 |
|
||||
| Windows | 1.14 | 386 |
|
||||
|
||||
### Changed
|
||||
|
||||
- Replaced interface `oteltest.SpanRecorder` with its existing implementation
|
||||
`StandardSpanRecorder`. (#1542)
|
||||
- Default span limit values to 128. (#1535)
|
||||
- Rename `MaxEventsPerSpan`, `MaxAttributesPerSpan` and `MaxLinksPerSpan` to `EventCountLimit`, `AttributeCountLimit` and `LinkCountLimit`, and move these fields into `SpanLimits`. (#1535)
|
||||
- Renamed the `otel/label` package to `otel/attribute`. (#1541)
|
||||
- Vendor the Jaeger exporter's dependency on Apache Thrift. (#1551)
|
||||
- Parallelize the CI linting and testing. (#1567)
|
||||
- Stagger timestamps in exact aggregator tests. (#1569)
|
||||
- Changed all examples to use `WithBatchTimeout(5 * time.Second)` rather than `WithBatchTimeout(5)`. (#1621)
|
||||
- Prevent end-users from implementing some interfaces (#1575)
|
||||
```
|
||||
"otel/exporters/otlp/otlphttp".Option
|
||||
"otel/exporters/stdout".Option
|
||||
"otel/oteltest".Option
|
||||
"otel/trace".TracerOption
|
||||
"otel/trace".SpanOption
|
||||
"otel/trace".EventOption
|
||||
"otel/trace".LifeCycleOption
|
||||
"otel/trace".InstrumentationOption
|
||||
"otel/sdk/resource".Option
|
||||
"otel/sdk/trace".ParentBasedSamplerOption
|
||||
"otel/sdk/trace".ReadOnlySpan
|
||||
"otel/sdk/trace".ReadWriteSpan
|
||||
```
|
||||
### Removed
|
||||
|
||||
- Removed attempt to resample spans upon changing the span name with `span.SetName()`. (#1545)
|
||||
- The `test-benchmark` is no longer a dependency of the `precommit` make target. (#1567)
|
||||
- Removed the `test-386` make target.
|
||||
This was replaced with a full compatibility testing suite (i.e. multi OS/arch) in the CI system. (#1567)
|
||||
|
||||
### Fixed
|
||||
|
||||
- The sequential timing check of timestamps in the stdout exporter are now setup explicitly to be sequential (#1571). (#1572)
|
||||
- Windows build of Jaeger tests now compiles with OS specific functions (#1576). (#1577)
|
||||
- The sequential timing check of timestamps of go.opentelemetry.io/otel/sdk/metric/aggregator/lastvalue are now setup explicitly to be sequential (#1578). (#1579)
|
||||
- Validate tracestate header keys with vendors according to the W3C TraceContext specification (#1475). (#1581)
|
||||
- The OTLP exporter includes related labels for translations of a GaugeArray (#1563). (#1570)
|
||||
|
||||
## [0.17.0] - 2020-02-12
|
||||
|
||||
### Changed
|
||||
|
||||
- Rename project default branch from `master` to `main`.
|
||||
- Rename project default branch from `master` to `main`. (#1505)
|
||||
- Reverse order in which `Resource` attributes are merged, per change in spec. (#1501)
|
||||
- Add tooling to maintain "replace" directives in go.mod files automatically. (#1528)
|
||||
- Create new modules: otel/metric, otel/trace, otel/oteltest, otel/sdk/export/metric, otel/sdk/metric (#1528)
|
||||
- Move metric-related public global APIs from otel to otel/metric/global. (#1528)
|
||||
|
||||
## Fixed
|
||||
|
||||
- Fixed otlpgrpc reconnection issue.
|
||||
- The example code in the README.md of `go.opentelemetry.io/otel/exporters/otlp` is moved to a compiled example test and used the new `WithAddress` instead of `WithEndpoint`. (#1513)
|
||||
- The otel-collector example now uses the default OTLP receiver port of the collector.
|
||||
|
||||
## [0.16.0] - 2020-01-13
|
||||
|
||||
### Added
|
||||
@@ -29,6 +146,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
||||
- Added codeql worfklow to GitHub Actions (#1428)
|
||||
- Added Gosec workflow to GitHub Actions (#1429)
|
||||
- Add new HTTP driver for OTLP exporter in `exporters/otlp/otlphttp`. Currently it only supports the binary protobuf payloads. (#1420)
|
||||
- Add an OpenCensus exporter bridge. (#1444)
|
||||
|
||||
### Changed
|
||||
|
||||
@@ -138,6 +256,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
||||
- The `MockSpan` and `MockTracer` types are removed from `go.opentelemetry.io/otel/oteltest`.
|
||||
`Tracer` and `Span` from the same module should be used in their place instead. (#1306)
|
||||
- `WorkerCount` option is removed from `go.opentelemetry.io/otel/exporters/otlp`. (#1350)
|
||||
- Remove the following labels types: INT32, UINT32, UINT64 and FLOAT32. (#1314)
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -1038,7 +1157,9 @@ It contains api and sdk for trace and meter.
|
||||
- CODEOWNERS file to track owners of this project.
|
||||
|
||||
|
||||
[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v0.17.0...HEAD
|
||||
[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v0.19.0...HEAD
|
||||
[0.19.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.19.0
|
||||
[0.18.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.18.0
|
||||
[0.17.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.17.0
|
||||
[0.16.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.16.0
|
||||
[0.15.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.15.0
|
||||
|
14
vendor/go.opentelemetry.io/otel/CONTRIBUTING.md
generated
vendored
14
vendor/go.opentelemetry.io/otel/CONTRIBUTING.md
generated
vendored
@@ -9,7 +9,7 @@ See the [public meeting
|
||||
notes](https://docs.google.com/document/d/1A63zSWX0x2CyCK_LoNhmQC4rqhLpYXJzXbEPDUQ2n6w/edit#heading=h.9tngw7jdwd6b)
|
||||
for a summary description of past meetings. To request edit access,
|
||||
join the meeting or get in touch on
|
||||
[Gitter](https://gitter.im/open-telemetry/opentelemetry-go).
|
||||
[Slack](https://cloud-native.slack.com/archives/C01NPAXACKT).
|
||||
|
||||
## Development
|
||||
|
||||
@@ -100,7 +100,13 @@ A PR is considered to be **ready to merge** when:
|
||||
different companies). This is not enforced through technical means
|
||||
and a PR may be **ready to merge** with a single approval if the change
|
||||
and its approach have been discussed and consensus reached.
|
||||
* Major feedbacks are resolved.
|
||||
* Feedback has been addressed.
|
||||
* Any substantive changes to your PR will require that you clear any prior
|
||||
Approval reviews, this includes changes resulting from other feedback. Unless
|
||||
the approver explicitly stated that their approval will persist across
|
||||
changes it should be assumed that the PR needs their review again. Other
|
||||
project members (e.g. approvers, maintainers) can help with this if there are
|
||||
any questions or if you forget to clear reviews.
|
||||
* It has been open for review for at least one working day. This gives
|
||||
people reasonable time to review.
|
||||
* Trivial changes (typo, cosmetic, doc, etc.) do not have to wait for
|
||||
@@ -365,8 +371,8 @@ Approvers:
|
||||
|
||||
Maintainers:
|
||||
|
||||
- [Anthony Mirabella](https://github.com/Aneurysm9), Centene
|
||||
- [Tyler Yahn](https://github.com/MrAlias), New Relic
|
||||
- [Anthony Mirabella](https://github.com/Aneurysm9), AWS
|
||||
- [Tyler Yahn](https://github.com/MrAlias), Splunk
|
||||
|
||||
### Become an Approver or a Maintainer
|
||||
|
||||
|
215
vendor/go.opentelemetry.io/otel/Makefile
generated
vendored
215
vendor/go.opentelemetry.io/otel/Makefile
generated
vendored
@@ -21,146 +21,133 @@ ALL_DOCS := $(shell find . -name '*.md' -type f | sort)
|
||||
ALL_GO_MOD_DIRS := $(filter-out $(TOOLS_MOD_DIR), $(shell find . -type f -name 'go.mod' -exec dirname {} \; | egrep -v '^./example' | sort)) $(shell find ./example -type f -name 'go.mod' -exec dirname {} \; | sort)
|
||||
ALL_COVERAGE_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} \; | egrep -v '^./example|^$(TOOLS_MOD_DIR)' | sort)
|
||||
|
||||
# Mac OS Catalina 10.5.x doesn't support 386. Hence skip 386 test
|
||||
SKIP_386_TEST = false
|
||||
UNAME_S := $(shell uname -s)
|
||||
ifeq ($(UNAME_S),Darwin)
|
||||
SW_VERS := $(shell sw_vers -productVersion)
|
||||
ifeq ($(shell echo $(SW_VERS) | egrep '^(10.1[5-9]|1[1-9]|[2-9])'), $(SW_VERS))
|
||||
SKIP_386_TEST = true
|
||||
endif
|
||||
endif
|
||||
|
||||
GOTEST_MIN = go test -timeout 30s
|
||||
GOTEST = $(GOTEST_MIN) -race
|
||||
GOTEST_WITH_COVERAGE = $(GOTEST) -coverprofile=coverage.out -covermode=atomic -coverpkg=./...
|
||||
GO = go
|
||||
TIMEOUT = 60
|
||||
|
||||
.DEFAULT_GOAL := precommit
|
||||
|
||||
.PHONY: precommit
|
||||
.PHONY: precommit ci
|
||||
precommit: dependabot-check license-check lint build examples test-default
|
||||
ci: precommit check-clean-work-tree test-coverage
|
||||
|
||||
TOOLS_DIR := $(abspath ./.tools)
|
||||
# Tools
|
||||
|
||||
$(TOOLS_DIR)/golangci-lint: $(TOOLS_MOD_DIR)/go.mod $(TOOLS_MOD_DIR)/go.sum $(TOOLS_MOD_DIR)/tools.go
|
||||
TOOLS = $(CURDIR)/.tools
|
||||
|
||||
$(TOOLS):
|
||||
@mkdir -p $@
|
||||
$(TOOLS)/%: | $(TOOLS)
|
||||
cd $(TOOLS_MOD_DIR) && \
|
||||
go build -o $(TOOLS_DIR)/golangci-lint github.com/golangci/golangci-lint/cmd/golangci-lint
|
||||
$(GO) build -o $@ $(PACKAGE)
|
||||
|
||||
$(TOOLS_DIR)/misspell: $(TOOLS_MOD_DIR)/go.mod $(TOOLS_MOD_DIR)/go.sum $(TOOLS_MOD_DIR)/tools.go
|
||||
cd $(TOOLS_MOD_DIR) && \
|
||||
go build -o $(TOOLS_DIR)/misspell github.com/client9/misspell/cmd/misspell
|
||||
CROSSLINK = $(TOOLS)/crosslink
|
||||
$(TOOLS)/crosslink: PACKAGE=go.opentelemetry.io/otel/$(TOOLS_MOD_DIR)/crosslink
|
||||
|
||||
$(TOOLS_DIR)/stringer: $(TOOLS_MOD_DIR)/go.mod $(TOOLS_MOD_DIR)/go.sum $(TOOLS_MOD_DIR)/tools.go
|
||||
cd $(TOOLS_MOD_DIR) && \
|
||||
go build -o $(TOOLS_DIR)/stringer golang.org/x/tools/cmd/stringer
|
||||
GOLANGCI_LINT = $(TOOLS)/golangci-lint
|
||||
$(TOOLS)/golangci-lint: PACKAGE=github.com/golangci/golangci-lint/cmd/golangci-lint
|
||||
|
||||
$(TOOLS_DIR)/gojq: $(TOOLS_MOD_DIR)/go.mod $(TOOLS_MOD_DIR)/go.sum $(TOOLS_MOD_DIR)/tools.go
|
||||
cd $(TOOLS_MOD_DIR) && \
|
||||
go build -o $(TOOLS_DIR)/gojq github.com/itchyny/gojq/cmd/gojq
|
||||
MISSPELL = $(TOOLS)/misspell
|
||||
$(TOOLS)/misspell: PACKAGE= github.com/client9/misspell/cmd/misspell
|
||||
|
||||
precommit: dependabot-check license-check generate build lint examples test-benchmarks test
|
||||
STRINGER = $(TOOLS)/stringer
|
||||
$(TOOLS)/stringer: PACKAGE=golang.org/x/tools/cmd/stringer
|
||||
|
||||
.PHONY: test-with-coverage
|
||||
test-with-coverage:
|
||||
set -e; \
|
||||
$(TOOLS)/gojq: PACKAGE=github.com/itchyny/gojq/cmd/gojq
|
||||
|
||||
.PHONY: tools
|
||||
tools: $(CROSSLINK) $(GOLANGCI_LINT) $(MISSPELL) $(STRINGER) $(TOOLS)/gojq
|
||||
|
||||
|
||||
# Build
|
||||
|
||||
.PHONY: examples generate build
|
||||
examples:
|
||||
@set -e; for dir in $(EXAMPLES); do \
|
||||
echo "$(GO) build $${dir}/..."; \
|
||||
(cd "$${dir}" && \
|
||||
$(GO) build .); \
|
||||
done
|
||||
|
||||
generate: $(STRINGER)
|
||||
set -e; for dir in $(ALL_GO_MOD_DIRS); do \
|
||||
echo "$(GO) generate $${dir}/..."; \
|
||||
(cd "$${dir}" && \
|
||||
PATH="$(TOOLS):$${PATH}" $(GO) generate ./...); \
|
||||
done
|
||||
|
||||
build: generate
|
||||
# Build all package code including testing code.
|
||||
set -e; for dir in $(ALL_GO_MOD_DIRS); do \
|
||||
echo "$(GO) build $${dir}/..."; \
|
||||
(cd "$${dir}" && \
|
||||
$(GO) build ./... && \
|
||||
$(GO) list ./... \
|
||||
| grep -v third_party \
|
||||
| xargs $(GO) test -vet=off -run xxxxxMatchNothingxxxxx >/dev/null); \
|
||||
done
|
||||
|
||||
# Tests
|
||||
|
||||
TEST_TARGETS := test-default test-bench test-short test-verbose test-race
|
||||
.PHONY: $(TEST_TARGETS) test
|
||||
test-default: ARGS=-v -race
|
||||
test-bench: ARGS=-run=xxxxxMatchNothingxxxxx -test.benchtime=1ms -bench=.
|
||||
test-short: ARGS=-short
|
||||
test-verbose: ARGS=-v
|
||||
test-race: ARGS=-race
|
||||
$(TEST_TARGETS): test
|
||||
test:
|
||||
@set -e; for dir in $(ALL_GO_MOD_DIRS); do \
|
||||
echo "$(GO) test -timeout $(TIMEOUT)s $(ARGS) $${dir}/..."; \
|
||||
(cd "$${dir}" && \
|
||||
$(GO) list ./... \
|
||||
| grep -v third_party \
|
||||
| xargs $(GO) test -timeout $(TIMEOUT)s $(ARGS)); \
|
||||
done
|
||||
|
||||
COVERAGE_MODE = atomic
|
||||
COVERAGE_PROFILE = coverage.out
|
||||
.PHONY: test-coverage
|
||||
test-coverage:
|
||||
@set -e; \
|
||||
printf "" > coverage.txt; \
|
||||
for dir in $(ALL_COVERAGE_MOD_DIRS); do \
|
||||
echo "go test ./... + coverage in $${dir}"; \
|
||||
echo "$(GO) test -coverpkg=./... -covermode=$(COVERAGE_MODE) -coverprofile="$(COVERAGE_PROFILE)" $${dir}/..."; \
|
||||
(cd "$${dir}" && \
|
||||
$(GOTEST_WITH_COVERAGE) ./... && \
|
||||
go tool cover -html=coverage.out -o coverage.html); \
|
||||
[ -f "$${dir}/coverage.out" ] && cat "$${dir}/coverage.out" >> coverage.txt; \
|
||||
$(GO) list ./... \
|
||||
| grep -v third_party \
|
||||
| xargs $(GO) test -coverpkg=./... -covermode=$(COVERAGE_MODE) -coverprofile="$(COVERAGE_PROFILE)" && \
|
||||
$(GO) tool cover -html=coverage.out -o coverage.html); \
|
||||
[ -f "$${dir}/coverage.out" ] && cat "$${dir}/coverage.out" >> coverage.txt; \
|
||||
done; \
|
||||
sed -i.bak -e '2,$$ { /^mode: /d; }' coverage.txt
|
||||
|
||||
|
||||
.PHONY: ci
|
||||
ci: precommit check-clean-work-tree test-with-coverage test-386
|
||||
|
||||
.PHONY: check-clean-work-tree
|
||||
check-clean-work-tree:
|
||||
@if ! git diff --quiet; then \
|
||||
echo; \
|
||||
echo 'Working tree is not clean, did you forget to run "make precommit"?'; \
|
||||
echo; \
|
||||
git status; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
.PHONY: build
|
||||
build:
|
||||
# TODO: Fix this on windows.
|
||||
set -e; for dir in $(ALL_GO_MOD_DIRS); do \
|
||||
echo "compiling all packages in $${dir}"; \
|
||||
(cd "$${dir}" && \
|
||||
go build ./... && \
|
||||
go test -run xxxxxMatchNothingxxxxx ./... >/dev/null); \
|
||||
done
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
set -e; for dir in $(ALL_GO_MOD_DIRS); do \
|
||||
echo "go test ./... + race in $${dir}"; \
|
||||
(cd "$${dir}" && \
|
||||
$(GOTEST) ./...); \
|
||||
done
|
||||
|
||||
.PHONY: test-386
|
||||
test-386:
|
||||
if [ $(SKIP_386_TEST) = true ] ; then \
|
||||
echo "skipping the test for GOARCH 386 as it is not supported on the current OS"; \
|
||||
else \
|
||||
set -e; for dir in $(ALL_GO_MOD_DIRS); do \
|
||||
echo "go test ./... GOARCH 386 in $${dir}"; \
|
||||
(cd "$${dir}" && \
|
||||
GOARCH=386 $(GOTEST_MIN) ./...); \
|
||||
done; \
|
||||
fi
|
||||
|
||||
.PHONY: examples
|
||||
examples:
|
||||
@set -e; for ex in $(EXAMPLES); do \
|
||||
echo "Building $${ex}"; \
|
||||
(cd "$${ex}" && \
|
||||
go build .); \
|
||||
done
|
||||
|
||||
.PHONY: test-benchmarks
|
||||
test-benchmarks:
|
||||
@set -e; for dir in $(ALL_GO_MOD_DIRS); do \
|
||||
echo "test benchmarks in $${dir}"; \
|
||||
(cd "$${dir}" && go test -test.benchtime=1ms -run=NONE -bench=. ./...) > /dev/null; \
|
||||
done
|
||||
|
||||
.PHONY: lint
|
||||
lint: $(TOOLS_DIR)/golangci-lint $(TOOLS_DIR)/misspell lint-modules
|
||||
lint: misspell lint-modules | $(GOLANGCI_LINT)
|
||||
set -e; for dir in $(ALL_GO_MOD_DIRS); do \
|
||||
echo "golangci-lint in $${dir}"; \
|
||||
(cd "$${dir}" && \
|
||||
$(TOOLS_DIR)/golangci-lint run --fix && \
|
||||
$(TOOLS_DIR)/golangci-lint run); \
|
||||
$(GOLANGCI_LINT) run --fix && \
|
||||
$(GOLANGCI_LINT) run); \
|
||||
done
|
||||
$(TOOLS_DIR)/misspell -w $(ALL_DOCS)
|
||||
|
||||
.PHONY: misspell
|
||||
misspell: | $(MISSPELL)
|
||||
$(MISSPELL) -w $(ALL_DOCS)
|
||||
|
||||
.PHONY: lint-modules
|
||||
lint-modules:
|
||||
lint-modules: | $(CROSSLINK)
|
||||
set -e; for dir in $(ALL_GO_MOD_DIRS) $(TOOLS_MOD_DIR); do \
|
||||
echo "go mod tidy in $${dir}"; \
|
||||
echo "$(GO) mod tidy in $${dir}"; \
|
||||
(cd "$${dir}" && \
|
||||
go mod tidy); \
|
||||
$(GO) mod tidy); \
|
||||
done
|
||||
echo "cross-linking all go modules"
|
||||
(cd internal/tools; go run ./crosslink)
|
||||
|
||||
generate: $(TOOLS_DIR)/stringer
|
||||
set -e; for dir in $(ALL_GO_MOD_DIRS); do \
|
||||
echo "running generators in $${dir}"; \
|
||||
(cd "$${dir}" && \
|
||||
PATH="$(TOOLS_DIR):$${PATH}" go generate ./...); \
|
||||
done
|
||||
$(CROSSLINK)
|
||||
|
||||
.PHONY: license-check
|
||||
license-check:
|
||||
@licRes=$$(for f in $$(find . -type f \( -iname '*.go' -o -iname '*.sh' \) ! -path './vendor/*' ! -path './exporters/otlp/internal/opentelemetry-proto/*') ; do \
|
||||
@licRes=$$(for f in $$(find . -type f \( -iname '*.go' -o -iname '*.sh' \) ! -path '**/third_party/*' ! -path './exporters/otlp/internal/opentelemetry-proto/*') ; do \
|
||||
awk '/Copyright The OpenTelemetry Authors|generated|GENERATED/ && NR<=3 { found=1; next } END { if (!found) print FILENAME }' $$f; \
|
||||
done); \
|
||||
if [ -n "$${licRes}" ]; then \
|
||||
@@ -180,3 +167,13 @@ dependabot-check:
|
||||
echo "missing go.mod dependabot check:"; echo "$$result"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
.PHONY: check-clean-work-tree
|
||||
check-clean-work-tree:
|
||||
@if ! git diff --quiet; then \
|
||||
echo; \
|
||||
echo 'Working tree is not clean, did you forget to run "make precommit"?'; \
|
||||
echo; \
|
||||
git status; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
23
vendor/go.opentelemetry.io/otel/README.md
generated
vendored
23
vendor/go.opentelemetry.io/otel/README.md
generated
vendored
@@ -3,7 +3,8 @@
|
||||
[](https://github.com/open-telemetry/opentelemetry-go/actions?query=workflow%3Aci+branch%3Amain)
|
||||
[](https://pkg.go.dev/go.opentelemetry.io/otel)
|
||||
[](https://goreportcard.com/report/go.opentelemetry.io/otel)
|
||||
[](https://gitter.im/open-telemetry/opentelemetry-go?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
||||
[](https://cloud-native.slack.com/archives/C01NPAXACKT)
|
||||
|
||||
|
||||
The Go [OpenTelemetry](https://opentelemetry.io/) implementation.
|
||||
|
||||
@@ -26,6 +27,26 @@ and
|
||||
Project versioning information and stability guarantees can be found in the
|
||||
[versioning documentation](./VERSIONING.md).
|
||||
|
||||
### Compatibility
|
||||
|
||||
This project is tested on the following systems.
|
||||
|
||||
| OS | Go Version | Architecture |
|
||||
| ------- | ---------- | ------------ |
|
||||
| Ubuntu | 1.15 | amd64 |
|
||||
| Ubuntu | 1.14 | amd64 |
|
||||
| Ubuntu | 1.15 | 386 |
|
||||
| Ubuntu | 1.14 | 386 |
|
||||
| MacOS | 1.15 | amd64 |
|
||||
| MacOS | 1.14 | amd64 |
|
||||
| Windows | 1.15 | amd64 |
|
||||
| Windows | 1.14 | amd64 |
|
||||
| Windows | 1.15 | 386 |
|
||||
| Windows | 1.14 | 386 |
|
||||
|
||||
While this project should work for other systems, no compatibility guarantees
|
||||
are made for those systems currently.
|
||||
|
||||
## Getting Started
|
||||
|
||||
You can find a getting started guide on [opentelemetry.io](https://opentelemetry.io/docs/go/getting-started/).
|
||||
|
@@ -12,9 +12,9 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// Package label provides key and value labels.
|
||||
// package attribute provides key and value attributes.
|
||||
//
|
||||
// This package is currently in a pre-GA phase. Backwards incompatible changes
|
||||
// may be introduced in subsequent minor version releases as we work to track
|
||||
// the evolving OpenTelemetry specification and user feedback.
|
||||
package label // import "go.opentelemetry.io/otel/label"
|
||||
package attribute // import "go.opentelemetry.io/otel/attribute"
|
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package label // import "go.opentelemetry.io/otel/label"
|
||||
package attribute // import "go.opentelemetry.io/otel/attribute"
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
@@ -28,7 +28,7 @@ type (
|
||||
Encoder interface {
|
||||
// Encode returns the serialized encoding of the label
|
||||
// set using its Iterator. This result may be cached
|
||||
// by a label.Set.
|
||||
// by a attribute.Set.
|
||||
Encode(iterator Iterator) string
|
||||
|
||||
// ID returns a value that is unique for each class of
|
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package label // import "go.opentelemetry.io/otel/label"
|
||||
package attribute // import "go.opentelemetry.io/otel/attribute"
|
||||
|
||||
// Iterator allows iterating over the set of labels in order,
|
||||
// sorted by key.
|
||||
@@ -55,7 +55,7 @@ func (i *Iterator) Attribute() KeyValue {
|
||||
return i.Label()
|
||||
}
|
||||
|
||||
// IndexedLabel returns current index and label. Must be called only
|
||||
// IndexedLabel returns current index and attribute. Must be called only
|
||||
// after Next returns true.
|
||||
func (i *Iterator) IndexedLabel() (int, KeyValue) {
|
||||
return i.idx, i.Label()
|
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package label // import "go.opentelemetry.io/otel/label"
|
||||
package attribute // import "go.opentelemetry.io/otel/attribute"
|
||||
|
||||
// Key represents the key part in key-value pairs. It's a string. The
|
||||
// allowed character set in the key depends on the use of the key.
|
||||
@@ -44,19 +44,6 @@ func (k Key) Int64(v int64) KeyValue {
|
||||
}
|
||||
}
|
||||
|
||||
// Uint64 creates a KeyValue instance with a UINT64 Value.
|
||||
//
|
||||
// If creating both key and a uint64 value at the same time, then
|
||||
// instead of calling Key(name).Uint64(value) consider using a
|
||||
// convenience function provided by the api/key package -
|
||||
// key.Uint64(name, value).
|
||||
func (k Key) Uint64(v uint64) KeyValue {
|
||||
return KeyValue{
|
||||
Key: k,
|
||||
Value: Uint64Value(v),
|
||||
}
|
||||
}
|
||||
|
||||
// Float64 creates a KeyValue instance with a FLOAT64 Value.
|
||||
//
|
||||
// If creating both key and a float64 value at the same time, then
|
||||
@@ -70,45 +57,6 @@ func (k Key) Float64(v float64) KeyValue {
|
||||
}
|
||||
}
|
||||
|
||||
// Int32 creates a KeyValue instance with an INT32 Value.
|
||||
//
|
||||
// If creating both key and an int32 value at the same time, then
|
||||
// instead of calling Key(name).Int32(value) consider using a
|
||||
// convenience function provided by the api/key package -
|
||||
// key.Int32(name, value).
|
||||
func (k Key) Int32(v int32) KeyValue {
|
||||
return KeyValue{
|
||||
Key: k,
|
||||
Value: Int32Value(v),
|
||||
}
|
||||
}
|
||||
|
||||
// Uint32 creates a KeyValue instance with a UINT32 Value.
|
||||
//
|
||||
// If creating both key and a uint32 value at the same time, then
|
||||
// instead of calling Key(name).Uint32(value) consider using a
|
||||
// convenience function provided by the api/key package -
|
||||
// key.Uint32(name, value).
|
||||
func (k Key) Uint32(v uint32) KeyValue {
|
||||
return KeyValue{
|
||||
Key: k,
|
||||
Value: Uint32Value(v),
|
||||
}
|
||||
}
|
||||
|
||||
// Float32 creates a KeyValue instance with a FLOAT32 Value.
|
||||
//
|
||||
// If creating both key and a float32 value at the same time, then
|
||||
// instead of calling Key(name).Float32(value) consider using a
|
||||
// convenience function provided by the api/key package -
|
||||
// key.Float32(name, value).
|
||||
func (k Key) Float32(v float32) KeyValue {
|
||||
return KeyValue{
|
||||
Key: k,
|
||||
Value: Float32Value(v),
|
||||
}
|
||||
}
|
||||
|
||||
// String creates a KeyValue instance with a STRING Value.
|
||||
//
|
||||
// If creating both key and a string value at the same time, then
|
||||
@@ -122,8 +70,7 @@ func (k Key) String(v string) KeyValue {
|
||||
}
|
||||
}
|
||||
|
||||
// Int creates a KeyValue instance with either an INT32 or an INT64
|
||||
// Value, depending on whether the int type is 32 or 64 bits wide.
|
||||
// Int creates a KeyValue instance with an INT64 Value.
|
||||
//
|
||||
// If creating both key and an int value at the same time, then
|
||||
// instead of calling Key(name).Int(value) consider using a
|
||||
@@ -136,20 +83,6 @@ func (k Key) Int(v int) KeyValue {
|
||||
}
|
||||
}
|
||||
|
||||
// Uint creates a KeyValue instance with either a UINT32 or a UINT64
|
||||
// Value, depending on whether the uint type is 32 or 64 bits wide.
|
||||
//
|
||||
// If creating both key and a uint value at the same time, then
|
||||
// instead of calling Key(name).Uint(value) consider using a
|
||||
// convenience function provided by the api/key package -
|
||||
// key.Uint(name, value).
|
||||
func (k Key) Uint(v uint) KeyValue {
|
||||
return KeyValue{
|
||||
Key: k,
|
||||
Value: UintValue(v),
|
||||
}
|
||||
}
|
||||
|
||||
// Defined returns true for non-empty keys.
|
||||
func (k Key) Defined() bool {
|
||||
return len(k) != 0
|
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package label // import "go.opentelemetry.io/otel/label"
|
||||
package attribute // import "go.opentelemetry.io/otel/attribute"
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
@@ -26,6 +26,11 @@ type KeyValue struct {
|
||||
Value Value
|
||||
}
|
||||
|
||||
// Valid returns if kv is a valid OpenTelemetry attribute.
|
||||
func (kv KeyValue) Valid() bool {
|
||||
return kv.Key != "" && kv.Value.Type() != INVALID
|
||||
}
|
||||
|
||||
// Bool creates a new key-value pair with a passed name and a bool
|
||||
// value.
|
||||
func Bool(k string, v bool) KeyValue {
|
||||
@@ -38,36 +43,12 @@ func Int64(k string, v int64) KeyValue {
|
||||
return Key(k).Int64(v)
|
||||
}
|
||||
|
||||
// Uint64 creates a new key-value pair with a passed name and a uint64
|
||||
// value.
|
||||
func Uint64(k string, v uint64) KeyValue {
|
||||
return Key(k).Uint64(v)
|
||||
}
|
||||
|
||||
// Float64 creates a new key-value pair with a passed name and a float64
|
||||
// value.
|
||||
func Float64(k string, v float64) KeyValue {
|
||||
return Key(k).Float64(v)
|
||||
}
|
||||
|
||||
// Int32 creates a new key-value pair with a passed name and an int32
|
||||
// value.
|
||||
func Int32(k string, v int32) KeyValue {
|
||||
return Key(k).Int32(v)
|
||||
}
|
||||
|
||||
// Uint32 creates a new key-value pair with a passed name and a uint32
|
||||
// value.
|
||||
func Uint32(k string, v uint32) KeyValue {
|
||||
return Key(k).Uint32(v)
|
||||
}
|
||||
|
||||
// Float32 creates a new key-value pair with a passed name and a float32
|
||||
// value.
|
||||
func Float32(k string, v float32) KeyValue {
|
||||
return Key(k).Float32(v)
|
||||
}
|
||||
|
||||
// String creates a new key-value pair with a passed name and a string
|
||||
// value.
|
||||
func String(k, v string) KeyValue {
|
||||
@@ -87,13 +68,6 @@ func Int(k string, v int) KeyValue {
|
||||
return Key(k).Int(v)
|
||||
}
|
||||
|
||||
// Uint creates a new key-value pair instance with a passed name and
|
||||
// either an uint32 or an uint64 value, depending on whether the uint
|
||||
// type is 32 or 64 bits wide.
|
||||
func Uint(k string, v uint) KeyValue {
|
||||
return Key(k).Uint(v)
|
||||
}
|
||||
|
||||
// Array creates a new key-value pair with a passed name and a array.
|
||||
// Only arrays of primitive type are supported.
|
||||
func Array(k string, v interface{}) KeyValue {
|
||||
@@ -120,18 +94,8 @@ func Any(k string, value interface{}) KeyValue {
|
||||
return Bool(k, rv.Bool())
|
||||
case reflect.Int, reflect.Int8, reflect.Int16:
|
||||
return Int(k, int(rv.Int()))
|
||||
case reflect.Int32:
|
||||
return Int32(k, int32(rv.Int()))
|
||||
case reflect.Int64:
|
||||
return Int64(k, int64(rv.Int()))
|
||||
case reflect.Uint, reflect.Uint8, reflect.Uint16:
|
||||
return Uint(k, uint(rv.Uint()))
|
||||
case reflect.Uint32:
|
||||
return Uint32(k, uint32(rv.Uint()))
|
||||
case reflect.Uint64, reflect.Uintptr:
|
||||
return Uint64(k, rv.Uint())
|
||||
case reflect.Float32:
|
||||
return Float32(k, float32(rv.Float()))
|
||||
return Int64(k, rv.Int())
|
||||
case reflect.Float64:
|
||||
return Float64(k, rv.Float())
|
||||
case reflect.String:
|
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package label // import "go.opentelemetry.io/otel/label"
|
||||
package attribute // import "go.opentelemetry.io/otel/attribute"
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
@@ -295,7 +295,7 @@ func NewSetWithFiltered(kvs []KeyValue, filter Filter) (Set, []KeyValue) {
|
||||
// - allocating a `Set` for storing the return value of this
|
||||
// constructor.
|
||||
//
|
||||
// The result maintains a cache of encoded labels, by label.EncoderID.
|
||||
// The result maintains a cache of encoded labels, by attribute.EncoderID.
|
||||
// This value should not be copied after its first use.
|
||||
//
|
||||
// The second `[]KeyValue` return value is a list of labels that were
|
@@ -1,6 +1,6 @@
|
||||
// Code generated by "stringer -type=Type"; DO NOT EDIT.
|
||||
|
||||
package label
|
||||
package attribute
|
||||
|
||||
import "strconv"
|
||||
|
||||
@@ -10,19 +10,15 @@ func _() {
|
||||
var x [1]struct{}
|
||||
_ = x[INVALID-0]
|
||||
_ = x[BOOL-1]
|
||||
_ = x[INT32-2]
|
||||
_ = x[INT64-3]
|
||||
_ = x[UINT32-4]
|
||||
_ = x[UINT64-5]
|
||||
_ = x[FLOAT32-6]
|
||||
_ = x[FLOAT64-7]
|
||||
_ = x[STRING-8]
|
||||
_ = x[ARRAY-9]
|
||||
_ = x[INT64-2]
|
||||
_ = x[FLOAT64-3]
|
||||
_ = x[STRING-4]
|
||||
_ = x[ARRAY-5]
|
||||
}
|
||||
|
||||
const _Type_name = "INVALIDBOOLINT32INT64UINT32UINT64FLOAT32FLOAT64STRINGARRAY"
|
||||
const _Type_name = "INVALIDBOOLINT64FLOAT64STRINGARRAY"
|
||||
|
||||
var _Type_index = [...]uint8{0, 7, 11, 16, 21, 27, 33, 40, 47, 53, 58}
|
||||
var _Type_index = [...]uint8{0, 7, 11, 16, 23, 29, 34}
|
||||
|
||||
func (i Type) String() string {
|
||||
if i < 0 || i >= Type(len(_Type_index)-1) {
|
@@ -12,14 +12,13 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package label // import "go.opentelemetry.io/otel/label"
|
||||
package attribute // import "go.opentelemetry.io/otel/attribute"
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"unsafe"
|
||||
|
||||
"go.opentelemetry.io/otel/internal"
|
||||
)
|
||||
@@ -44,17 +43,9 @@ const (
|
||||
INVALID Type = iota
|
||||
// BOOL is a boolean Type Value.
|
||||
BOOL
|
||||
// INT32 is a 32-bit signed integral Type Value.
|
||||
INT32
|
||||
// INT64 is a 64-bit signed integral Type Value.
|
||||
INT64
|
||||
// UINT32 is a 32-bit unsigned integral Type Value.
|
||||
UINT32
|
||||
// UINT64 is a 64-bit unsigned integral Type Value.
|
||||
UINT64
|
||||
// FLOAT32 is a 32-bit floating point Type Value.
|
||||
FLOAT32
|
||||
// FLOAT64 is a 64-bit floating point Type Value.
|
||||
FLOAT64
|
||||
// STRING is a string Type Value.
|
||||
STRING
|
||||
@@ -80,14 +71,6 @@ func Int64Value(v int64) Value {
|
||||
}
|
||||
}
|
||||
|
||||
// Uint64Value creates a UINT64 Value.
|
||||
func Uint64Value(v uint64) Value {
|
||||
return Value{
|
||||
vtype: UINT64,
|
||||
numeric: internal.Uint64ToRaw(v),
|
||||
}
|
||||
}
|
||||
|
||||
// Float64Value creates a FLOAT64 Value.
|
||||
func Float64Value(v float64) Value {
|
||||
return Value{
|
||||
@@ -96,30 +79,6 @@ func Float64Value(v float64) Value {
|
||||
}
|
||||
}
|
||||
|
||||
// Int32Value creates an INT32 Value.
|
||||
func Int32Value(v int32) Value {
|
||||
return Value{
|
||||
vtype: INT32,
|
||||
numeric: internal.Int32ToRaw(v),
|
||||
}
|
||||
}
|
||||
|
||||
// Uint32Value creates a UINT32 Value.
|
||||
func Uint32Value(v uint32) Value {
|
||||
return Value{
|
||||
vtype: UINT32,
|
||||
numeric: internal.Uint32ToRaw(v),
|
||||
}
|
||||
}
|
||||
|
||||
// Float32Value creates a FLOAT32 Value.
|
||||
func Float32Value(v float32) Value {
|
||||
return Value{
|
||||
vtype: FLOAT32,
|
||||
numeric: internal.Float32ToRaw(v),
|
||||
}
|
||||
}
|
||||
|
||||
// StringValue creates a STRING Value.
|
||||
func StringValue(v string) Value {
|
||||
return Value{
|
||||
@@ -128,28 +87,14 @@ func StringValue(v string) Value {
|
||||
}
|
||||
}
|
||||
|
||||
// IntValue creates either an INT32 or an INT64 Value, depending on whether
|
||||
// the int type is 32 or 64 bits wide.
|
||||
// IntValue creates an INT64 Value.
|
||||
func IntValue(v int) Value {
|
||||
if unsafe.Sizeof(v) == 4 {
|
||||
return Int32Value(int32(v))
|
||||
}
|
||||
return Int64Value(int64(v))
|
||||
}
|
||||
|
||||
// UintValue creates either a UINT32 or a UINT64 Value, depending on whether
|
||||
// the uint type is 32 or 64 bits wide.
|
||||
func UintValue(v uint) Value {
|
||||
if unsafe.Sizeof(v) == 4 {
|
||||
return Uint32Value(uint32(v))
|
||||
}
|
||||
return Uint64Value(uint64(v))
|
||||
}
|
||||
|
||||
// ArrayValue creates an ARRAY value from an array or slice.
|
||||
// Only arrays or slices of bool, int, int32, int64, uint, uint32, uint64,
|
||||
// float, float32, float64, or string types are allowed. Specifically, arrays
|
||||
// and slices can not contain other arrays, slices, structs, or non-standard
|
||||
// Only arrays or slices of bool, int, int64, float, float64, or string types are allowed.
|
||||
// Specifically, arrays and slices can not contain other arrays, slices, structs, or non-standard
|
||||
// types. If the passed value is not an array or slice of these types an
|
||||
// INVALID value is returned.
|
||||
func ArrayValue(v interface{}) Value {
|
||||
@@ -159,9 +104,8 @@ func ArrayValue(v interface{}) Value {
|
||||
typ := reflect.TypeOf(v).Elem()
|
||||
kind := typ.Kind()
|
||||
switch kind {
|
||||
case reflect.Bool, reflect.Int, reflect.Int32, reflect.Int64,
|
||||
reflect.Float32, reflect.Float64, reflect.String,
|
||||
reflect.Uint, reflect.Uint32, reflect.Uint64:
|
||||
case reflect.Bool, reflect.Int, reflect.Int64,
|
||||
reflect.Float64, reflect.String:
|
||||
val := reflect.ValueOf(v)
|
||||
length := val.Len()
|
||||
frozen := reflect.Indirect(reflect.New(reflect.ArrayOf(length, typ)))
|
||||
@@ -188,36 +132,12 @@ func (v Value) AsBool() bool {
|
||||
return internal.RawToBool(v.numeric)
|
||||
}
|
||||
|
||||
// AsInt32 returns the int32 value. Make sure that the Value's type is
|
||||
// INT32.
|
||||
func (v Value) AsInt32() int32 {
|
||||
return internal.RawToInt32(v.numeric)
|
||||
}
|
||||
|
||||
// AsInt64 returns the int64 value. Make sure that the Value's type is
|
||||
// INT64.
|
||||
func (v Value) AsInt64() int64 {
|
||||
return internal.RawToInt64(v.numeric)
|
||||
}
|
||||
|
||||
// AsUint32 returns the uint32 value. Make sure that the Value's type
|
||||
// is UINT32.
|
||||
func (v Value) AsUint32() uint32 {
|
||||
return internal.RawToUint32(v.numeric)
|
||||
}
|
||||
|
||||
// AsUint64 returns the uint64 value. Make sure that the Value's type is
|
||||
// UINT64.
|
||||
func (v Value) AsUint64() uint64 {
|
||||
return internal.RawToUint64(v.numeric)
|
||||
}
|
||||
|
||||
// AsFloat32 returns the float32 value. Make sure that the Value's
|
||||
// type is FLOAT32.
|
||||
func (v Value) AsFloat32() float32 {
|
||||
return internal.RawToFloat32(v.numeric)
|
||||
}
|
||||
|
||||
// AsFloat64 returns the float64 value. Make sure that the Value's
|
||||
// type is FLOAT64.
|
||||
func (v Value) AsFloat64() float64 {
|
||||
@@ -244,16 +164,8 @@ func (v Value) AsInterface() interface{} {
|
||||
return v.AsArray()
|
||||
case BOOL:
|
||||
return v.AsBool()
|
||||
case INT32:
|
||||
return v.AsInt32()
|
||||
case INT64:
|
||||
return v.AsInt64()
|
||||
case UINT32:
|
||||
return v.AsUint32()
|
||||
case UINT64:
|
||||
return v.AsUint64()
|
||||
case FLOAT32:
|
||||
return v.AsFloat32()
|
||||
case FLOAT64:
|
||||
return v.AsFloat64()
|
||||
case STRING:
|
||||
@@ -269,16 +181,8 @@ func (v Value) Emit() string {
|
||||
return fmt.Sprint(v.array)
|
||||
case BOOL:
|
||||
return strconv.FormatBool(v.AsBool())
|
||||
case INT32:
|
||||
return strconv.FormatInt(int64(v.AsInt32()), 10)
|
||||
case INT64:
|
||||
return strconv.FormatInt(v.AsInt64(), 10)
|
||||
case UINT32:
|
||||
return strconv.FormatUint(uint64(v.AsUint32()), 10)
|
||||
case UINT64:
|
||||
return strconv.FormatUint(v.AsUint64(), 10)
|
||||
case FLOAT32:
|
||||
return fmt.Sprint(v.AsFloat32())
|
||||
case FLOAT64:
|
||||
return fmt.Sprint(v.AsFloat64())
|
||||
case STRING:
|
8
vendor/go.opentelemetry.io/otel/go.mod
generated
vendored
8
vendor/go.opentelemetry.io/otel/go.mod
generated
vendored
@@ -3,11 +3,11 @@ module go.opentelemetry.io/otel
|
||||
go 1.14
|
||||
|
||||
require (
|
||||
github.com/google/go-cmp v0.5.4
|
||||
github.com/google/go-cmp v0.5.5
|
||||
github.com/stretchr/testify v1.7.0
|
||||
go.opentelemetry.io/otel/metric v0.17.0
|
||||
go.opentelemetry.io/otel/oteltest v0.17.0
|
||||
go.opentelemetry.io/otel/trace v0.17.0
|
||||
go.opentelemetry.io/otel/metric v0.19.0
|
||||
go.opentelemetry.io/otel/oteltest v0.19.0
|
||||
go.opentelemetry.io/otel/trace v0.19.0
|
||||
)
|
||||
|
||||
replace go.opentelemetry.io/otel => ./
|
||||
|
4
vendor/go.opentelemetry.io/otel/go.sum
generated
vendored
4
vendor/go.opentelemetry.io/otel/go.sum
generated
vendored
@@ -1,7 +1,7 @@
|
||||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M=
|
||||
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
|
28
vendor/go.opentelemetry.io/otel/internal/baggage/baggage.go
generated
vendored
28
vendor/go.opentelemetry.io/otel/internal/baggage/baggage.go
generated
vendored
@@ -18,11 +18,11 @@ package baggage
|
||||
import (
|
||||
"context"
|
||||
|
||||
"go.opentelemetry.io/otel/label"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
)
|
||||
|
||||
type rawMap map[label.Key]label.Value
|
||||
type keySet map[label.Key]struct{}
|
||||
type rawMap map[attribute.Key]attribute.Value
|
||||
type keySet map[attribute.Key]struct{}
|
||||
|
||||
// Map is an immutable storage for correlations.
|
||||
type Map struct {
|
||||
@@ -35,18 +35,18 @@ type MapUpdate struct {
|
||||
// DropSingleK contains a single key to be dropped from
|
||||
// correlations. Use this to avoid an overhead of a slice
|
||||
// allocation if there is only one key to drop.
|
||||
DropSingleK label.Key
|
||||
DropSingleK attribute.Key
|
||||
// DropMultiK contains all the keys to be dropped from
|
||||
// correlations.
|
||||
DropMultiK []label.Key
|
||||
DropMultiK []attribute.Key
|
||||
|
||||
// SingleKV contains a single key-value pair to be added to
|
||||
// correlations. Use this to avoid an overhead of a slice
|
||||
// allocation if there is only one key-value pair to add.
|
||||
SingleKV label.KeyValue
|
||||
SingleKV attribute.KeyValue
|
||||
// MultiKV contains all the key-value pairs to be added to
|
||||
// correlations.
|
||||
MultiKV []label.KeyValue
|
||||
MultiKV []attribute.KeyValue
|
||||
}
|
||||
|
||||
func newMap(raw rawMap) Map {
|
||||
@@ -104,7 +104,7 @@ func getModificationSets(update MapUpdate) (delSet, addSet keySet) {
|
||||
deletionsCount++
|
||||
}
|
||||
if deletionsCount > 0 {
|
||||
delSet = make(map[label.Key]struct{}, deletionsCount)
|
||||
delSet = make(map[attribute.Key]struct{}, deletionsCount)
|
||||
for _, k := range update.DropMultiK {
|
||||
delSet[k] = struct{}{}
|
||||
}
|
||||
@@ -118,7 +118,7 @@ func getModificationSets(update MapUpdate) (delSet, addSet keySet) {
|
||||
additionsCount++
|
||||
}
|
||||
if additionsCount > 0 {
|
||||
addSet = make(map[label.Key]struct{}, additionsCount)
|
||||
addSet = make(map[attribute.Key]struct{}, additionsCount)
|
||||
for _, k := range update.MultiKV {
|
||||
addSet[k.Key] = struct{}{}
|
||||
}
|
||||
@@ -149,14 +149,14 @@ func getNewMapSize(m rawMap, delSet, addSet keySet) int {
|
||||
|
||||
// Value gets a value from correlations map and returns a boolean
|
||||
// value indicating whether the key exist in the map.
|
||||
func (m Map) Value(k label.Key) (label.Value, bool) {
|
||||
func (m Map) Value(k attribute.Key) (attribute.Value, bool) {
|
||||
value, ok := m.m[k]
|
||||
return value, ok
|
||||
}
|
||||
|
||||
// HasValue returns a boolean value indicating whether the key exist
|
||||
// in the map.
|
||||
func (m Map) HasValue(k label.Key) bool {
|
||||
func (m Map) HasValue(k attribute.Key) bool {
|
||||
_, has := m.Value(k)
|
||||
return has
|
||||
}
|
||||
@@ -169,9 +169,9 @@ func (m Map) Len() int {
|
||||
// Foreach calls a passed callback once on each key-value pair until
|
||||
// all the key-value pairs of the map were iterated or the callback
|
||||
// returns false, whichever happens first.
|
||||
func (m Map) Foreach(f func(label.KeyValue) bool) {
|
||||
func (m Map) Foreach(f func(attribute.KeyValue) bool) {
|
||||
for k, v := range m.m {
|
||||
if !f(label.KeyValue{
|
||||
if !f(attribute.KeyValue{
|
||||
Key: k,
|
||||
Value: v,
|
||||
}) {
|
||||
@@ -316,7 +316,7 @@ func ContextWithNoCorrelationData(ctx context.Context) context.Context {
|
||||
|
||||
// NewContext returns a context with the map from passed context
|
||||
// updated with the passed key-value pairs.
|
||||
func NewContext(ctx context.Context, keyvalues ...label.KeyValue) context.Context {
|
||||
func NewContext(ctx context.Context, keyvalues ...attribute.KeyValue) context.Context {
|
||||
return ContextWithMap(ctx, MapFromContext(ctx).Apply(MapUpdate{
|
||||
MultiKV: keyvalues,
|
||||
}))
|
||||
|
10
vendor/go.opentelemetry.io/otel/internal/global/meter.go
generated
vendored
10
vendor/go.opentelemetry.io/otel/internal/global/meter.go
generated
vendored
@@ -20,7 +20,7 @@ import (
|
||||
"sync/atomic"
|
||||
"unsafe"
|
||||
|
||||
"go.opentelemetry.io/otel/label"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/metric"
|
||||
"go.opentelemetry.io/otel/metric/number"
|
||||
"go.opentelemetry.io/otel/metric/registry"
|
||||
@@ -109,7 +109,7 @@ type syncHandle struct {
|
||||
delegate unsafe.Pointer // (*metric.BoundInstrumentImpl)
|
||||
|
||||
inst *syncImpl
|
||||
labels []label.KeyValue
|
||||
labels []attribute.KeyValue
|
||||
|
||||
initialize sync.Once
|
||||
}
|
||||
@@ -228,7 +228,7 @@ func (inst *syncImpl) Implementation() interface{} {
|
||||
return inst
|
||||
}
|
||||
|
||||
func (inst *syncImpl) Bind(labels []label.KeyValue) metric.BoundSyncImpl {
|
||||
func (inst *syncImpl) Bind(labels []attribute.KeyValue) metric.BoundSyncImpl {
|
||||
if implPtr := (*metric.SyncImpl)(atomic.LoadPointer(&inst.delegate)); implPtr != nil {
|
||||
return (*implPtr).Bind(labels)
|
||||
}
|
||||
@@ -300,13 +300,13 @@ func (obs *asyncImpl) setDelegate(d metric.MeterImpl) {
|
||||
|
||||
// Metric updates
|
||||
|
||||
func (m *meterImpl) RecordBatch(ctx context.Context, labels []label.KeyValue, measurements ...metric.Measurement) {
|
||||
func (m *meterImpl) RecordBatch(ctx context.Context, labels []attribute.KeyValue, measurements ...metric.Measurement) {
|
||||
if delegatePtr := (*metric.MeterImpl)(atomic.LoadPointer(&m.delegate)); delegatePtr != nil {
|
||||
(*delegatePtr).RecordBatch(ctx, labels, measurements...)
|
||||
}
|
||||
}
|
||||
|
||||
func (inst *syncImpl) RecordOne(ctx context.Context, number number.Number, labels []label.KeyValue) {
|
||||
func (inst *syncImpl) RecordOne(ctx context.Context, number number.Number, labels []attribute.KeyValue) {
|
||||
if instPtr := (*metric.SyncImpl)(atomic.LoadPointer(&inst.delegate)); instPtr != nil {
|
||||
(*instPtr).RecordOne(ctx, number, labels)
|
||||
}
|
||||
|
53
vendor/go.opentelemetry.io/otel/internal/global/trace.go
generated
vendored
53
vendor/go.opentelemetry.io/otel/internal/global/trace.go
generated
vendored
@@ -34,6 +34,7 @@ SDK prior to any Tracer creation.
|
||||
import (
|
||||
"context"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
|
||||
"go.opentelemetry.io/otel/internal/trace/noop"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
@@ -44,9 +45,8 @@ import (
|
||||
// All TracerProvider functionality is forwarded to a delegate once
|
||||
// configured.
|
||||
type tracerProvider struct {
|
||||
mtx sync.Mutex
|
||||
tracers []*tracer
|
||||
|
||||
mtx sync.Mutex
|
||||
tracers map[il]*tracer
|
||||
delegate trace.TracerProvider
|
||||
}
|
||||
|
||||
@@ -60,17 +60,17 @@ var _ trace.TracerProvider = &tracerProvider{}
|
||||
// All Tracers provided prior to this function call are switched out to be
|
||||
// Tracers provided by provider.
|
||||
//
|
||||
// Delegation only happens on the first call to this method. All subsequent
|
||||
// calls result in no delegation changes.
|
||||
// It is guaranteed by the caller that this happens only once.
|
||||
func (p *tracerProvider) setDelegate(provider trace.TracerProvider) {
|
||||
if p.delegate != nil {
|
||||
return
|
||||
}
|
||||
|
||||
p.mtx.Lock()
|
||||
defer p.mtx.Unlock()
|
||||
|
||||
p.delegate = provider
|
||||
|
||||
if len(p.tracers) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
for _, t := range p.tracers {
|
||||
t.setDelegate(provider)
|
||||
}
|
||||
@@ -87,21 +87,40 @@ func (p *tracerProvider) Tracer(name string, opts ...trace.TracerOption) trace.T
|
||||
return p.delegate.Tracer(name, opts...)
|
||||
}
|
||||
|
||||
// At this moment it is guaranteed that no sdk is installed, save the tracer in the tracers map.
|
||||
|
||||
key := il{
|
||||
name: name,
|
||||
version: trace.NewTracerConfig(opts...).InstrumentationVersion,
|
||||
}
|
||||
|
||||
if p.tracers == nil {
|
||||
p.tracers = make(map[il]*tracer)
|
||||
}
|
||||
|
||||
if val, ok := p.tracers[key]; ok {
|
||||
return val
|
||||
}
|
||||
|
||||
t := &tracer{name: name, opts: opts}
|
||||
p.tracers = append(p.tracers, t)
|
||||
p.tracers[key] = t
|
||||
return t
|
||||
}
|
||||
|
||||
type il struct {
|
||||
name string
|
||||
version string
|
||||
}
|
||||
|
||||
// tracer is a placeholder for a trace.Tracer.
|
||||
//
|
||||
// All Tracer functionality is forwarded to a delegate once configured.
|
||||
// Otherwise, all functionality is forwarded to a NoopTracer.
|
||||
type tracer struct {
|
||||
once sync.Once
|
||||
name string
|
||||
opts []trace.TracerOption
|
||||
|
||||
delegate trace.Tracer
|
||||
delegate atomic.Value
|
||||
}
|
||||
|
||||
// Compile-time guarantee that tracer implements the trace.Tracer interface.
|
||||
@@ -112,17 +131,17 @@ var _ trace.Tracer = &tracer{}
|
||||
//
|
||||
// All subsequent calls to the Tracer methods will be passed to the delegate.
|
||||
//
|
||||
// Delegation only happens on the first call to this method. All subsequent
|
||||
// calls result in no delegation changes.
|
||||
// It is guaranteed by the caller that this happens only once.
|
||||
func (t *tracer) setDelegate(provider trace.TracerProvider) {
|
||||
t.once.Do(func() { t.delegate = provider.Tracer(t.name, t.opts...) })
|
||||
t.delegate.Store(provider.Tracer(t.name, t.opts...))
|
||||
}
|
||||
|
||||
// Start implements trace.Tracer by forwarding the call to t.delegate if
|
||||
// set, otherwise it forwards the call to a NoopTracer.
|
||||
func (t *tracer) Start(ctx context.Context, name string, opts ...trace.SpanOption) (context.Context, trace.Span) {
|
||||
if t.delegate != nil {
|
||||
return t.delegate.Start(ctx, name, opts...)
|
||||
delegate := t.delegate.Load()
|
||||
if delegate != nil {
|
||||
return delegate.(trace.Tracer).Start(ctx, name, opts...)
|
||||
}
|
||||
return noop.Tracer.Start(ctx, name, opts...)
|
||||
}
|
||||
|
36
vendor/go.opentelemetry.io/otel/internal/rawhelpers.go
generated
vendored
36
vendor/go.opentelemetry.io/otel/internal/rawhelpers.go
generated
vendored
@@ -38,14 +38,6 @@ func RawToInt64(r uint64) int64 {
|
||||
return int64(r)
|
||||
}
|
||||
|
||||
func Uint64ToRaw(u uint64) uint64 {
|
||||
return u
|
||||
}
|
||||
|
||||
func RawToUint64(r uint64) uint64 {
|
||||
return r
|
||||
}
|
||||
|
||||
func Float64ToRaw(f float64) uint64 {
|
||||
return math.Float64bits(f)
|
||||
}
|
||||
@@ -54,30 +46,6 @@ func RawToFloat64(r uint64) float64 {
|
||||
return math.Float64frombits(r)
|
||||
}
|
||||
|
||||
func Int32ToRaw(i int32) uint64 {
|
||||
return uint64(i)
|
||||
}
|
||||
|
||||
func RawToInt32(r uint64) int32 {
|
||||
return int32(r)
|
||||
}
|
||||
|
||||
func Uint32ToRaw(u uint32) uint64 {
|
||||
return uint64(u)
|
||||
}
|
||||
|
||||
func RawToUint32(r uint64) uint32 {
|
||||
return uint32(r)
|
||||
}
|
||||
|
||||
func Float32ToRaw(f float32) uint64 {
|
||||
return Uint32ToRaw(math.Float32bits(f))
|
||||
}
|
||||
|
||||
func RawToFloat32(r uint64) float32 {
|
||||
return math.Float32frombits(RawToUint32(r))
|
||||
}
|
||||
|
||||
func RawPtrToFloat64Ptr(r *uint64) *float64 {
|
||||
return (*float64)(unsafe.Pointer(r))
|
||||
}
|
||||
@@ -85,7 +53,3 @@ func RawPtrToFloat64Ptr(r *uint64) *float64 {
|
||||
func RawPtrToInt64Ptr(r *uint64) *int64 {
|
||||
return (*int64)(unsafe.Pointer(r))
|
||||
}
|
||||
|
||||
func RawPtrToUint64Ptr(r *uint64) *uint64 {
|
||||
return r
|
||||
}
|
||||
|
6
vendor/go.opentelemetry.io/otel/metric/go.mod
generated
vendored
6
vendor/go.opentelemetry.io/otel/metric/go.mod
generated
vendored
@@ -47,8 +47,8 @@ replace go.opentelemetry.io/otel/sdk/metric => ../sdk/metric
|
||||
replace go.opentelemetry.io/otel/trace => ../trace
|
||||
|
||||
require (
|
||||
github.com/google/go-cmp v0.5.4
|
||||
github.com/google/go-cmp v0.5.5
|
||||
github.com/stretchr/testify v1.7.0
|
||||
go.opentelemetry.io/otel v0.17.0
|
||||
go.opentelemetry.io/otel/oteltest v0.17.0
|
||||
go.opentelemetry.io/otel v0.19.0
|
||||
go.opentelemetry.io/otel/oteltest v0.19.0
|
||||
)
|
||||
|
4
vendor/go.opentelemetry.io/otel/metric/go.sum
generated
vendored
4
vendor/go.opentelemetry.io/otel/metric/go.sum
generated
vendored
@@ -1,7 +1,7 @@
|
||||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M=
|
||||
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
|
4
vendor/go.opentelemetry.io/otel/metric/metric.go
generated
vendored
4
vendor/go.opentelemetry.io/otel/metric/metric.go
generated
vendored
@@ -17,7 +17,7 @@ package metric // import "go.opentelemetry.io/otel/metric"
|
||||
import (
|
||||
"context"
|
||||
|
||||
"go.opentelemetry.io/otel/label"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/metric/number"
|
||||
"go.opentelemetry.io/otel/unit"
|
||||
)
|
||||
@@ -42,7 +42,7 @@ type Meter struct {
|
||||
}
|
||||
|
||||
// RecordBatch atomically records a batch of measurements.
|
||||
func (m Meter) RecordBatch(ctx context.Context, ls []label.KeyValue, ms ...Measurement) {
|
||||
func (m Meter) RecordBatch(ctx context.Context, ls []attribute.KeyValue, ms ...Measurement) {
|
||||
if m.impl == nil {
|
||||
return
|
||||
}
|
||||
|
52
vendor/go.opentelemetry.io/otel/metric/metric_instrument.go
generated
vendored
52
vendor/go.opentelemetry.io/otel/metric/metric_instrument.go
generated
vendored
@@ -20,7 +20,7 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"go.opentelemetry.io/otel/label"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/metric/number"
|
||||
)
|
||||
|
||||
@@ -116,25 +116,25 @@ type BatchObserverFunc func(context.Context, BatchObserverResult)
|
||||
// observations for one asynchronous integer metric instrument.
|
||||
type Int64ObserverResult struct {
|
||||
instrument AsyncImpl
|
||||
function func([]label.KeyValue, ...Observation)
|
||||
function func([]attribute.KeyValue, ...Observation)
|
||||
}
|
||||
|
||||
// Float64ObserverResult is passed to an observer callback to capture
|
||||
// observations for one asynchronous floating point metric instrument.
|
||||
type Float64ObserverResult struct {
|
||||
instrument AsyncImpl
|
||||
function func([]label.KeyValue, ...Observation)
|
||||
function func([]attribute.KeyValue, ...Observation)
|
||||
}
|
||||
|
||||
// BatchObserverResult is passed to a batch observer callback to
|
||||
// capture observations for multiple asynchronous instruments.
|
||||
type BatchObserverResult struct {
|
||||
function func([]label.KeyValue, ...Observation)
|
||||
function func([]attribute.KeyValue, ...Observation)
|
||||
}
|
||||
|
||||
// Observe captures a single integer value from the associated
|
||||
// instrument callback, with the given labels.
|
||||
func (ir Int64ObserverResult) Observe(value int64, labels ...label.KeyValue) {
|
||||
func (ir Int64ObserverResult) Observe(value int64, labels ...attribute.KeyValue) {
|
||||
ir.function(labels, Observation{
|
||||
instrument: ir.instrument,
|
||||
number: number.NewInt64Number(value),
|
||||
@@ -143,7 +143,7 @@ func (ir Int64ObserverResult) Observe(value int64, labels ...label.KeyValue) {
|
||||
|
||||
// Observe captures a single floating point value from the associated
|
||||
// instrument callback, with the given labels.
|
||||
func (fr Float64ObserverResult) Observe(value float64, labels ...label.KeyValue) {
|
||||
func (fr Float64ObserverResult) Observe(value float64, labels ...attribute.KeyValue) {
|
||||
fr.function(labels, Observation{
|
||||
instrument: fr.instrument,
|
||||
number: number.NewFloat64Number(value),
|
||||
@@ -152,7 +152,7 @@ func (fr Float64ObserverResult) Observe(value float64, labels ...label.KeyValue)
|
||||
|
||||
// Observe captures a multiple observations from the associated batch
|
||||
// instrument callback, with the given labels.
|
||||
func (br BatchObserverResult) Observe(labels []label.KeyValue, obs ...Observation) {
|
||||
func (br BatchObserverResult) Observe(labels []attribute.KeyValue, obs ...Observation) {
|
||||
br.function(labels, obs...)
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ type AsyncSingleRunner interface {
|
||||
// receives one captured observation. (The function accepts
|
||||
// multiple observations so the same implementation can be
|
||||
// used for batch runners.)
|
||||
Run(ctx context.Context, single AsyncImpl, capture func([]label.KeyValue, ...Observation))
|
||||
Run(ctx context.Context, single AsyncImpl, capture func([]attribute.KeyValue, ...Observation))
|
||||
|
||||
AsyncRunner
|
||||
}
|
||||
@@ -183,7 +183,7 @@ type AsyncSingleRunner interface {
|
||||
type AsyncBatchRunner interface {
|
||||
// Run accepts a function for capturing observations of
|
||||
// multiple instruments.
|
||||
Run(ctx context.Context, capture func([]label.KeyValue, ...Observation))
|
||||
Run(ctx context.Context, capture func([]attribute.KeyValue, ...Observation))
|
||||
|
||||
AsyncRunner
|
||||
}
|
||||
@@ -217,7 +217,7 @@ func (*Float64ObserverFunc) AnyRunner() {}
|
||||
func (*BatchObserverFunc) AnyRunner() {}
|
||||
|
||||
// Run implements AsyncSingleRunner.
|
||||
func (i *Int64ObserverFunc) Run(ctx context.Context, impl AsyncImpl, function func([]label.KeyValue, ...Observation)) {
|
||||
func (i *Int64ObserverFunc) Run(ctx context.Context, impl AsyncImpl, function func([]attribute.KeyValue, ...Observation)) {
|
||||
(*i)(ctx, Int64ObserverResult{
|
||||
instrument: impl,
|
||||
function: function,
|
||||
@@ -225,7 +225,7 @@ func (i *Int64ObserverFunc) Run(ctx context.Context, impl AsyncImpl, function fu
|
||||
}
|
||||
|
||||
// Run implements AsyncSingleRunner.
|
||||
func (f *Float64ObserverFunc) Run(ctx context.Context, impl AsyncImpl, function func([]label.KeyValue, ...Observation)) {
|
||||
func (f *Float64ObserverFunc) Run(ctx context.Context, impl AsyncImpl, function func([]attribute.KeyValue, ...Observation)) {
|
||||
(*f)(ctx, Float64ObserverResult{
|
||||
instrument: impl,
|
||||
function: function,
|
||||
@@ -233,7 +233,7 @@ func (f *Float64ObserverFunc) Run(ctx context.Context, impl AsyncImpl, function
|
||||
}
|
||||
|
||||
// Run implements AsyncBatchRunner.
|
||||
func (b *BatchObserverFunc) Run(ctx context.Context, function func([]label.KeyValue, ...Observation)) {
|
||||
func (b *BatchObserverFunc) Run(ctx context.Context, function func([]attribute.KeyValue, ...Observation)) {
|
||||
(*b)(ctx, BatchObserverResult{
|
||||
function: function,
|
||||
})
|
||||
@@ -442,7 +442,7 @@ func (s syncInstrument) SyncImpl() SyncImpl {
|
||||
return s.instrument
|
||||
}
|
||||
|
||||
func (s syncInstrument) bind(labels []label.KeyValue) syncBoundInstrument {
|
||||
func (s syncInstrument) bind(labels []attribute.KeyValue) syncBoundInstrument {
|
||||
return newSyncBoundInstrument(s.instrument.Bind(labels))
|
||||
}
|
||||
|
||||
@@ -454,7 +454,7 @@ func (s syncInstrument) int64Measurement(value int64) Measurement {
|
||||
return newMeasurement(s.instrument, number.NewInt64Number(value))
|
||||
}
|
||||
|
||||
func (s syncInstrument) directRecord(ctx context.Context, number number.Number, labels []label.KeyValue) {
|
||||
func (s syncInstrument) directRecord(ctx context.Context, number number.Number, labels []attribute.KeyValue) {
|
||||
s.instrument.RecordOne(ctx, number, labels)
|
||||
}
|
||||
|
||||
@@ -577,14 +577,14 @@ type BoundInt64Counter struct {
|
||||
|
||||
// Bind creates a bound instrument for this counter. The labels are
|
||||
// associated with values recorded via subsequent calls to Record.
|
||||
func (c Float64Counter) Bind(labels ...label.KeyValue) (h BoundFloat64Counter) {
|
||||
func (c Float64Counter) Bind(labels ...attribute.KeyValue) (h BoundFloat64Counter) {
|
||||
h.syncBoundInstrument = c.bind(labels)
|
||||
return
|
||||
}
|
||||
|
||||
// Bind creates a bound instrument for this counter. The labels are
|
||||
// associated with values recorded via subsequent calls to Record.
|
||||
func (c Int64Counter) Bind(labels ...label.KeyValue) (h BoundInt64Counter) {
|
||||
func (c Int64Counter) Bind(labels ...attribute.KeyValue) (h BoundInt64Counter) {
|
||||
h.syncBoundInstrument = c.bind(labels)
|
||||
return
|
||||
}
|
||||
@@ -603,13 +603,13 @@ func (c Int64Counter) Measurement(value int64) Measurement {
|
||||
|
||||
// Add adds the value to the counter's sum. The labels should contain
|
||||
// the keys and values to be associated with this value.
|
||||
func (c Float64Counter) Add(ctx context.Context, value float64, labels ...label.KeyValue) {
|
||||
func (c Float64Counter) Add(ctx context.Context, value float64, labels ...attribute.KeyValue) {
|
||||
c.directRecord(ctx, number.NewFloat64Number(value), labels)
|
||||
}
|
||||
|
||||
// Add adds the value to the counter's sum. The labels should contain
|
||||
// the keys and values to be associated with this value.
|
||||
func (c Int64Counter) Add(ctx context.Context, value int64, labels ...label.KeyValue) {
|
||||
func (c Int64Counter) Add(ctx context.Context, value int64, labels ...attribute.KeyValue) {
|
||||
c.directRecord(ctx, number.NewInt64Number(value), labels)
|
||||
}
|
||||
|
||||
@@ -652,14 +652,14 @@ type BoundInt64UpDownCounter struct {
|
||||
|
||||
// Bind creates a bound instrument for this counter. The labels are
|
||||
// associated with values recorded via subsequent calls to Record.
|
||||
func (c Float64UpDownCounter) Bind(labels ...label.KeyValue) (h BoundFloat64UpDownCounter) {
|
||||
func (c Float64UpDownCounter) Bind(labels ...attribute.KeyValue) (h BoundFloat64UpDownCounter) {
|
||||
h.syncBoundInstrument = c.bind(labels)
|
||||
return
|
||||
}
|
||||
|
||||
// Bind creates a bound instrument for this counter. The labels are
|
||||
// associated with values recorded via subsequent calls to Record.
|
||||
func (c Int64UpDownCounter) Bind(labels ...label.KeyValue) (h BoundInt64UpDownCounter) {
|
||||
func (c Int64UpDownCounter) Bind(labels ...attribute.KeyValue) (h BoundInt64UpDownCounter) {
|
||||
h.syncBoundInstrument = c.bind(labels)
|
||||
return
|
||||
}
|
||||
@@ -678,13 +678,13 @@ func (c Int64UpDownCounter) Measurement(value int64) Measurement {
|
||||
|
||||
// Add adds the value to the counter's sum. The labels should contain
|
||||
// the keys and values to be associated with this value.
|
||||
func (c Float64UpDownCounter) Add(ctx context.Context, value float64, labels ...label.KeyValue) {
|
||||
func (c Float64UpDownCounter) Add(ctx context.Context, value float64, labels ...attribute.KeyValue) {
|
||||
c.directRecord(ctx, number.NewFloat64Number(value), labels)
|
||||
}
|
||||
|
||||
// Add adds the value to the counter's sum. The labels should contain
|
||||
// the keys and values to be associated with this value.
|
||||
func (c Int64UpDownCounter) Add(ctx context.Context, value int64, labels ...label.KeyValue) {
|
||||
func (c Int64UpDownCounter) Add(ctx context.Context, value int64, labels ...attribute.KeyValue) {
|
||||
c.directRecord(ctx, number.NewInt64Number(value), labels)
|
||||
}
|
||||
|
||||
@@ -726,14 +726,14 @@ type BoundInt64ValueRecorder struct {
|
||||
|
||||
// Bind creates a bound instrument for this ValueRecorder. The labels are
|
||||
// associated with values recorded via subsequent calls to Record.
|
||||
func (c Float64ValueRecorder) Bind(labels ...label.KeyValue) (h BoundFloat64ValueRecorder) {
|
||||
func (c Float64ValueRecorder) Bind(labels ...attribute.KeyValue) (h BoundFloat64ValueRecorder) {
|
||||
h.syncBoundInstrument = c.bind(labels)
|
||||
return
|
||||
}
|
||||
|
||||
// Bind creates a bound instrument for this ValueRecorder. The labels are
|
||||
// associated with values recorded via subsequent calls to Record.
|
||||
func (c Int64ValueRecorder) Bind(labels ...label.KeyValue) (h BoundInt64ValueRecorder) {
|
||||
func (c Int64ValueRecorder) Bind(labels ...attribute.KeyValue) (h BoundInt64ValueRecorder) {
|
||||
h.syncBoundInstrument = c.bind(labels)
|
||||
return
|
||||
}
|
||||
@@ -753,14 +753,14 @@ func (c Int64ValueRecorder) Measurement(value int64) Measurement {
|
||||
// Record adds a new value to the list of ValueRecorder's records. The
|
||||
// labels should contain the keys and values to be associated with
|
||||
// this value.
|
||||
func (c Float64ValueRecorder) Record(ctx context.Context, value float64, labels ...label.KeyValue) {
|
||||
func (c Float64ValueRecorder) Record(ctx context.Context, value float64, labels ...attribute.KeyValue) {
|
||||
c.directRecord(ctx, number.NewFloat64Number(value), labels)
|
||||
}
|
||||
|
||||
// Record adds a new value to the ValueRecorder's distribution. The
|
||||
// labels should contain the keys and values to be associated with
|
||||
// this value.
|
||||
func (c Int64ValueRecorder) Record(ctx context.Context, value int64, labels ...label.KeyValue) {
|
||||
func (c Int64ValueRecorder) Record(ctx context.Context, value int64, labels ...attribute.KeyValue) {
|
||||
c.directRecord(ctx, number.NewInt64Number(value), labels)
|
||||
}
|
||||
|
||||
|
6
vendor/go.opentelemetry.io/otel/metric/metric_noop.go
generated
vendored
6
vendor/go.opentelemetry.io/otel/metric/metric_noop.go
generated
vendored
@@ -17,7 +17,7 @@ package metric // import "go.opentelemetry.io/otel/metric"
|
||||
import (
|
||||
"context"
|
||||
|
||||
"go.opentelemetry.io/otel/label"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/metric/number"
|
||||
)
|
||||
|
||||
@@ -51,9 +51,9 @@ func (noopBoundInstrument) RecordOne(context.Context, number.Number) {
|
||||
func (noopBoundInstrument) Unbind() {
|
||||
}
|
||||
|
||||
func (NoopSync) Bind([]label.KeyValue) BoundSyncImpl {
|
||||
func (NoopSync) Bind([]attribute.KeyValue) BoundSyncImpl {
|
||||
return noopBoundInstrument{}
|
||||
}
|
||||
|
||||
func (NoopSync) RecordOne(context.Context, number.Number, []label.KeyValue) {
|
||||
func (NoopSync) RecordOne(context.Context, number.Number, []attribute.KeyValue) {
|
||||
}
|
||||
|
8
vendor/go.opentelemetry.io/otel/metric/metric_sdkapi.go
generated
vendored
8
vendor/go.opentelemetry.io/otel/metric/metric_sdkapi.go
generated
vendored
@@ -17,7 +17,7 @@ package metric // import "go.opentelemetry.io/otel/metric"
|
||||
import (
|
||||
"context"
|
||||
|
||||
"go.opentelemetry.io/otel/label"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/metric/number"
|
||||
)
|
||||
|
||||
@@ -25,7 +25,7 @@ import (
|
||||
// implementation.
|
||||
type MeterImpl interface {
|
||||
// RecordBatch atomically records a batch of measurements.
|
||||
RecordBatch(ctx context.Context, labels []label.KeyValue, measurement ...Measurement)
|
||||
RecordBatch(ctx context.Context, labels []attribute.KeyValue, measurement ...Measurement)
|
||||
|
||||
// NewSyncInstrument returns a newly constructed
|
||||
// synchronous instrument implementation or an error, should
|
||||
@@ -60,10 +60,10 @@ type SyncImpl interface {
|
||||
|
||||
// Bind creates an implementation-level bound instrument,
|
||||
// binding a label set with this instrument implementation.
|
||||
Bind(labels []label.KeyValue) BoundSyncImpl
|
||||
Bind(labels []attribute.KeyValue) BoundSyncImpl
|
||||
|
||||
// RecordOne captures a single synchronous metric event.
|
||||
RecordOne(ctx context.Context, number number.Number, labels []label.KeyValue)
|
||||
RecordOne(ctx context.Context, number number.Number, labels []attribute.KeyValue)
|
||||
}
|
||||
|
||||
// BoundSyncImpl is the implementation-level interface to a
|
||||
|
4
vendor/go.opentelemetry.io/otel/metric/registry/registry.go
generated
vendored
4
vendor/go.opentelemetry.io/otel/metric/registry/registry.go
generated
vendored
@@ -19,7 +19,7 @@ import (
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
"go.opentelemetry.io/otel/label"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/metric"
|
||||
)
|
||||
|
||||
@@ -75,7 +75,7 @@ func NewUniqueInstrumentMeterImpl(impl metric.MeterImpl) metric.MeterImpl {
|
||||
}
|
||||
|
||||
// RecordBatch implements metric.MeterImpl.
|
||||
func (u *uniqueInstrumentMeterImpl) RecordBatch(ctx context.Context, labels []label.KeyValue, ms ...metric.Measurement) {
|
||||
func (u *uniqueInstrumentMeterImpl) RecordBatch(ctx context.Context, labels []attribute.KeyValue, ms ...metric.Measurement) {
|
||||
u.impl.RecordBatch(ctx, labels, ms...)
|
||||
}
|
||||
|
||||
|
8
vendor/go.opentelemetry.io/otel/propagation/baggage.go
generated
vendored
8
vendor/go.opentelemetry.io/otel/propagation/baggage.go
generated
vendored
@@ -19,8 +19,8 @@ import (
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/internal/baggage"
|
||||
"go.opentelemetry.io/otel/label"
|
||||
)
|
||||
|
||||
const baggageHeader = "baggage"
|
||||
@@ -38,7 +38,7 @@ func (b Baggage) Inject(ctx context.Context, carrier TextMapCarrier) {
|
||||
baggageMap := baggage.MapFromContext(ctx)
|
||||
firstIter := true
|
||||
var headerValueBuilder strings.Builder
|
||||
baggageMap.Foreach(func(kv label.KeyValue) bool {
|
||||
baggageMap.Foreach(func(kv attribute.KeyValue) bool {
|
||||
if !firstIter {
|
||||
headerValueBuilder.WriteRune(',')
|
||||
}
|
||||
@@ -62,7 +62,7 @@ func (b Baggage) Extract(parent context.Context, carrier TextMapCarrier) context
|
||||
}
|
||||
|
||||
baggageValues := strings.Split(bVal, ",")
|
||||
keyValues := make([]label.KeyValue, 0, len(baggageValues))
|
||||
keyValues := make([]attribute.KeyValue, 0, len(baggageValues))
|
||||
for _, baggageValue := range baggageValues {
|
||||
valueAndProps := strings.Split(baggageValue, ";")
|
||||
if len(valueAndProps) < 1 {
|
||||
@@ -92,7 +92,7 @@ func (b Baggage) Extract(parent context.Context, carrier TextMapCarrier) context
|
||||
trimmedValueWithProps.WriteString(prop)
|
||||
}
|
||||
|
||||
keyValues = append(keyValues, label.String(trimmedName, trimmedValueWithProps.String()))
|
||||
keyValues = append(keyValues, attribute.String(trimmedName, trimmedValueWithProps.String()))
|
||||
}
|
||||
|
||||
if len(keyValues) > 0 {
|
||||
|
29
vendor/go.opentelemetry.io/otel/propagation/propagation.go
generated
vendored
29
vendor/go.opentelemetry.io/otel/propagation/propagation.go
generated
vendored
@@ -14,7 +14,10 @@
|
||||
|
||||
package propagation // import "go.opentelemetry.io/otel/propagation"
|
||||
|
||||
import "context"
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// TextMapCarrier is the storage medium used by a TextMapPropagator.
|
||||
type TextMapCarrier interface {
|
||||
@@ -22,6 +25,30 @@ type TextMapCarrier interface {
|
||||
Get(key string) string
|
||||
// Set stores the key-value pair.
|
||||
Set(key string, value string)
|
||||
// Keys lists the keys stored in this carrier.
|
||||
Keys() []string
|
||||
}
|
||||
|
||||
// HeaderCarrier adapts http.Header to satisfy the TextMapCarrier interface.
|
||||
type HeaderCarrier http.Header
|
||||
|
||||
// Get returns the value associated with the passed key.
|
||||
func (hc HeaderCarrier) Get(key string) string {
|
||||
return http.Header(hc).Get(key)
|
||||
}
|
||||
|
||||
// Set stores the key-value pair.
|
||||
func (hc HeaderCarrier) Set(key string, value string) {
|
||||
http.Header(hc).Set(key, value)
|
||||
}
|
||||
|
||||
// Keys lists the keys stored in this carrier.
|
||||
func (hc HeaderCarrier) Keys() []string {
|
||||
keys := make([]string, 0, len(hc))
|
||||
for k := range hc {
|
||||
keys = append(keys, k)
|
||||
}
|
||||
return keys
|
||||
}
|
||||
|
||||
// TextMapPropagator propagates cross-cutting concerns as key-value text
|
||||
|
26
vendor/go.opentelemetry.io/otel/propagation/trace_context.go
generated
vendored
26
vendor/go.opentelemetry.io/otel/propagation/trace_context.go
generated
vendored
@@ -21,7 +21,7 @@ import (
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"go.opentelemetry.io/otel/label"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
)
|
||||
|
||||
@@ -52,13 +52,13 @@ func (tc TraceContext) Inject(ctx context.Context, carrier TextMapCarrier) {
|
||||
return
|
||||
}
|
||||
|
||||
carrier.Set(tracestateHeader, sc.TraceState.String())
|
||||
carrier.Set(tracestateHeader, sc.TraceState().String())
|
||||
|
||||
h := fmt.Sprintf("%.2x-%s-%s-%.2x",
|
||||
supportedVersion,
|
||||
sc.TraceID,
|
||||
sc.SpanID,
|
||||
sc.TraceFlags&trace.FlagsSampled)
|
||||
sc.TraceID(),
|
||||
sc.SpanID(),
|
||||
sc.TraceFlags()&trace.FlagsSampled)
|
||||
carrier.Set(traceparentHeader, h)
|
||||
}
|
||||
|
||||
@@ -107,9 +107,9 @@ func (tc TraceContext) extract(carrier TextMapCarrier) trace.SpanContext {
|
||||
return trace.SpanContext{}
|
||||
}
|
||||
|
||||
var sc trace.SpanContext
|
||||
var scc trace.SpanContextConfig
|
||||
|
||||
sc.TraceID, err = trace.TraceIDFromHex(matches[2][:32])
|
||||
scc.TraceID, err = trace.TraceIDFromHex(matches[2][:32])
|
||||
if err != nil {
|
||||
return trace.SpanContext{}
|
||||
}
|
||||
@@ -117,7 +117,7 @@ func (tc TraceContext) extract(carrier TextMapCarrier) trace.SpanContext {
|
||||
if len(matches[3]) != 16 {
|
||||
return trace.SpanContext{}
|
||||
}
|
||||
sc.SpanID, err = trace.SpanIDFromHex(matches[3])
|
||||
scc.SpanID, err = trace.SpanIDFromHex(matches[3])
|
||||
if err != nil {
|
||||
return trace.SpanContext{}
|
||||
}
|
||||
@@ -130,10 +130,12 @@ func (tc TraceContext) extract(carrier TextMapCarrier) trace.SpanContext {
|
||||
return trace.SpanContext{}
|
||||
}
|
||||
// Clear all flags other than the trace-context supported sampling bit.
|
||||
sc.TraceFlags = opts[0] & trace.FlagsSampled
|
||||
scc.TraceFlags = opts[0] & trace.FlagsSampled
|
||||
|
||||
sc.TraceState = parseTraceState(carrier.Get(tracestateHeader))
|
||||
scc.TraceState = parseTraceState(carrier.Get(tracestateHeader))
|
||||
scc.Remote = true
|
||||
|
||||
sc := trace.NewSpanContext(scc)
|
||||
if !sc.IsValid() {
|
||||
return trace.SpanContext{}
|
||||
}
|
||||
@@ -151,14 +153,14 @@ func parseTraceState(in string) trace.TraceState {
|
||||
return trace.TraceState{}
|
||||
}
|
||||
|
||||
kvs := []label.KeyValue{}
|
||||
kvs := []attribute.KeyValue{}
|
||||
for _, entry := range strings.Split(in, ",") {
|
||||
parts := strings.SplitN(entry, "=", 2)
|
||||
if len(parts) != 2 {
|
||||
// Parse failure, abort!
|
||||
return trace.TraceState{}
|
||||
}
|
||||
kvs = append(kvs, label.String(parts[0], parts[1]))
|
||||
kvs = append(kvs, attribute.String(parts[0], parts[1]))
|
||||
}
|
||||
|
||||
// Ignoring error here as "failure to parse tracestate MUST NOT
|
||||
|
45
vendor/go.opentelemetry.io/otel/trace/config.go
generated
vendored
45
vendor/go.opentelemetry.io/otel/trace/config.go
generated
vendored
@@ -17,7 +17,7 @@ package trace
|
||||
import (
|
||||
"time"
|
||||
|
||||
"go.opentelemetry.io/otel/label"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
)
|
||||
|
||||
// TracerConfig is a group of options for a Tracer.
|
||||
@@ -39,18 +39,21 @@ func NewTracerConfig(options ...TracerOption) *TracerConfig {
|
||||
// TracerOption applies an option to a TracerConfig.
|
||||
type TracerOption interface {
|
||||
ApplyTracer(*TracerConfig)
|
||||
|
||||
// A private method to prevent users implementing the
|
||||
// interface and so future additions to it will not
|
||||
// violate compatibility.
|
||||
private()
|
||||
}
|
||||
|
||||
// SpanConfig is a group of options for a Span.
|
||||
type SpanConfig struct {
|
||||
// Attributes describe the associated qualities of a Span.
|
||||
Attributes []label.KeyValue
|
||||
Attributes []attribute.KeyValue
|
||||
// Timestamp is a time in a Span life-cycle.
|
||||
Timestamp time.Time
|
||||
// Links are the associations a Span has with other Spans.
|
||||
Links []Link
|
||||
// Record is the recording state of a Span.
|
||||
Record bool
|
||||
// NewRoot identifies a Span as the root Span for a new trace. This is
|
||||
// commonly used when an existing trace crosses trust boundaries and the
|
||||
// remote parent span context should be ignored for security.
|
||||
@@ -74,6 +77,11 @@ func NewSpanConfig(options ...SpanOption) *SpanConfig {
|
||||
// SpanOption applies an option to a SpanConfig.
|
||||
type SpanOption interface {
|
||||
ApplySpan(*SpanConfig)
|
||||
|
||||
// A private method to prevent users implementing the
|
||||
// interface and so future additions to it will not
|
||||
// violate compatibility.
|
||||
private()
|
||||
}
|
||||
|
||||
// NewEventConfig applies all the EventOptions to a returned SpanConfig. If no
|
||||
@@ -94,6 +102,11 @@ func NewEventConfig(options ...EventOption) *SpanConfig {
|
||||
// EventOption applies span event options to a SpanConfig.
|
||||
type EventOption interface {
|
||||
ApplyEvent(*SpanConfig)
|
||||
|
||||
// A private method to prevent users implementing the
|
||||
// interface and so future additions to it will not
|
||||
// violate compatibility.
|
||||
private()
|
||||
}
|
||||
|
||||
// LifeCycleOption applies span life-cycle options to a SpanConfig. These
|
||||
@@ -104,12 +117,13 @@ type LifeCycleOption interface {
|
||||
EventOption
|
||||
}
|
||||
|
||||
type attributeSpanOption []label.KeyValue
|
||||
type attributeSpanOption []attribute.KeyValue
|
||||
|
||||
func (o attributeSpanOption) ApplySpan(c *SpanConfig) { o.apply(c) }
|
||||
func (o attributeSpanOption) ApplyEvent(c *SpanConfig) { o.apply(c) }
|
||||
func (attributeSpanOption) private() {}
|
||||
func (o attributeSpanOption) apply(c *SpanConfig) {
|
||||
c.Attributes = append(c.Attributes, []label.KeyValue(o)...)
|
||||
c.Attributes = append(c.Attributes, []attribute.KeyValue(o)...)
|
||||
}
|
||||
|
||||
// WithAttributes adds the attributes related to a span life-cycle event.
|
||||
@@ -121,7 +135,7 @@ func (o attributeSpanOption) apply(c *SpanConfig) {
|
||||
// If multiple of these options are passed the attributes of each successive
|
||||
// option will extend the attributes instead of overwriting. There is no
|
||||
// guarantee of uniqueness in the resulting attributes.
|
||||
func WithAttributes(attributes ...label.KeyValue) LifeCycleOption {
|
||||
func WithAttributes(attributes ...attribute.KeyValue) LifeCycleOption {
|
||||
return attributeSpanOption(attributes)
|
||||
}
|
||||
|
||||
@@ -129,6 +143,7 @@ type timestampSpanOption time.Time
|
||||
|
||||
func (o timestampSpanOption) ApplySpan(c *SpanConfig) { o.apply(c) }
|
||||
func (o timestampSpanOption) ApplyEvent(c *SpanConfig) { o.apply(c) }
|
||||
func (timestampSpanOption) private() {}
|
||||
func (o timestampSpanOption) apply(c *SpanConfig) { c.Timestamp = time.Time(o) }
|
||||
|
||||
// WithTimestamp sets the time of a Span life-cycle moment (e.g. started,
|
||||
@@ -140,6 +155,7 @@ func WithTimestamp(t time.Time) LifeCycleOption {
|
||||
type linksSpanOption []Link
|
||||
|
||||
func (o linksSpanOption) ApplySpan(c *SpanConfig) { c.Links = append(c.Links, []Link(o)...) }
|
||||
func (linksSpanOption) private() {}
|
||||
|
||||
// WithLinks adds links to a Span. The links are added to the existing Span
|
||||
// links, i.e. this does not overwrite.
|
||||
@@ -147,20 +163,10 @@ func WithLinks(links ...Link) SpanOption {
|
||||
return linksSpanOption(links)
|
||||
}
|
||||
|
||||
type recordSpanOption bool
|
||||
|
||||
func (o recordSpanOption) ApplySpan(c *SpanConfig) { c.Record = bool(o) }
|
||||
|
||||
// WithRecord specifies that the span should be recorded. It is important to
|
||||
// note that implementations may override this option, i.e. if the span is a
|
||||
// child of an un-sampled trace.
|
||||
func WithRecord() SpanOption {
|
||||
return recordSpanOption(true)
|
||||
}
|
||||
|
||||
type newRootSpanOption bool
|
||||
|
||||
func (o newRootSpanOption) ApplySpan(c *SpanConfig) { c.NewRoot = bool(o) }
|
||||
func (newRootSpanOption) private() {}
|
||||
|
||||
// WithNewRoot specifies that the Span should be treated as a root Span. Any
|
||||
// existing parent span context will be ignored when defining the Span's trace
|
||||
@@ -172,6 +178,7 @@ func WithNewRoot() SpanOption {
|
||||
type spanKindSpanOption SpanKind
|
||||
|
||||
func (o spanKindSpanOption) ApplySpan(c *SpanConfig) { c.SpanKind = SpanKind(o) }
|
||||
func (o spanKindSpanOption) private() {}
|
||||
|
||||
// WithSpanKind sets the SpanKind of a Span.
|
||||
func WithSpanKind(kind SpanKind) SpanOption {
|
||||
@@ -194,3 +201,5 @@ type instrumentationVersionOption string
|
||||
func (i instrumentationVersionOption) ApplyTracer(config *TracerConfig) {
|
||||
config.InstrumentationVersion = string(i)
|
||||
}
|
||||
|
||||
func (instrumentationVersionOption) private() {}
|
||||
|
3
vendor/go.opentelemetry.io/otel/trace/go.mod
generated
vendored
3
vendor/go.opentelemetry.io/otel/trace/go.mod
generated
vendored
@@ -47,6 +47,7 @@ replace go.opentelemetry.io/otel/sdk/metric => ../sdk/metric
|
||||
replace go.opentelemetry.io/otel/trace => ./
|
||||
|
||||
require (
|
||||
github.com/google/go-cmp v0.5.5
|
||||
github.com/stretchr/testify v1.7.0
|
||||
go.opentelemetry.io/otel v0.17.0
|
||||
go.opentelemetry.io/otel v0.19.0
|
||||
)
|
||||
|
4
vendor/go.opentelemetry.io/otel/trace/go.sum
generated
vendored
4
vendor/go.opentelemetry.io/otel/trace/go.sum
generated
vendored
@@ -1,7 +1,7 @@
|
||||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M=
|
||||
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
|
@@ -17,8 +17,8 @@ package trace // import "go.opentelemetry.io/otel/trace"
|
||||
import (
|
||||
"context"
|
||||
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/codes"
|
||||
"go.opentelemetry.io/otel/label"
|
||||
)
|
||||
|
||||
// NewNoopTracerProvider returns an implementation of TracerProvider that
|
||||
@@ -66,7 +66,7 @@ func (noopSpan) SetStatus(codes.Code, string) {}
|
||||
func (noopSpan) SetError(bool) {}
|
||||
|
||||
// SetAttributes does nothing.
|
||||
func (noopSpan) SetAttributes(...label.KeyValue) {}
|
||||
func (noopSpan) SetAttributes(...attribute.KeyValue) {}
|
||||
|
||||
// End does nothing.
|
||||
func (noopSpan) End(...SpanOption) {}
|
183
vendor/go.opentelemetry.io/otel/trace/trace.go
generated
vendored
183
vendor/go.opentelemetry.io/otel/trace/trace.go
generated
vendored
@@ -23,8 +23,8 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/codes"
|
||||
"go.opentelemetry.io/otel/label"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -48,7 +48,7 @@ const (
|
||||
|
||||
// based on the W3C Trace Context specification, see https://www.w3.org/TR/trace-context-1/#tracestate-header
|
||||
traceStateKeyFormat = `[a-z][_0-9a-z\-\*\/]{0,255}`
|
||||
traceStateKeyFormatWithMultiTenantVendor = `[a-z][_0-9a-z\-\*\/]{0,240}@[a-z][_0-9a-z\-\*\/]{0,13}`
|
||||
traceStateKeyFormatWithMultiTenantVendor = `[a-z0-9][_0-9a-z\-\*\/]{0,240}@[a-z][_0-9a-z\-\*\/]{0,13}`
|
||||
traceStateValueFormat = `[\x20-\x2b\x2d-\x3c\x3e-\x7e]{0,255}[\x21-\x2b\x2d-\x3c\x3e-\x7e]`
|
||||
|
||||
traceStateMaxListMembers = 32
|
||||
@@ -183,12 +183,14 @@ func decodeHex(h string, b []byte) error {
|
||||
// Trace state must be valid according to the W3C Trace Context specification at all times. All
|
||||
// mutating operations validate their input and, in case of valid parameters, return a new TraceState.
|
||||
type TraceState struct { //nolint:golint
|
||||
// TODO @matej-g: Consider implementing this as label.Set, see
|
||||
// TODO @matej-g: Consider implementing this as attribute.Set, see
|
||||
// comment https://github.com/open-telemetry/opentelemetry-go/pull/1340#discussion_r540599226
|
||||
kvs []label.KeyValue
|
||||
kvs []attribute.KeyValue
|
||||
}
|
||||
|
||||
var _ json.Marshaler = TraceState{}
|
||||
var _ json.Marshaler = SpanContext{}
|
||||
|
||||
var keyFormatRegExp = regexp.MustCompile(
|
||||
`^((` + traceStateKeyFormat + `)|(` + traceStateKeyFormatWithMultiTenantVendor + `))$`,
|
||||
)
|
||||
@@ -219,9 +221,9 @@ func (ts TraceState) String() string {
|
||||
|
||||
// Get returns a value for given key from the trace state.
|
||||
// If no key is found or provided key is invalid, returns an empty value.
|
||||
func (ts TraceState) Get(key label.Key) label.Value {
|
||||
func (ts TraceState) Get(key attribute.Key) attribute.Value {
|
||||
if !isTraceStateKeyValid(key) {
|
||||
return label.Value{}
|
||||
return attribute.Value{}
|
||||
}
|
||||
|
||||
for _, kv := range ts.kvs {
|
||||
@@ -230,13 +232,13 @@ func (ts TraceState) Get(key label.Key) label.Value {
|
||||
}
|
||||
}
|
||||
|
||||
return label.Value{}
|
||||
return attribute.Value{}
|
||||
}
|
||||
|
||||
// Insert adds a new key/value, if one doesn't exists; otherwise updates the existing entry.
|
||||
// The new or updated entry is always inserted at the beginning of the TraceState, i.e.
|
||||
// on the left side, as per the W3C Trace Context specification requirement.
|
||||
func (ts TraceState) Insert(entry label.KeyValue) (TraceState, error) {
|
||||
func (ts TraceState) Insert(entry attribute.KeyValue) (TraceState, error) {
|
||||
if !isTraceStateKeyValueValid(entry) {
|
||||
return ts, errInvalidTraceStateKeyValue
|
||||
}
|
||||
@@ -246,7 +248,7 @@ func (ts TraceState) Insert(entry label.KeyValue) (TraceState, error) {
|
||||
return ts, errInvalidTraceStateMembersNumber
|
||||
}
|
||||
|
||||
ckvs = append(ckvs, label.KeyValue{})
|
||||
ckvs = append(ckvs, attribute.KeyValue{})
|
||||
copy(ckvs[1:], ckvs)
|
||||
ckvs[0] = entry
|
||||
|
||||
@@ -254,7 +256,7 @@ func (ts TraceState) Insert(entry label.KeyValue) (TraceState, error) {
|
||||
}
|
||||
|
||||
// Delete removes specified entry from the trace state.
|
||||
func (ts TraceState) Delete(key label.Key) (TraceState, error) {
|
||||
func (ts TraceState) Delete(key attribute.Key) (TraceState, error) {
|
||||
if !isTraceStateKeyValid(key) {
|
||||
return ts, errInvalidTraceStateKeyValue
|
||||
}
|
||||
@@ -267,8 +269,8 @@ func (ts TraceState) IsEmpty() bool {
|
||||
return len(ts.kvs) == 0
|
||||
}
|
||||
|
||||
func (ts TraceState) copyKVsAndDeleteEntry(key label.Key) []label.KeyValue {
|
||||
ckvs := make([]label.KeyValue, len(ts.kvs))
|
||||
func (ts TraceState) copyKVsAndDeleteEntry(key attribute.Key) []attribute.KeyValue {
|
||||
ckvs := make([]attribute.KeyValue, len(ts.kvs))
|
||||
copy(ckvs, ts.kvs)
|
||||
for i, kv := range ts.kvs {
|
||||
if kv.Key == key {
|
||||
@@ -282,7 +284,7 @@ func (ts TraceState) copyKVsAndDeleteEntry(key label.Key) []label.KeyValue {
|
||||
|
||||
// TraceStateFromKeyValues is a convenience method to create a new TraceState from
|
||||
// provided key/value pairs.
|
||||
func TraceStateFromKeyValues(kvs ...label.KeyValue) (TraceState, error) { //nolint:golint
|
||||
func TraceStateFromKeyValues(kvs ...attribute.KeyValue) (TraceState, error) { //nolint:golint
|
||||
if len(kvs) == 0 {
|
||||
return TraceState{}, nil
|
||||
}
|
||||
@@ -291,7 +293,7 @@ func TraceStateFromKeyValues(kvs ...label.KeyValue) (TraceState, error) { //noli
|
||||
return TraceState{}, errInvalidTraceStateMembersNumber
|
||||
}
|
||||
|
||||
km := make(map[label.Key]bool)
|
||||
km := make(map[attribute.Key]bool)
|
||||
for _, kv := range kvs {
|
||||
if !isTraceStateKeyValueValid(kv) {
|
||||
return TraceState{}, errInvalidTraceStateKeyValue
|
||||
@@ -303,26 +305,49 @@ func TraceStateFromKeyValues(kvs ...label.KeyValue) (TraceState, error) { //noli
|
||||
km[kv.Key] = true
|
||||
}
|
||||
|
||||
ckvs := make([]label.KeyValue, len(kvs))
|
||||
ckvs := make([]attribute.KeyValue, len(kvs))
|
||||
copy(ckvs, kvs)
|
||||
return TraceState{ckvs}, nil
|
||||
}
|
||||
|
||||
func isTraceStateKeyValid(key label.Key) bool {
|
||||
func isTraceStateKeyValid(key attribute.Key) bool {
|
||||
return keyFormatRegExp.MatchString(string(key))
|
||||
}
|
||||
|
||||
func isTraceStateKeyValueValid(kv label.KeyValue) bool {
|
||||
func isTraceStateKeyValueValid(kv attribute.KeyValue) bool {
|
||||
return isTraceStateKeyValid(kv.Key) &&
|
||||
valueFormatRegExp.MatchString(kv.Value.Emit())
|
||||
}
|
||||
|
||||
// SpanContext contains identifying trace information about a Span.
|
||||
type SpanContext struct {
|
||||
// SpanContextConfig contains mutable fields usable for constructing
|
||||
// an immutable SpanContext.
|
||||
type SpanContextConfig struct {
|
||||
TraceID TraceID
|
||||
SpanID SpanID
|
||||
TraceFlags byte
|
||||
TraceState TraceState
|
||||
Remote bool
|
||||
}
|
||||
|
||||
// NewSpanContext constructs a SpanContext using values from the provided
|
||||
// SpanContextConfig.
|
||||
func NewSpanContext(config SpanContextConfig) SpanContext {
|
||||
return SpanContext{
|
||||
traceID: config.TraceID,
|
||||
spanID: config.SpanID,
|
||||
traceFlags: config.TraceFlags,
|
||||
traceState: config.TraceState,
|
||||
remote: config.Remote,
|
||||
}
|
||||
}
|
||||
|
||||
// SpanContext contains identifying trace information about a Span.
|
||||
type SpanContext struct {
|
||||
traceID TraceID
|
||||
spanID SpanID
|
||||
traceFlags byte
|
||||
traceState TraceState
|
||||
remote bool
|
||||
}
|
||||
|
||||
// IsValid returns if the SpanContext is valid. A valid span context has a
|
||||
@@ -331,29 +356,129 @@ func (sc SpanContext) IsValid() bool {
|
||||
return sc.HasTraceID() && sc.HasSpanID()
|
||||
}
|
||||
|
||||
// IsRemote indicates whether the SpanContext represents a remotely-created Span.
|
||||
func (sc SpanContext) IsRemote() bool {
|
||||
return sc.remote
|
||||
}
|
||||
|
||||
// WithRemote returns a copy of sc with the Remote property set to remote.
|
||||
func (sc SpanContext) WithRemote(remote bool) SpanContext {
|
||||
return SpanContext{
|
||||
traceID: sc.traceID,
|
||||
spanID: sc.spanID,
|
||||
traceFlags: sc.traceFlags,
|
||||
traceState: sc.traceState,
|
||||
remote: remote,
|
||||
}
|
||||
}
|
||||
|
||||
// TraceID returns the TraceID from the SpanContext.
|
||||
func (sc SpanContext) TraceID() TraceID {
|
||||
return sc.traceID
|
||||
}
|
||||
|
||||
// HasTraceID checks if the SpanContext has a valid TraceID.
|
||||
func (sc SpanContext) HasTraceID() bool {
|
||||
return sc.TraceID.IsValid()
|
||||
return sc.traceID.IsValid()
|
||||
}
|
||||
|
||||
// WithTraceID returns a new SpanContext with the TraceID replaced.
|
||||
func (sc SpanContext) WithTraceID(traceID TraceID) SpanContext {
|
||||
return SpanContext{
|
||||
traceID: traceID,
|
||||
spanID: sc.spanID,
|
||||
traceFlags: sc.traceFlags,
|
||||
traceState: sc.traceState,
|
||||
remote: sc.remote,
|
||||
}
|
||||
}
|
||||
|
||||
// SpanID returns the SpanID from the SpanContext.
|
||||
func (sc SpanContext) SpanID() SpanID {
|
||||
return sc.spanID
|
||||
}
|
||||
|
||||
// HasSpanID checks if the SpanContext has a valid SpanID.
|
||||
func (sc SpanContext) HasSpanID() bool {
|
||||
return sc.SpanID.IsValid()
|
||||
return sc.spanID.IsValid()
|
||||
}
|
||||
|
||||
// WithSpanID returns a new SpanContext with the SpanID replaced.
|
||||
func (sc SpanContext) WithSpanID(spanID SpanID) SpanContext {
|
||||
return SpanContext{
|
||||
traceID: sc.traceID,
|
||||
spanID: spanID,
|
||||
traceFlags: sc.traceFlags,
|
||||
traceState: sc.traceState,
|
||||
remote: sc.remote,
|
||||
}
|
||||
}
|
||||
|
||||
// TraceFlags returns the flags from the SpanContext.
|
||||
func (sc SpanContext) TraceFlags() byte {
|
||||
return sc.traceFlags
|
||||
}
|
||||
|
||||
// WithTraceFlags returns a new SpanContext with the TraceFlags replaced.
|
||||
func (sc SpanContext) WithTraceFlags(flags byte) SpanContext {
|
||||
return SpanContext{
|
||||
traceID: sc.traceID,
|
||||
spanID: sc.spanID,
|
||||
traceFlags: flags,
|
||||
traceState: sc.traceState,
|
||||
remote: sc.remote,
|
||||
}
|
||||
}
|
||||
|
||||
// IsDeferred returns if the deferred bit is set in the trace flags.
|
||||
func (sc SpanContext) IsDeferred() bool {
|
||||
return sc.TraceFlags&FlagsDeferred == FlagsDeferred
|
||||
return sc.traceFlags&FlagsDeferred == FlagsDeferred
|
||||
}
|
||||
|
||||
// IsDebug returns if the debug bit is set in the trace flags.
|
||||
func (sc SpanContext) IsDebug() bool {
|
||||
return sc.TraceFlags&FlagsDebug == FlagsDebug
|
||||
return sc.traceFlags&FlagsDebug == FlagsDebug
|
||||
}
|
||||
|
||||
// IsSampled returns if the sampling bit is set in the trace flags.
|
||||
func (sc SpanContext) IsSampled() bool {
|
||||
return sc.TraceFlags&FlagsSampled == FlagsSampled
|
||||
return sc.traceFlags&FlagsSampled == FlagsSampled
|
||||
}
|
||||
|
||||
// TraceState returns the TraceState from the SpanContext.
|
||||
func (sc SpanContext) TraceState() TraceState {
|
||||
return sc.traceState
|
||||
}
|
||||
|
||||
// WithTraceState returns a new SpanContext with the TraceState replaced.
|
||||
func (sc SpanContext) WithTraceState(state TraceState) SpanContext {
|
||||
return SpanContext{
|
||||
traceID: sc.traceID,
|
||||
spanID: sc.spanID,
|
||||
traceFlags: sc.traceFlags,
|
||||
traceState: state,
|
||||
remote: sc.remote,
|
||||
}
|
||||
}
|
||||
|
||||
// Equal is a predicate that determines whether two SpanContext values are equal.
|
||||
func (sc SpanContext) Equal(other SpanContext) bool {
|
||||
return sc.traceID == other.traceID &&
|
||||
sc.spanID == other.spanID &&
|
||||
sc.traceFlags == other.traceFlags &&
|
||||
sc.traceState.String() == other.traceState.String() &&
|
||||
sc.remote == other.remote
|
||||
}
|
||||
|
||||
// MarshalJSON implements a custom marshal function to encode a SpanContext.
|
||||
func (sc SpanContext) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(SpanContextConfig{
|
||||
TraceID: sc.traceID,
|
||||
SpanID: sc.spanID,
|
||||
TraceFlags: sc.traceFlags,
|
||||
TraceState: sc.traceState,
|
||||
Remote: sc.remote,
|
||||
})
|
||||
}
|
||||
|
||||
type traceContextKeyType int
|
||||
@@ -387,7 +512,7 @@ func SpanContextFromContext(ctx context.Context) SpanContext {
|
||||
// ContextWithRemoteSpanContext returns a copy of parent with a remote set as
|
||||
// the remote span context.
|
||||
func ContextWithRemoteSpanContext(parent context.Context, remote SpanContext) context.Context {
|
||||
return context.WithValue(parent, remoteContextKey, remote)
|
||||
return context.WithValue(parent, remoteContextKey, remote.WithRemote(true))
|
||||
}
|
||||
|
||||
// RemoteSpanContextFromContext returns the remote span context from ctx.
|
||||
@@ -438,7 +563,7 @@ type Span interface {
|
||||
// SetAttributes sets kv as attributes of the Span. If a key from kv
|
||||
// already exists for an attribute of the Span it will be overwritten with
|
||||
// the value contained in kv.
|
||||
SetAttributes(kv ...label.KeyValue)
|
||||
SetAttributes(kv ...attribute.KeyValue)
|
||||
}
|
||||
|
||||
// Event is a thing that happened during a Span's lifetime.
|
||||
@@ -447,7 +572,7 @@ type Event struct {
|
||||
Name string
|
||||
|
||||
// Attributes describe the aspects of the event.
|
||||
Attributes []label.KeyValue
|
||||
Attributes []attribute.KeyValue
|
||||
|
||||
// Time at which this event was recorded.
|
||||
Time time.Time
|
||||
@@ -470,7 +595,7 @@ type Event struct {
|
||||
// track the relationship.
|
||||
type Link struct {
|
||||
SpanContext
|
||||
Attributes []label.KeyValue
|
||||
Attributes []attribute.KeyValue
|
||||
}
|
||||
|
||||
// SpanKind is the role a Span plays in a Trace.
|
||||
@@ -558,5 +683,7 @@ type TracerProvider interface {
|
||||
// only if that code provides built-in instrumentation. If the
|
||||
// instrumentationName is empty, then a implementation defined default
|
||||
// name will be used instead.
|
||||
//
|
||||
// This method must be concurrency safe.
|
||||
Tracer(instrumentationName string, opts ...TracerOption) Tracer
|
||||
}
|
||||
|
2
vendor/go.opentelemetry.io/otel/version.go
generated
vendored
2
vendor/go.opentelemetry.io/otel/version.go
generated
vendored
@@ -16,5 +16,5 @@ package otel // import "go.opentelemetry.io/otel"
|
||||
|
||||
// Version is the current release version of OpenTelemetry in use.
|
||||
func Version() string {
|
||||
return "0.17.0"
|
||||
return "0.19.0"
|
||||
}
|
||||
|
Reference in New Issue
Block a user