This adds support for schema URL to the Tracer according to the specification:
https://github.com/open-telemetry/opentelemetry-specification/pull/1666
(Link to replaced by the link to the spec after that PR is merged)
For the future: once the proto is updated we will need to populate the
schema_url field in the messages.
* Refactor TraceState
* Update tracecontext propagator to use new TraceState
* Add TraceStateFromKeyValues to oteltest
* Use oteltest to test TraceState
* Replace IsEmpty with Len for TraceState
* Replace ParseTraceState with ParseTraceStateString
* Clean up naming
* Add immutability test for TraceState
* Add changes to changelog
* Fixes
* Document argument type change in changelog
* Address feedback
Remove circularity of TestTraceStateLen.
* Add support for scheme in OTEL_EXPORTER_OTLP_ENDPOINT according to the spec
* Changes after review from pellared
* Changes after review from pellared - 2
* Changes after review from pellared - 3
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
* Remove TODO from ReadOnlySpan interface
* Remove the Tracer method from the ReadOnlySpan
This is not required by the specification nor the use of this interface.
* Remove IsRecording from the ReadOnlySpan interface
A read-only span value does not need to know if updates to it will be
recorded. It by definition cannot be updated so no point in
communicating if an update would be recorded.
* Document the ReadOnlySpan interface
* Rename messageEvent* to just event*
* Move the SpanSnapshot into its own file
* Update ReadOnlySpan interface with meta info methods
Add the DroppedAttributes, DroppedLinks, DroppedEvents, and
ChildSpanCount methods to the interface to return additional information
about the span not specified by the specification, but that we are
already providing.
* Add SpanStub to the sdk/trace/tracetest pkg
* Redefine ExportSpans of SpanExporter with ReadOnlySpan
* Rename SpanSnapshot to snapshot and purge docs
* Remove Snapshot method from snapshot type
This method is a hold-over from previous version of the ReadOnlySpan
interface is not needed.
* Update CHANGELOG with changes
Add Status type to SDK
Use this type to encapsulate the Span status similar to the Event type
encapsulating a Span event and the Link type a span link.
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
* Move the Event type from the API to the SDK
This type is not used in the API. It is used in the SDK and then through
the processing pipelines. Move it to the package that originates its use.
* Add changes to changelog
* Update CHANGELOG.md
Co-authored-by: Gustavo Silva Paiva <guustavo.paiva@gmail.com>
Co-authored-by: Gustavo Silva Paiva <guustavo.paiva@gmail.com>
* Wrap TCP listener
The mock collector listener now signals when it receives a connection
instead of waiting an arbitrary time an hoping the event happens.
* Only close the listener C chan once
* Apply PR feedback
* Backwards compatible support for closed listener check
* Cleanup
* Fix flaky OTLP exporter reconnect test
The tests that check the OTLP exporter will reconnect wait for the
reconnect loop to complete, in theory. However, they do not yield the
active goroutine scheduling. The reconnect loop is in its own goroutine
meaning it is unlikely for that loop to be re-entered, especially on
slow systems. This updates the tests call runtime.Gosched when waiting
for the reconnect loop and yield the scheduling to other goroutines.
* Add changes to changelog
* Use time.After instead of Timer
* Remove changelog entry
* Make TraceFlags spec-compliant
* Remove `trace.FlagsDebug` and `trace.FlagsDeferred`
* These are used only by the B3 propagator and will be handled there in the `context.Context`
* Make `trace.TraceFlags` a defined type, aliasing `byte`
* Move `IsSampled` method from `trace.SpanContext` to `trace.TraceFlags`
* Add `Sampled(bool)` method to `trace.TraceFlags`
* Implement `Stringer` and `json.Marshaler` for `trace.TraceFlags`
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* Rename `TraceFlags.Sampled()` to `TraceFlags.WithSampled()` for consistency
* Restore `SpanContext.IsSampled()` method.
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* Update SpanSnapshot to use parent SpanContext
Having only the parent span ID and a separate field to communicate if
the parent was remote does not provide a comprehensive view of the
parent span nor is it an efficient way to transmit this information.
Update the SpanSnapshot to have a `Parent` field that contains the
parent span context. This field replaces the ParentSpanID and
HasRemoteParent fields.
* Revert SamplingParameters span change
* Update CHANGELOG with PR number
* 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>
to provide consistent naming across the code base, deprecate pusher in
favor of exporter naming convention.
Signed-off-by: ldelossa <ldelossa@redhat.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Add HTTP/JSON to the otlp exporter
Co-Authored-By: Roy van de Water <72016+royvandewater@users.noreply.github.com>
* PR fixup
Co-authored-by: Roy van de Water <72016+royvandewater@users.noreply.github.com>
* Updating documentation with an working example for creating NewExporter
* Updated Changelog
* Moved examples in README to testing example
* ExampleTest shouldn't log anything if working as expected
* Fixing the lint
* Fixing the lint
* Review comments
* Changes done moved to Fixed section of Changelog