* 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>
* 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>
* Rename WithDefaultSampler TracerProvider option to WithSampler
The term "DefaultSampler" comes from early ideas of this project where
there would be overriding samplers lower in the trace SDK. This
overriding does not exist and if it is going to be introduced in the
future the sampler associated with the TracerProvider is already scoped
based on that association (no need to scope with a name). This renames
the TracerProvider option to not include this anachronism.
* Update PR number in CHANGELOG
* Propagate rename
* Update defaults documentation for TracerProvider
* Update sdk/trace/provider.go
Co-authored-by: Steven E. Harris <seh@panix.com>
* Update sdk/trace/provider.go
Co-authored-by: Steven E. Harris <seh@panix.com>
* Make SpanContext Immutable
* Adds NewSpanContext() constructor and SpanContextConfig{} struct for
constructing a new SpanContext when all fields are known
* Adds With<field>() methods to SpanContext for deriving a SpanContext
with a single field changed.
* Updates all uses of SpanContext to use the new API
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* Update CHANGELOG.md
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* Add tests for new SpanContext constructor and derivation
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* Address PR feedback
* Fix new uses of SpanContext from main
* sdk/trace: add missing options to tracer provider
This change adds `WithDefaultSampler` and `WithSpanLimits` to the tracer
provider and removed `WithConfig` from it.
Before this change, `WithConfig` is the only way to set sampler or
limits of a span. However, it is prone to misuse, since `WithConfig` can
override tracing configurations that are configured by `WithResource` or
`WithIDGenerator`. Thus to fix this, it adds new functional options -
`WithDefaultSampler` and `WithSpanLimits` and removes `WithConfig`.
Resolves#1631.
* Update sdk/trace/provider.go
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Update sdk/trace/provider.go
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* rebase and remove WithConfig
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Move trace API to otel
* Move tracetest to oteltest
* Update package documentation
* Remove old api/trace package
* Lint
* Add changes to CHANGELOG
* Add tests for rest of trace API
* Apply suggestions from code review
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
* Documentation fixes
Includes resolutions for review issues.
* Correct CHANGELOG post release
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
* Rename *Provider names
There is overlap in naming with MeterProviders and TracerProviders. This
is means the specification is not implemented and these types can not
exist in the same package (#1179). This makes each type and related
functions and types explicit.
* Add changes to CHANGELOG
* Update trace export interface
Move to conforming to the specification.
* Update documentation in export trace
* Update sdk trace provider to support new trace exporter
* Update SpanProcessors
Support the Provider changes and new trace exporter.
* Update the SDK to support the changes
* Update trace Provider to not return an error
* Update sdk with new Provider return
Also fix the testExporter ExportSpans method
* Update exporters with changes
* Update examples with changes
* Update Changelog
* Move error handling to end of shutdown
* Update exporter interface
Rename to SpanExporter to match specification. Add an error return value
to the Shutdown method based on feedback. Propagate these changes.
Remove the Stop method from the OTLP exporter to avoid confusion and
redundancy.
* Add test to check OTLP Shutdown honors context
* Add Jaeger exporter test for shutdown
* Fix race in Jaeger test
* Unify shutdown behavior and testing
* Update sdk/trace/simple_span_processor.go
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
* TraceID and SpanID implementations for Stringer Interface
* Hex encode while stringifying
* Modify format specifiers wherever SpanID is used
* comment changes
* Remove TraceIdString() and SpanIdString()
* Comments Fixes
* Update License header for all source files
- Add Apache 2.0 header to source files that did not have one.
- Update all existing headers dated to 2019 to be 2020
- Remove comma from License header to comply with the Apache 2.0
guidelines.
* Update Copyright notice
Use the standard Copyright notices outlined by the
[CNCF](https://github.com/cncf/foundation/blob/master/copyright-notices.md#copyright-notices)
* api(trace): change trace id to byte array.
* fix lint errors
* add helper to create trace id from hex and improve stdout exporter.
* remove comma.
* fix lint
* change TraceIDFromHex to be compliant with w3 trace-context
* revert remove of hex16 regex because its used to parse SpanID
* lint
* fix typo
* rename finish -> end
* missed a few finish -> end spots
* change end back to finish for the bridge span in the openTracing bridge
* fixed grammar, ran make
* trace sdk initial commit.
* fix imports and comments.
* remove tracestate
* split trace.go
* add attribute over limit test.
* add comments and restructure span.go and tracer.go
* refactor MessageEvent
* defer unlock
* some more cleanup in span.go
* rename *MessageEvent* to *Event*
* cleanup comments in trace_test.go
* fix typos.
* return full string ID for traceID and spanID.