* Add WithScopeAttributes TracerOption to trace API
* Add Attributes field to instrumentation Scope
* Use scope attributes for new Tracer
* Fix stdouttrace expected test output
* Allow unexported Set fields in sdk/trace test
* Export instrumentation scope attrs in OTLP
* Add changes to the changelog
* Fix imports with make lint
* Add unit tests for WithScopeAttributes
* Fix English in Scope documentation
* Deprecate Library and move all uses to Scope
* Add PR number to changelog
* Don't change signatures in stable modules
* Revert some changes
* Rename internal struct names
* A bit more renaming
* Update sdk/trace/span.go
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Update based on feedback
* Revert change
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
Comment should be complete sentences outside of lists with sentence
fragments. This adds the godot linter to check these complete sentences
end with punctuation. If they do not, running fix will append a period.
* No wrap RELEASING Semantic Convention Generation section
* Initial generator
* Update template render
* Add exception and schema templates
* Add semconv/internal http unification
* Add http template
* Add licenses header
* Embed the templates
* Update static version in schema tmpl
* Add semconv-generate target to Makefile
Use this target to generate versions of the semconv packages.
* Generate semconv packages
* Update RELEASING to use make semconv-generate
* Add comments to semconvkit
* Generate semconv/v1.8.0
* Use new version of semconv
* Add changes to changelog
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
* Allow setting the Sampler via environment variables (#2305)
* Add changelog entry.
* Replace t.Setenv with internaltest/SetEnvVariables for Go <= 1.6.
* Handle the lack of a sampler argument without logging errors.
* Add additional test cases and error checks.
* Refactor documentation.
Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
* emitBatchOverhead should only be used for splitting spans into batches (#2512)
* emitBatchOverhead should only be used for splitting spans into batches (#2503)
* limit max packet size parameter
* Add additional errors types, simplify abstractions and error handling
* Make error comparisons less fragile.
* Fix typo in jaeger example (#2524)
* Fix some typos in docs for Go libraries (#2520)
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Fix getting-started.md Run function (#2527)
* Fix getting-started.md Run function, it assigns this new context to a variable shared between connections in to accept loop. Thus creating a growing chain of contexts. so every calculate fibonacci request, all spans in a trace.
* add a comment explaining the reason for that new variable
* update example fib
* Bump github.com/google/go-cmp from 0.5.6 to 0.5.7 across the project (#2545)
* update go-cmp to 0.5.7
* fixes go.sums
Co-authored-by: Aaron Clawson <MadVikingGod@users.noreply.github.com>
* Un-escape url coding when parsing baggage. (#2529)
* un-escape url coding when parsing baggage.
* Added changelog
Co-authored-by: Aaron Clawson <MadVikingGod@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Bump go.opentelemetry.io/proto/otlp from 0.11.0 to 0.12.0 (#2546)
* Update go.opentelemetry.io/proto/otlp to v0.12.0
* Changelog
* Update CHANGELOG.md
Fix's md linting
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Aaron Clawson <MadVikingGod@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Remove unused sdk/internal/santize (#2549)
* Add links to code examples and docs (#2551)
* Bump github.com/prometheus/client_golang from 1.11.0 to 1.12.0 in /exporters/prometheus (#2541)
* Bump github.com/prometheus/client_golang in /exporters/prometheus
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.11.0 to 1.12.0.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.11.0...v1.12.0)
---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* go mod tidy
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tyler Yahn <codingalias@gmail.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Optimize evictedQueue implementation and use (#2556)
* Optimize evictedQueue impl and use
Avoid unnecessary allocations in the recordingSpan by using an
evictedQueue type instead of a pointer to one.
Lazy allocate the evictedQueue queue to prevent unnecessary operations
for spans without any use of the queue.
Document the evictedQueue
* Fix grammar
* Add env support for batch span processor (#2515)
* Add env support for batch span processor
* Update changelog
* lint
* Bump golang.org/x/tools from 0.1.8 to 0.1.9 in /internal/tools (#2566)
* Bump golang.org/x/tools from 0.1.8 to 0.1.9 in /internal/tools
Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.1.8 to 0.1.9.
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](https://github.com/golang/tools/compare/v0.1.8...v0.1.9)
---
updated-dependencies:
- dependency-name: golang.org/x/tools
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
* Auto-fix go.sum changes in dependent modules
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: MrAlias <MrAlias@users.noreply.github.com>
* Bump github.com/golangci/golangci-lint from 1.43.0 to 1.44.0 in /internal/tools (#2567)
* Bump github.com/golangci/golangci-lint in /internal/tools
Bumps [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) from 1.43.0 to 1.44.0.
- [Release notes](https://github.com/golangci/golangci-lint/releases)
- [Changelog](https://github.com/golangci/golangci-lint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/golangci/golangci-lint/compare/v1.43.0...v1.44.0)
---
updated-dependencies:
- dependency-name: github.com/golangci/golangci-lint
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Auto-fix go.sum changes in dependent modules
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: MrAlias <MrAlias@users.noreply.github.com>
* Bump github.com/prometheus/client_golang from 1.12.0 to 1.12.1 in /exporters/prometheus (#2570)
* Bump github.com/prometheus/client_golang in /exporters/prometheus
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.12.0 to 1.12.1.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.12.0...v1.12.1)
---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
* Auto-fix go.sum changes in dependent modules
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: MrAlias <MrAlias@users.noreply.github.com>
* Fix TestBackoffRetry in otlp/internal/retry package (#2562)
* Fix TestBackoffRetry in otlp retry pkg
The delay of the retry is within two times a randomization factor (the
back-off time is delay * random number within [1 - factor, 1 + factor].
This means the waitFunc in TestBackoffRetry needs to check the delay is
within an appropriate delta, not equal to configure initial delay.
* Fix delta value
* Fix delta
Co-authored-by: Aaron Clawson <Aaron.Clawson@gmail.com>
* Bump google.golang.org/grpc from 1.43.0 to 1.44.0 in /exporters/otlp/otlptrace (#2568)
* Bump google.golang.org/grpc in /exporters/otlp/otlptrace
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.43.0 to 1.44.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.43.0...v1.44.0)
---
updated-dependencies:
- dependency-name: google.golang.org/grpc
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Auto-fix go.sum changes in dependent modules
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: MrAlias <MrAlias@users.noreply.github.com>
* Bump google.golang.org/grpc from 1.43.0 to 1.44.0 in /example/otel-collector (#2565)
* Bump google.golang.org/grpc in /example/otel-collector
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.43.0 to 1.44.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.43.0...v1.44.0)
---
updated-dependencies:
- dependency-name: google.golang.org/grpc
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Auto-fix go.sum changes in dependent modules
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: MrAlias <MrAlias@users.noreply.github.com>
* Bump google.golang.org/grpc from 1.43.0 to 1.44.0 in /exporters/otlp/otlpmetric (#2572)
* Bump google.golang.org/grpc in /exporters/otlp/otlpmetric
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.43.0 to 1.44.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.43.0...v1.44.0)
---
updated-dependencies:
- dependency-name: google.golang.org/grpc
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Auto-fix go.sum changes in dependent modules
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: MrAlias <MrAlias@users.noreply.github.com>
* Change Options to accept type not pointer (#2558)
* Change trace options to accept type not pointer
Add benchmark to show allocation improvement.
* Update CONTRIBUTING.md guidelines
* Update all Option iface
* Fix grammar in CONTRIBUTING
* Do not store TracerProvider or Tracer fields in SDK recordingSpan (#2575)
* Do not store TracerProvider fields in span
Instead of keeping a reference to the span's Tracer, and therefore also
it's TracerProvider, and the associated resource and spanLimits just
keep the reference to the Tracer. Refer to the TracerProvider fields
when needed instead.
* Make span refer to the inst lib via the Tracer
Instead of holding a field in the span, refer to the field in the parent
Tracer.
* [website_docs] fix page meta-links (#2580)
Contributes to https://github.com/open-telemetry/opentelemetry.io/issues/1096
/cc @cartermp @austinlparker
* Validate members once, in `NewMember` (#2522)
* use NewMember, or specify if the member is not validated when creating new ones
* expect members to already be validated when creating a new package
* add changelog entry
* add an isEmpty field to member and property for quick validation
* rename isEmpty to hasData
So by default, an empty struct really is marked as having no data
* Update baggage/baggage_test.go
Co-authored-by: Aaron Clawson <Aaron.Clawson@gmail.com>
* don't validate the member in parseMember, we alredy ran that validation
We also don't want to use NewMember, as that runs the property
validation again, making the benchmark quite slower
* move changelog entry to the fixed section
* provide the member/property data when returning an invalid error
Co-authored-by: Aaron Clawson <Aaron.Clawson@gmail.com>
* Fix link to Zipkin exporter (#2581)
Currently it is linked to the old package that was moved.
* Unexport EnvBatchSpanProcessor* constants (#2583)
* Move BSP env support to internal
* Use pkg name
* Update env test
* Use internal/env in sdk/trace
* Avoid an extra allocation in applyTracerProviderEnvConfigs.
* Add additional errors for ratio > 1.0.
* Add test cases for ratio > 1.0.
* Update CHANGELOG.md
Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
Co-authored-by: jaychung <ken8203@gmail.com>
Co-authored-by: Ben Wells <b.v.wells@gmail.com>
Co-authored-by: Jeremy Kaplan <jeremy@stytch.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: thinkgo <49174849+thinkgos@users.noreply.github.com>
Co-authored-by: Aaron Clawson <Aaron.Clawson@gmail.com>
Co-authored-by: Aaron Clawson <MadVikingGod@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tyler Yahn <codingalias@gmail.com>
Co-authored-by: Chao Weng <19381524+sincejune@users.noreply.github.com>
Co-authored-by: Patrice Chalin <chalin@users.noreply.github.com>
Co-authored-by: Damien Mathieu <42@dmathieu.com>
* Fix race condition in reading the dropped spans number
As any race condition this should be consider an undefined behavior, and a patch release should be done.
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
* Update CHANGELOG.md
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Replace recordingSpan attributes implementation
Instead of an LRU strategy for cap-ing span attributes, comply with the
specification and drop last added. To do this, the attributesmap is
replaced with a slice of attributes.
* Remove attributesmap files
* Refine addition algorithm
Unify duplicated code.
Fix deduplication algorithm.
Fix droppedAttributes to always be returned, even if the span has no
attributes.
* Unify span SetAttributes tests
* Doc fix to attr drop order in changelog
* Test span and snapshot attrs
* fix lint
* Add tests for recordingSpan method defaults
* Comment why pre-allocation is not done
* Correct grammar in recordingSpan allocation comment
* Update sdk/trace/tracer.go
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
* Do not store TracerProvider fields in span
Instead of keeping a reference to the span's Tracer, and therefore also
it's TracerProvider, and the associated resource and spanLimits just
keep the reference to the Tracer. Refer to the TracerProvider fields
when needed instead.
* Make span refer to the inst lib via the Tracer
Instead of holding a field in the span, refer to the field in the parent
Tracer.
* Change trace options to accept type not pointer
Add benchmark to show allocation improvement.
* Update CONTRIBUTING.md guidelines
* Update all Option iface
* Fix grammar in CONTRIBUTING
* Optimize evictedQueue impl and use
Avoid unnecessary allocations in the recordingSpan by using an
evictedQueue type instead of a pointer to one.
Lazy allocate the evictedQueue queue to prevent unnecessary operations
for spans without any use of the queue.
Document the evictedQueue
* Fix grammar
* Added Benchmarks around events
Also fixed the attribute benchmarks to reflect the # of attributes in the test
* Fix test txt, and too new a version of time
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Remove nil check on return from NewTestSpanProcessor as it can never be
nil, addressing #2396. Also, add nil checks for testSpanProcessor
methods to prevent panics.
This is a simple loggin interface to be used interally for the sdk.
Included is an exmaple in `namedtracer` run:
```
cd example/namedtracer
go run . >/dev/null
```
* Empty queued spans when ForceFlush called
Update the implementation of ForceFlush() to first ensure that all spans
which are queued are added to the batch before calling export spans.
Create a small ReadOnlySpan implementation which can be used as a marker
that ForceFlush has been invoked and used to notify when all spans are
ready to be exported.
Fixes#2080.
* Add a changelog entry.
* Update CHANGELOG.md
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Update sdk/trace/batch_span_processor.go
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Improve test case to verify multiple flushes.
* Refactor code to use enqueue.
* Be more defensive on waiting for queue.
Update the handling of the force flush span so we only wait on the
channel if we were able to enqueue the span to the queue.
* Fix linter.
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
* Add semconv/v1.7.0 package
Generated from the v1.7.0 release of the specification using the
semconvgen tool manually. This also updates the project to use this
version of the semconv package.
This does not include the prior, and missing, v1.5.0 and v1.6.0 versions
of the semconv package. They are planned to be added in a follow-on PR.
* Update CHANGELOG.md
* Update versions file for 1.0.0 release
* Prepare stable-v1 for version v1.0.0
* Update trace signal status in documentation
* Update changelog
* Update CHANGELOG.md
Co-authored-by: Robert Pająk <pellared@hotmail.com>
Co-authored-by: Robert Pająk <pellared@hotmail.com>
* Refactor startSpanInternal into a tracer method
The span creation and configuration process is split across the tracer
Start method and the startSpanInternal function, each living in
different files. This adds confusion when developing. It requires the
developer to remember certain parts of the configuration happen in one
place or the other.
This unifies the creation and configuration of a new span. It makes this
unification by creating a newSpan method on the tracer. This method will
do all the configuration needed for a new span other than setting the
execution task tracker. This remains a part of the Start method to
preserve any existing timing and tracing the already exists.
* Add a non-recording span to the SDK
* Assign returned context from runtime trace task
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
* Update trace API config creation funcs
Follow our style guide and return the config struct instead of pointers.
* Update changelog with changes
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
* Make the tracetest.SpanRecorder concurrent safe
The otelgrpc instrumentation in the contrib repository needs a
concurrent safe implementation as the stream testing is done in a
separate goroutine.
* Refactor concurrency tests