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.
* Removed DroppedAttributeCount field from Link struct
* Reintroduced DroppedAttributeCount with a wrapper struct
* Added Link type in otel/sdk package and used it instead of Trace API equivalent
* Added changelog entry
* Linting fix in changelog
* Deleted duplicated changelog section added by mistake
* Expanded changelog entry and moved it under the 'Added' section
* Explicitly mentioned otel/trace library in changelog entry under 'Removed' section to avoid ambiguity
* API: create new linked span from current context
* ran make precommit
* Update trace/trace.go
* Updated CHANGELOG
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Ensure that no-op tracer still progates non-recording spans
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* Add `TracerProvider` to the `trace.Span` interface
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* Remove config from oteltest.Tracer as it can be accessed through the provider
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* 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 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>
* 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>
Adds support for the opentelemetry exceptions semantic conventions. In
short, this has RecordError produce an exception event with exception
attributes instead of using the error event and error attributes.
While golang does not have exceptions, the spec itself does not
differentiate between errors and exceptions for recording purposes.
RecordError was kept as the method name, both for backwards
compatibility and to reduce confusion (the method signature takes in a
golang error object). The spec appears to allow this, as it suggests the
method is optional and signature may reflect whatever is most appropriate
for the language implementing it.
It may seem non-intuitive to log an exception event from a method called
RecordError, but it's beneficial to have consistent behavior across all
opentelemetry SDKs. Downstream projects like the opentelemetry-collector
can build off of the published API and not special case behaviors from
individual languages.
* Store Span instead of local/remote SpanContext in Context
Now that the SpanContext has a remote identifier, storing a Span's
SpanContext two separate ways in a Context (one for local another for
remote) is unnecessary and adds complication throughout the project when
determining heredity of a Span. This moves to storing the Span directly
in the Context uniformly (for both local and remote) as current Span. In
the process, it updates the getter/setter functionality the `trace`
package provides and replaces the distributed heredity logic throughout
the project with just using the current Span as the parent if it exists.
* Update trace/context.go
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
* Assert propagators context remote state
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
* Add remote property to SpanContext
* Set SpanContext.remote when extracting context in TraceContext propagator
* Ensure remote flag is set when inserting remote SpanContext into context
* Ensure tests are expecting remote flag in SpanContext where appropriate
* Update CHANGELOG.md
* Apply PR feedback
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.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
* Add TraceState to API
* Add tests for TraceState
* Update related tests
- stdout exporter test
- SDK test
* Update OTLP span transform
* Update CHANGELOG
* Change TraceState to struct instead of pointer
- Adjust tests for trace API
- Adjust adjacent parts of codebase (test utils, SDK etc.)
* Add methods to assert equality
- for type SpanContext, if SpanID, TraceID, TraceFlag and TraceState are
equal
- for type TraceState, if entries of both respective trace states are
equal
Signed-off-by: Matej Gera <matejgera@gmail.com>
* Copy values for new TraceState, adjust tests
* Use IsEqualWith in remaining tests instead of assertion func
* Further feedback, minor improvements
- Move IsEqualWith method to be only in test package
- Minor improvements, typos etc.
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Update Span End method documentation
Updates to the Span after End is called result it potentially
inconsistent views of the Span between the code defining it and the
ultimate receiver of the Span data. This corrects the documented
language of the API to prevent this from happening.
* Add changes to changelog