* Avoid calling TraceState.builder().build() and replace it with TraceState.getDefault();
* Avoid storing TraceFalgs.getDefault() and TraceFalgs.getSampler() and use them directly;
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
* Removes one custom interface and uses BiConsumer as all the other places.
* Builder no longer needs to create new objects from parent and can reshare them.
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
* Migrate to using gradle platform to manage dependency versions instead of global variables.
* Remove unused and fix test
* Revert test yolo
* Workaround test ordering issue by just merging them
* Spot
* Move the semantic conventions generated code into its own module
* remove un-needed dependencies
* move the semconv module to the top level, out of the API namespace
* Update README.md
Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>
* move SemanticAttributes to a more appropriate package and deprecate the old ones in the api package.
* Apply suggestions from code review
Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>
* omit metrics artifacts (alpha) from the bill of materials (bom)
* Hack the version number for maven publications that end in -metrics.
* Remove the failed attempt.
This ensure clear separation of functionality. This PR does not change any functionality, it just restructures the code to separate global functionality from
the Default implementation. Also helps to ensure that Global initialization does not happen by mistake when working only with the default implementation.
Also it helps with methods like `OpenTelemetry.get()` and `OpenTelemetry.set()` to understand they are interacting with global instance
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
This ensure clear separation of functionality. This PR does not change any functionality, it just restructures the code to separate global functionality from
the Default implementation. Also helps to ensure that Global initialization does not happen by mistake when working only with the default implementation.
Also it helps with methods like `OpenTelemetry.get()` and `OpenTelemetry.set()` to understand they are interacting with global instance
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
* add some basic benchmarks for various baggage operations
* update for changes from upstream; pre-allocate the strings in the benchmark.
* allocate the strings statically because we can
This PR fixes an inconsistency that MaxLengthOfAttributeValues was allowed to be set to 0, then thrown internal exception.
We should check for arguments only at public APIs.
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
There are some things left to be done:
* Decide if context package should also be opentelemetry-api-context.
* Cleanup internal packages, things that are used by only one artifact should be moved there.
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
* Detect GC leaks of scopes in StrictContextStorage.
* More
* Finish
* Force GC more aggressively
* Cleanup
* Vendor code directly
* Copy test too
* Try waiting more
* ep
* oops
* Remove from build.gradle
* Drift
* Log on multiple
* Cleaner ourselves.
* EP
* Move into if
* Revert accidental
* Convert Attributes to an interface
* Add javadoc explaining Attributes implementation requirements.
* Convert the AttributesBuilder into an interface.
* update from upstream changes
* move the implementation class out of the interface
* clean up some javadoc that referenced non-public classes
* convert TraceState to an interface
* don't expose the impl
* Remove the un-needed TraceState Entry objects.
* Add additional javadoc documenting requirements for interface implementors.
* make the implementation non-public
* remove un-needed test docs
* Update api/src/main/java/io/opentelemetry/api/trace/TraceState.java
Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>
* Update api/src/main/java/io/opentelemetry/api/trace/TraceState.java
Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>
* formatting fix
* Convert the TraceStateBuilder into an interface.
* Introduce an intermediate class to get around classloading cycles.
* extract a method to remove an entry from the builder
* add a comment about the possible inefficiency in the implementation
Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>
- changes the return type of the fields() method in TextMapPropagator from List<String> to Collection<String>
and updated all implementations for consistency
CHANGELOG: Invalid TraceState entries will now be ignored, rather than causing the entire TraceState to be invalidated.
* Ignore invalid usage of TraceState instead of throwing.
* Format
* Missed a test
* Make the OpenTelemetrySdk a subclass of DefaultOpenTelemetry
* Remove SPI from the explicit OpenTelemetrySdk builder usage.
Add a (super ugly) test to make sure that the clock and resource are getting set.
* Update sdk/all/src/test/java/io/opentelemetry/sdk/OpenTelemetrySdkTest.java
Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>
* Update sdk/all/src/test/java/io/opentelemetry/sdk/OpenTelemetrySdkTest.java
Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>
* address code review comments; add tests
* Require the MeterProvider to be a MeterSdkProvider
Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>
CHANGELOG: Deprecated the `getCanonicalCode` method on `SpanBuilder` ; replaced with `getStatusCode`
* Some cleanup in span land.
* Clean up the SpanBuilder javadoc to match the current APIs
* Scrub mentions of canonical status code
* Deprecate the getCanonicalCode method on SpanBuilder and replace with getStatusCode
* rename an internal method to make more sense
* Update api/src/main/java/io/opentelemetry/api/trace/SpanBuilder.java
Co-authored-by: Armin Ruech <armin.ruech@dynatrace.com>
* Update api/src/main/java/io/opentelemetry/api/trace/SpanBuilder.java
Co-authored-by: Armin Ruech <armin.ruech@dynatrace.com>
* Update api/src/main/java/io/opentelemetry/api/trace/SpanBuilder.java
Co-authored-by: Armin Ruech <armin.ruech@dynatrace.com>
* add tests for the deprecated method
Co-authored-by: Armin Ruech <armin.ruech@dynatrace.com>
* Replace all assertions with AssetJ's assertThat
Remove uses of JUnit 4 and JUnit 5 assert* where a functional equivalent exists in AssertJ. JUnit 5's assertThrows remains.
Fixes#1994
* fixup! Replace all assertions with AssetJ's assertThat
* Initial implementation of a jaeger thrift exporter.
* some cleanups/renaming
* fix? the formatting
* Fix the default endpoint.
* Update exporters/jaeger_thrift/README.md
Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>
* Update exporters/jaeger_thrift/README.md
Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>
* Update exporters/jaeger_thrift/src/main/java/io/opentelemetry/exporters/jaeger/Adapter.java
Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>
* Update exporters/jaeger_thrift/src/main/java/io/opentelemetry/exporters/jaeger/JaegerThriftSpanExporter.java
Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>
* cleanup from PR review
* fix from upstream change
* add assertions about the results of the exports
and fix the code to make sure the results were included.
* update for api repackaging
* add some fuzzing tests for the id <-> long conversions
* change SpanId interface to match the TraceId one.
* Made a test method non-public
Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>
Rename TraceShim factory to OpenTracingShim
Remove factory method from OpenTracingShim which used mixed pieces of the openTelemetry components.
Made the constructor for W3CBaggagePropagator private.
Updated OpenTracingShim README
* Add a method to the Baggage interface to return the current baggage in the context.
* formatting
* Fix tests broken by not clearing state
* don't try to code while overly tired. the result is scopes that aren't closed.
* remove the scope to make sure the root scope has no baggage
* Serialize the entire trace flags not only the sample bit
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
* Add test for more than just sampling bit in the context
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
* Update api/src/test/java/io/opentelemetry/trace/propagation/HttpTraceContextTest.java
Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>
* Extract an interface for the OpenTelemetry API to later allow an SDK to implement it.
* Cleanups
* mine
* final
* Fix shortcuts
* Fix javadoc
* More merge
* Make the baggage API fully functional in the API
and get rid of the BaggageManager that was needed previously.
* javadoc cleanup
* more javadoc cleanup
* make the ImmutableBaggage package access
* Remove getCurrentContext and withSpan from Tracer
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
* Remove old java7 example
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
* Turn the Baggage metadata into a simple wrapper for a String.
* whoops missing final modifier
* remove unneeded nullable annotation
* Remove the method to parent via Baggage.
Parenting is still implemented via the Context.
Also, renamed many old variables and method to use the new baggage name.
* update for context changeover
* Remove the method to parent via Baggage.
Parenting is still implemented via the Context.
Also, renamed many old variables and method to use the new baggage name.
* Basic implementation of baggage header extraction.
* inject implemented
* cleanup checks
* update for context changeover
* Turn the Baggage metadata into a simple wrapper for a String.
* whoops missing final modifier
* remove unneeded nullable annotation
* Remove the method to parent via Baggage.
Parenting is still implemented via the Context.
Also, renamed many old variables and method to use the new baggage name.
* small javadoc tweak
* update for context changeover
* Turn the Baggage metadata into a simple wrapper for a String.
* whoops missing final modifier
* javadoc cleanup
* use the empty metadata as the OT Shim default
* remove unneeded nullable annotation
* subsume methods from AttributesKeys to AttributeKey
* remove missed instance of AttributesKeys
* make javadoc wording more representative of method intent
* Remove Link from API, use SpanData.Link in Sampler
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
* Fix tracing_incubator
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
* Remove addLink that accepts Link interface
Currently the Link interface cannot easily be removed, used in the Sampler interface,
will do a separate PR for that.
Based on the specs we don't have to offer a "lazy" formatted Link API (was removed some time ago).
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
* Copy javadoc instead of reference
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
Co-authored-by: Anuraag Agrawal <aanuraag@amazon.co.jp>
* Remove Event interface, and it's usage
Based on the specification we are not required to expose this interface or have APIs that accept this interface.
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
* Fix links to Event
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
* Fix more javadocs references to Event
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
* Make setting null-valued attributes a no-op, and document that their behavior is undefined.
* also have the span itself ignore null attribute values
* Update api/src/main/java/io/opentelemetry/common/Attributes.java
Co-authored-by: Giovanni Liva <giovanni.liva@dynatrace.com>
* Set the non-null-by-default annotation on the package level for the common code.
* add no-op validating tests with a caveat
Co-authored-by: Giovanni Liva <giovanni.liva@dynatrace.com>
* check traceparent for extra trailing characters for version 00
Signed-off-by: Sergei Malafeev <sergei@malafeev.org>
* add tests and make "00" a constant
Signed-off-by: Sergei Malafeev <sergei@malafeev.org>
* #1674 validate version from traceparent according to spec
Signed-off-by: Sergei Malafeev <sergei@malafeev.org>
* add test
Signed-off-by: Sergei Malafeev <sergei@malafeev.org>
* add test
Signed-off-by: Sergei Malafeev <sergei@malafeev.org>
* rename TraceVersion to WireFormatUtils
Signed-off-by: Sergei Malafeev <sergei@malafeev.org>
* rename test method
Signed-off-by: Sergei Malafeev <sergei@malafeev.org>
* use precalculated versions
Signed-off-by: Sergei Malafeev <sergei@malafeev.org>
* get rid of unneded class
Signed-off-by: Sergei Malafeev <sergei@malafeev.org>
* get rid of empty lines
Signed-off-by: Sergei Malafeev <sergei@malafeev.org>
* fix style
Signed-off-by: Sergei Malafeev <sergei@malafeev.org>
* Reverse the precedence on Labels and Attributes to prefer the last one added, rather than the first.
Note: this necessitated changing the way Resources were merged, and the way recordException was implemented.
Added an addAll method to the builder to support efficiently addition of attributes from existing attributes.
* run the formatter
* revert 2 unneeded assertion changes
* Update from rebase
* Add a generic type for the key on the ImmutableKeyValuePairs.
This necessitated changing the `get` to `getValue` to avoid clashing with the java.util.Map interface.
Also introduced convenience sub-interfaces for consuming labels and attributes, so consumers don't have to worry about the types if they don't want to.
* Make AttributesMap not extend map, and restore the get method name for Attributes.
* key class and implementation
* key class and implementation
* The code compiles
* little tweaks
* some cleanup, tests are passing
* remove AttributeValue and clean up misc. references to it.
* clean up some unused bits
* add a TODO
* a bit of cleanup; fix a todo
* update for changes from the main branch
* Change method to get the underlying key.
Move the key creators to a AttributesKeys class.
Hide the implementation classes and replace with interface use.
* use autovalue for the key implementations
* fix javadoc issues
* update benchmark keys, and a few tweaks from PR review
* Add javadoc notes to encourage using the lower-overhead attribute options.
* Add javadoc clarifying subclass responsibilities around empty keys.
* make the compareTo on AttributeKeyImpl null-safe, for extra safety
* fix formatting
* switch to java 8
* update the READMEs and use Object.equals in a couple of cases to test that we're really compiling for java 8/android 24.
* formatting
* use the newer release options for the build, and change the int test to not be java 7 any more.
* switch back to source/target compatibility
* sure wish I could run docker locally to test this out.
* move TraceFlags into the SpanContext, and expose the relevant flags.
* Cleanup from rebase from main branch
* Address comments from PR review
* Update extensions/trace_propagators/src/main/java/io/opentelemetry/extensions/trace/propagation/AwsXRayPropagator.java
Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>
* Undo @anuraaga's bad suggestion. ;)
* change the traceFlags input to the TraceContext be a byte, rather than a boolean.
Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>
* Add a generic type for the key on the ImmutableKeyValuePairs.
This necessitated changing the `get` to `getValue` to avoid clashing with the java.util.Map interface.
Also introduced convenience sub-interfaces for consuming labels and attributes, so consumers don't have to worry about the types if they don't want to.
* Add some javadoc to the new interfaces.
* Make AttributesMap not extend map, and restore the get method name for Attributes.
* make ImmutableKeyValuePairs also have a parameterized key type
* This is a combination of 2 commits.
This is the 1st commit message:
WIP on converting to String-based SpanContext
don't hand out the byte arrays publicly, but require making copies
make sure to hand out fresh invalid byte arrays.
Use strings for span and trace ids.
Switch over to CharSequence instead of String for the ids
Fix a couple of places that were casting to String
Add some simple wrappers for the generated longs to save converting until the last moment to the character-based representation.
introduce a reusable threadlocal char buffer for generating random ids.
update for changes from upstream
Change the SpanContext to store the ids as Strings internally
Change the id access methods on SpanContext to be clearly labeled as the base16 representations
Add a new create method that allows specifying offsets for traceId and spanId CharSequences
Provide an option for creating a SpanContext from longs or Strings, optionally.
fix a typo
update from upstream
The commit message #2 will be skipped:
don't hand out the byte arrays publicly, but require making copies
* WIP on converting to String-based SpanContext
* Update the SpanContext to only store Strings internally for Trace and Span ids.
* remove dead files
* cleanup some CharSequence usages to String
* Update api/src/main/java/io/opentelemetry/trace/BigendianEncoding.java
Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>
* Update extensions/trace_propagators/src/main/java/io/opentelemetry/extensions/trace/propagation/B3PropagatorInjectorSingleHeader.java
Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>
* Update api/src/main/java/io/opentelemetry/trace/SpanId.java
Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>
* Update api/src/main/java/io/opentelemetry/trace/TraceId.java
Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>
* updates from PR suggestion fubars
* some cleanup from PR feedback
* Switch back to String from CharSequence
* Get rid of the overload with the offsets
* Lots of bits of cleanup from PR feedback.
* more renaming of base16 to hex
Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>
* Update the TraceState key validations to more closely match the w3c spec.
* rework method and variable names for more clarity
* Add some tests and fix a bug