* Use gofumpt instead of gofmt in golangci-lint conf
* Run gofumpt fixes
* Format generated templates
---------
Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
* docs(typos): Run codespell to fix typos
There were a lot of typos through the repository, so I ran
[codespell][], a tool for automatically fixing typos, to fix them.
```console
make codespell
```
There's already a tool called [misspell][] that's supposed to take care
of this, but misspell hasn't been updated for 6 years, and it doesn't
seem to be catching any of the typos that codespell can.
[codespell]: https://github.com/codespell-project/codespell
[misspell]: https://github.com/client9/misspell
* Revert and ignore spelling for Consequentially
* Add GH workflow for codespell
* Revert GH Workflow and Makefile for codespell
Per @pellared, since there's no instructions for setting up codespell,
it was suggested that the changes for setting up a workflow and section
in Makefile include instructions for setting up codespell as well.
* Revert spelling on consequently
---------
Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Fix baggage.NewMember to decode the accepted value
`value` is decoded and stored after validating the input parameters.
Corresponding test cases are modified so that we can make sure `value` is properly encoded before creating Member.
* fix md lint
* add function document to NewMember for value encoding and decoding
* remove redundant comments and fix CHANGELOG.md
* fix wrong PR number in the changelog
* fix wrong PR number
* fix md-lint
Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
* 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>
* Simplify trace_context tests
Refactor the propagation/trace_context tests to be targeted at testing
the propagator functionality only and remove extraneous dependencies.
Fix the TraceContext Inject method from injecting the tracestate header
if no value exists.
* Add changes to changelog
* Rename baggage context file
* Initial baggage implementation
* Initial tests
* More tests
* Update baggage context functionality
* Add New method to baggage pkg
* Update namedtracer example
* URL encode baggage values
* Refactor and use internal baggage pkg
* Update OpenTracing bridge
* Update baggage propagator
* Fix lint and test errors
* Add changes to changelog
* Apply suggestions from code review
* Rename testcase field per suggestion
* Update test to verify last-one-wins semantics
* Explicitly seed random numbers with static seed in tests
* Parse Member key/value with string split
* Add test for member parse with equal signs in value
* Trim whitespaces for member key/value
* 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.
* 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>
* 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>
How the tracecontext is extracted is important if the user wants to
interact with the extracted SpanContext (i.e. as a remote span context
instead of a current span context). This makes it clear where it will be
extracted and what behavior to expect if the tracecontext is invalid.
* 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
* 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>
* 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>
* Move global code to toplevel package
* Move version function to toplevel package
* Update changelog
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Merge propagation
Rename and merge propagation and api/propagation
to api/propagators.
Drop propagator suffix in general such that
TextFormatPropagator becomes TextFormat since
usage is propagators.TextFormat
fixes#311
* Rebase and godoc updates
* Revert go mod changes
* Replace carrier with supplier in godoc
* shrink the value type
went down from 40 bytes to 24
* add missing license blurb
* stringify value type
* print string value types in stdout exporter
* make Value function take a pointer receiver
* 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
* Add golint to linters and resolve issues.
I decided to remove constructors for some of the propagation types
because the constructors can be reduced to either using the zero value
or a single, non optional member.
* Enable gofmt and commit fixes
* WIP
* Finish http middleware implementation
This is currently done as httptrace.NewHandler(). This should maybe
be moved to a different package or renamed, but atm this name
seemed the least objectionable to me.
There are a few TODOs sprinkled in the code for questions I didn't
know the answers to.
There is an example provided, which when copied to a main func
locally work against the jaeger all in one.
Real tests need to be added.
* Address feedback
* Tie in propagation, update attributes, more options, revise example, etc.
Dropped the httpConfig type because it seemed redundant an unecessary
abstraction.
* WithRouteTag
* address out of band feedback
* move to othttp package
* Add a very basic test.
I ended up needing to export the Traceparentheader const so that
it was accessible to this test.
* Add file header
* add propagation api.
* add http propagator interface and w3c propagator implementation.
* remove Extract api from trace.
* remove Extract interface for tracer.
* fix copyright.
* fix variable names and comments.
* move inject/extract out of trace.
* replace INVALID_SPAN_CONTEXT with EmptySpanContext function.
* fix tag.Map.
* make carrier as interface instead of http.Request.
* rename structs and update doc comments..
* add doc.go
* update doc.
* add noop propagator.
* add new propagation api with Supplier interface.
- added Default Tracer which simply propagates SpanContext.
- added CopyOfRemote option to simply create remote span.
* remove old propagator.
* rename propagator to TextFormatPropagator.
* rename default tracer/span as pass_through tracer/span.
* add test for pass through tracer.
* add missing interface to pass through tracer.
* return SpanContext instead of contex.Context from Extract interface.
- also remove PassThroughTracer
* fix review comments.
* add more test cases for traceContext extraction.
* remove tidy temporarily from circle-ci target to avoid build failure.
* allow header ending in dash '-'.
* add inject test for non-zero value other than 01 for traceoption
* add AddLink and Link interface to MockSpan
* fix running go mod tidy on every build.