1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2024-11-30 08:46:54 +02:00
Commit Graph

9 Commits

Author SHA1 Message Date
Tyler Yahn
0eeb8f87e9
Refactor Tracestate (#1931)
* 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.
2021-05-24 07:53:26 -07:00
Tyler Yahn
604b05cbcf
Store current Span instead of local and remote SpanContext in context.Context (#1731)
* 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>
2021-03-29 08:55:44 -07:00
Anthony Mirabella
860d5d86e7
Add flag to determine whether SpanContext is remote (#1701)
* 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>
2021-03-18 09:05:37 -07:00
Anthony Mirabella
e88a091a72
Make SpanContext Immutable (#1573)
* 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
2021-03-09 08:17:29 -08:00
Punya Biswal
ecf65d7968
Rename otel/label -> otel/attribute (#1541)
* Rename otel/label -> otel/attr

Leave the imported name alone, to avoid a large diff and conflicts

* Better import comment

* Update CHANGELOG.md

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>

* otel/attr -> otel/attribute

* Missed the changelog entry

* Get rid of import renaming

* Merge remaining conflicts

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
2021-02-18 12:59:37 -05:00
Punya Biswal
3bce9c97f8
Add Keys() method to propagation.TextMapCarrier (#1544)
...and propagation.HeaderCarrier to adapt http.Header to this interface.

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-02-17 08:04:49 -08:00
Anthony Mirabella
74deeddd26
Handle tracestate in TraceContext propagator (#1447)
* TraceContext propagator now handles `tracestate`.

Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>

* Prevent invalid tracestate from invalidating traceparent.

Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>

* Fail tests early if unable to construct expected TraceContext

Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
2021-01-12 11:12:14 -08:00
Matej Gera
439cd31389
Add TraceState to SpanContext in API (#1340)
* 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>
2020-12-21 13:11:48 -08:00
Krzesimir Nowak
63a11144cf
Move baggage and propagation to separate packages (#1325)
* Move propagation code to propagation package

* Move baggage code to baggage package

* Update changelog

* Make docs of baggage.Set more clear

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-11-13 07:34:24 -08:00