Commit Graph

784 Commits

Author SHA1 Message Date
Bogdan Drutu cbc8891cae
Mark API's classes final, caveat a bit of duplicate code (#2324)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-12-17 11:16:35 -08:00
jason plumb 2aa1eb2f54
Metrics are alpha take 2 (#2329)
* 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.
2020-12-16 20:10:06 -08:00
Anuraag Agrawal 17fa4e9c97
Only apply java-library to projects and configure reactively. (#2319)
* Use java-library

* Only apply java-library to projects and configure reactively.

* Consistency

* Cleanup
2020-12-17 09:11:44 +09:00
Anuraag Agrawal 8a369e3695
Make public src/main classes final where possible. (#2309)
* Make public src/main classes final where possible.

* methods

* Spot
2020-12-16 13:13:04 +09:00
jason plumb 5a93b77524
inject alpha into the version for metrics api and sdk. (#2311) 2020-12-16 12:29:54 +09:00
Bogdan Drutu dbb1ae91f9
Deprecate metrics from opentelemetry-api, add a global version in metrics api (#2279)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-12-15 15:14:50 -08:00
Bogdan Drutu 37afb33659
Split global functionality into a separate class (#2233) (#2239)
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>
2020-12-15 13:05:46 -08:00
Bogdan Drutu 25bf879df7
Split global functionality into a separate class (#2233)
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>
2020-12-15 10:27:35 -08:00
Anuraag Agrawal 44186bc110
Suppress checkstyle javadoc check from non-main source sets. (#2307)
* Suppress checkstyle javadoc check from non-main source sets.

* Update checkstyle-suppressions.xml
2020-12-15 09:39:33 -08:00
Frank Spitulski c108f62158
fix(semantic-attributes): update to dec 14 2020 master (#2302) 2020-12-15 08:42:33 -08:00
Anuraag Agrawal e802b8ab35
Detect invalid use of makeCurrent in Kotlin coroutine. (#2227)
* Detect invalid use of makeCurrent in Kotlin coroutine.

* Fix and check suspending function too.

* Newline

* Doc

* Some comments

* teency
2020-12-15 15:09:34 +09:00
Anuraag Agrawal 262dd7a866
Use key as AttributeKey.toString (#2175)
* Use key as AttributeKey.toString

* Fix / more tests

* Add toString test for SpanWrapper

* Quote string values

* Fix
2020-12-15 12:49:45 +09:00
Anuraag Agrawal 13e6485a63
Add Context.toString (#2289) 2020-12-15 11:57:36 +09:00
Anuraag Agrawal 6f97da1261
Make AttributeKey compare normally with both type/key. (#2284)
* Make AttributeKey compare normally with both type/key.

* Say hi to murphy
2020-12-14 09:56:56 -08:00
Bogdan Drutu 8a8799ec9e
Small nit in internal members order (#2232)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-12-12 16:18:38 -08:00
Bogdan Drutu c8f1f27f07
Remove OpenTelemetryBuilder interface, every implementation will have it's own builder (#2275)
This PR also fixes the DefaultOpenTelemetry builder to be it's own class and not a sub-class.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-12-12 13:09:58 +09:00
Prashant Srivastava f88e207f09
Adding instructions to run benchmarks (#2271)
* benchmark readme for opentelemetry-sdk

* benchmark instructions for all the modules

* Fixing typo
2020-12-11 14:40:16 +09:00
Bogdan Drutu ca1f31dfb5
Use standard Java interfaces instead of defining custom ones (#2261)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-12-10 09:16:24 -08:00
Bogdan Drutu 78d1ad5cce
Remove unnecessary generic argument from AsynchronousInstrument (#2260)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-12-10 08:20:36 -08:00
Anuraag Agrawal f199e133fa
Implement more Span default methods. (#2242)
* Implement more Span default methods.

* A bit more
2020-12-09 13:08:52 -08:00
Bogdan Drutu a439ca6da1
Move small internal package under common (#2219)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-12-09 13:45:10 +09:00
Bogdan Drutu 087f58da1d
Remove references to TracingContextUtils (#2238)
* Remove references to TracingContextUtils

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

* Update api/trace/src/main/java/io/opentelemetry/api/trace/Tracer.java

Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>
2020-12-08 16:56:49 -08:00
John Watson 704dfe270b
add some basic benchmarks for various baggage operations (#2197)
* 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
2020-12-08 11:00:54 -08:00
Bogdan Drutu efd6b9f3e4
Remove deprecated setCallback, change SDK to avoid volatile (#2216)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-12-07 18:37:45 -08:00
Bogdan Drutu 67b6339c70
Small nits in api packages (#2220)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-12-07 18:10:58 -08:00
Bogdan Drutu 65acc09c46
Add unit tests for isValidMetricName (#2218)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-12-08 09:22:20 +09:00
Bogdan Drutu be9c31ecad
Remove internal public validateLabelPairs, move to the class that uses it (#2215)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-12-07 14:42:23 -08:00
Bogdan Drutu 69208f8f79
Remove version of checkArgument not used (#2213)
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>
2020-12-07 13:39:33 -08:00
Bogdan Drutu 50c8f1f5c6
Move obfuscated to sdk, make it package protected (#2208)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-12-07 12:47:01 -08:00
Bogdan Drutu 7460f92bc8
Remove deprecated methods/classes before 1.0 release (#2205)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-12-07 11:33:17 -08:00
Bogdan Drutu 57263bf44a
Move TemporaryBuffers to be a package protected class, no need to expose this class (#2206)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-12-07 11:31:03 -08:00
Bogdan Drutu 3a7c0086c2
Remove deadcode from internal package (#2209)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-12-07 11:30:39 -08:00
Anuraag Agrawal 2770d46191
Add array implementation of Context. (#2191)
* Add array implementation of Context.

* More test
2020-12-07 12:39:35 +09:00
Anuraag Agrawal 469900eb34
Add a system property that can enable strict context checking for staging environments. (#2195) 2020-12-07 12:38:27 +09:00
Anuraag Agrawal f51332bd25
Add Labels.asMap and hide the builder implementation. (#2189)
* Add Labels.asMap and hide the builder implementation.

* Not public

* Spot

* More merge
2020-12-07 11:35:41 +09:00
Bogdan Drutu 26124ad075
Split API packages, move context in the same directory (#2199)
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>
2020-12-05 08:33:20 -08:00
Anuraag Agrawal 8697de9afa
Detect GC leaks of scopes in StrictContextStorage. (#2164)
* 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
2020-12-04 13:04:27 +09:00
Anuraag Agrawal 643b697106
Add TraceState.asMap (#2190)
* Add TraceState.asMap

* Javadoc

* Spot
2020-12-04 12:40:11 +09:00
Anuraag Agrawal 4762c6a25d
Remove ReadableAttributes (#2187)
* Remove ReadableAttributes

* Don't rewrite history

* Drift
2020-12-03 11:26:24 -08:00
Anuraag Agrawal f8b9f0ac6a
Expose BaggageEntry / Metadata as interfaces and add asMap (#2177)
* Expose BaggageEntry / Metadata as interfaces and add asMap

* Disclaimer
2020-12-02 10:40:46 -08:00
Armin Ruech 5585e73611
Remove "semver" prefix from instrumentation library version (#2180) 2020-12-02 10:29:11 -08:00
John Watson ba9f9c09a2
Fix a bug with all tracers & meters being delegated to the global tracer. (#2176) 2020-12-02 18:06:28 +09:00
Anuraag Agrawal cf5b582c5b
Replace AttributeConsumer with BiConsumer (#2174)
* Replace AttributeConsumer with BiConsumer

* Forgot to delete
2020-12-02 16:52:06 +09:00
John Watson e90a6a886b
Convert Attributes to an interface (#2134)
* 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
2020-12-01 15:54:07 -08:00
Mateusz Rzeszutek dc91c95e63
Fix buildscripts/semantic-convention/generate.sh script (#2144)
* Fix buildscripts/semantic-convention/generate.sh script

Including:
* update spec version to latest commit
* regenerate SemanticAttributes

* Code review comments

* Reference spec date
2020-12-01 11:18:32 -08:00
Anuraag Agrawal 0163a8c121
Split SpanContext into interface / impl (#1935)
* Split SpanContext into interface / impl

* Remove javadoc from impl to reduce drift change.

* Add warning

* More
2020-12-01 11:06:48 -08:00
John Watson 6be633701f
Convert Labels to be an interface. (#2137)
* Convert Labels to be an interface.

* Convert the LabelsBuilder into an interface.
2020-12-01 08:46:34 -08:00
John Watson 036f7f1477
Convert TraceState to be an interface (#2138)
* 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>
2020-12-01 08:21:36 -08:00
Anuraag Agrawal 7ed6d8d4e4
Remove Status.value (#2147)
* Remove Status.value

* Deprecate for now
2020-12-01 13:46:26 +09:00
Anuraag Agrawal 052b17f9b1
Add asMap for Attributes. (#2145)
* Add asMap for Attributes.

* AttributesMap too

* Test empty too.

* checkstyle
2020-12-01 13:27:14 +09:00
Chris Burns e0989d75e7
Changes return type from List to Collection (#2156)
- changes the return type of the fields() method in TextMapPropagator from List<String> to Collection<String>
and updated all implementations for consistency
2020-11-30 14:26:24 -08:00
John Watson 73bad773dd
Move the AsynchronousInstrument callbacks to the builders. (#2120)
Deprecate the existing setCallback method.
Update the code in the SDK to use the new API.
2020-11-30 14:12:49 -08:00
Christian Neumüller bbe8702257
Rename HttpTraceContext to W3CTraceContextPropagator. (#2116)
* Rename HttpTraceContext to W3CTraceContextPropagator.

* Add javadoc.
2020-11-25 10:27:07 +09:00
John Watson 3782def5dd
Add a static builder method to the OpenTelemetry interface. (#2118) 2020-11-24 09:22:15 -08:00
Anuraag Agrawal 96c7f404b4
Don't repeat Java 8 support among all the subproject READMEs and at top level, clarify that published artifacts are Java 8, but building requires additional instructions. (#2124) 2020-11-24 09:04:40 -08:00
Anuraag Agrawal ac672e56bf
Update dependencies (#2115) 2020-11-21 09:39:27 -08:00
Anuraag Agrawal 1828938263
Disallow null attribute array values. (#2105) 2020-11-21 09:28:58 -08:00
Anuraag Agrawal 0e013e5c73
Hide default context propagators implementation behind interface. (#2089)
* Hide default context propagators implementation behind interface.

* Deprecate

* Revamp
2020-11-20 10:58:34 +09:00
John Watson 96b480cd35
Deprecate the toBuilder methods on the OpenTelemetry classes, and add a method to set the propagators on an instance. (#2094) 2020-11-19 12:39:21 +09:00
Anuraag Agrawal a68b0bf864
Ignore invalid usage of TraceState instead of throwing. (#2084)
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
2020-11-18 09:22:24 -08:00
Anuraag Agrawal 46408ef3fd
Don't throw exceptions for invalid baggage like other APIs (#1964)
* Don't throw exceptions for invalid baggage like other APIs

* Remove redundant null check

* Remove redundant null checks
2020-11-16 18:30:16 -08:00
John Watson 7a5d8df148
Make the OpenTelemetrySdk a subclass of DefaultOpenTelemetry (#2069)
* 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>
2020-11-16 16:06:43 -08:00
John Watson 1fe334ff12
Some cleanup in span land. (#2062)
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>
2020-11-11 18:34:07 -08:00
John Watson 58ccf97929
Switch the key/value pair sorting to mergesort, because it is stable (#2049) 2020-11-11 08:04:42 -08:00
Anuraag Agrawal b5efbcf187
Move builders to top level. (#1958)
* Move builders (and TraceStateEntry) to top level.

* Revert Entry

* Fix and more revert

* Drift
2020-11-10 14:50:37 +09:00
Anuraag Agrawal 1883c578bd
Add unit to start, end and event timestamp accepting methods in Span. (#1969)
* Add unit to timestamp accepting methods in Span.

* end timestamp

* Merge

* Merge

* Add Instant versions too
2020-11-09 16:19:52 -08:00
Anuraag Agrawal 9063c385d9
Implement baggage using array of key/value pairs instead of Map. (#2016)
* Implement baggage using array of key/value pairs instead of Map.

* Cleanup
2020-11-09 08:54:22 -08:00
Marius Volkhart 3e31fd91aa
Replace all assertions with AssetJ's assertThat (#2042)
* 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
2020-11-07 14:48:00 -08:00
John Watson d69752a6be
Move the SPI interfaces to .spi.* packages (#2005) 2020-11-06 11:08:35 +09:00
Anuraag Agrawal 9c4c52dfee
Switch animal sniffer signature to gummy bears. (#2015) 2020-11-06 08:56:26 +09:00
Carlos Alberto Cortez 5195622181
Add Getter.Keys() with Jaeger Baggage support. (#1549) 2020-11-05 12:51:07 +01:00
Anuraag Agrawal 28905b7e05
Expose foreach consumer instead of Entry for baggage. (#1982) 2020-11-04 13:41:30 -08:00
Anuraag Agrawal 5be613a3f0
Replace EndSpanOptions.Builder with factory. (#1934)
* Replace EndSpanOptions.Builder with factory.

* create

* Remove class completely
2020-11-04 13:33:10 +09:00
Anuraag Agrawal e5cf181ed9
Expose foreach consumer instead of entries for trace state. (#1979)
* Expose foreach consumer instead of entries for trace state.

* o-public
2020-11-03 16:41:27 -08:00
Anuraag Agrawal 37cce8dbca
Replace LabelConsumer with BiConsumer (#1980) 2020-11-03 15:21:52 -08:00
Anuraag Agrawal 23392d9052
Make Attribute/LabelConsumer consistent with Java 8 BiConsumer (#1983)
* Make Attribute/LabelConsumer consistent with Java 8 BiConsumer

* more

* Spot
2020-11-03 10:03:52 -08:00
John Watson d958f2ba0c
Add a Jaeger exporter which exports via the thrift-over-http format (#1875)
* 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>
2020-11-03 09:41:39 -08:00
Trask Stalnaker 4699191495
Add doc explaining the restriction on return type (#1977)
* Add doc explaining the restriction on return type

* In more places
2020-11-03 14:20:16 +09:00
Tyler Benson 9c446490af
Fix outdated javadoc (#1975) 2020-11-02 11:03:42 -08:00
Anuraag Agrawal 0e937d4c55
Use fine logging in w3c/b3 propagator instead of info. (#1966)
* Use fine logging in w3c propagator instead of info.

* Fine for b3 too
2020-11-02 07:47:11 -08:00
John Watson f034adb03b
Misc. cleanup: (#1942)
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
2020-10-31 13:42:00 -07:00
John Watson e581182147
Create classes to hold on to the context keys. (#1945)
Inline methods in TCU and get rid of it.
2020-10-31 08:47:37 -07:00
Anuraag Agrawal c723de5b05
Merge context_prop into context artifact. (#1928) 2020-10-31 08:47:07 -07:00
Anuraag Agrawal e8c6b1dac8
Remove BaggageUtils (#1931) 2020-10-30 11:25:12 -07:00
Anuraag Agrawal d430e11421
Add test cases for array attributes with null inside. (#1933) 2020-10-30 08:19:37 -07:00
Anuraag Agrawal c6f111a48d
Add comments to all package-private methods being used by auto-instrumentation. (#1930) 2020-10-29 20:42:43 -07:00
Anuraag Agrawal e6f6f19cc9
Remove BaggageManager for real. (#1929)
* Remove BaggageManager for real.

* Spot
2020-10-29 20:42:00 -07:00
John Watson 338acd4816
Add some simplistic fuzz-based tests for the 2 built-in W3C propagators. (#1926)
* Add some simplistic fuzz-based tests for the 2 built-in propagators.

* remove unused gradle plugin
2020-10-29 17:57:25 -07:00
Bogdan Drutu 972c89a2ef
Make BaggageUtils and TracingContextUtils package protected (#1923)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-10-29 14:05:51 -07:00
Bogdan Drutu da7ff3da20
Ensure all public classes in the API are final (#1924)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-10-29 14:05:29 -07:00
Anuraag Agrawal 604aee25fa
Have Baggage context interaction API mirror Span. (#1916) 2020-10-29 12:49:54 -07:00
Anuraag Agrawal 3d69aa19a8
Restore source/targetCompatibility declarations for intellij to set version correctly and remo… (#1920)
* Restore source/targetCompatibility declarations for intellij and remove animalsniffer for java 8.

* Newer syntax
2020-10-29 08:11:15 -07:00
Anuraag Agrawal ba1fabeb64
Hide Default* implementations behind interface factory methods. (#1904)
* Hide Default* implementations behind interface factory methods.

* Renames
2020-10-29 08:02:44 -07:00
Anuraag Agrawal 34953d5fee
Add MustBeClosed to Context.makeCurrent (#1914) 2020-10-29 11:36:46 +09:00
John Watson ed75175578
Add a method to the Baggage interface to return the current baggage in the context (#1913)
* 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
2020-10-29 11:07:08 +09:00
Anuraag Agrawal f83b9e4842
Remove leftover baggage spi package-info and add baggage propagation missing package-info. (#1905) 2020-10-28 07:34:04 -07:00
Anuraag Agrawal 7ebbe7979d
Move API packages to .api. package (#1892)
* Move API packages to .api. package

* Cleanup
2020-10-28 08:39:41 +09:00
Anuraag Agrawal 934c9ed8a3
Make OpenTelemetrySdk implement the OpenTelemetry interface and have SPI find it. (#1857) 2020-10-24 19:39:26 -07:00
Anuraag Agrawal a8975e83d4
Replace TracingContextUtils.currentContextWith with ImplicitContextKeyed.makeCurrent (#1855)
* Replace TracingContextUtils.currentContextWith with ImplicitContextKeyed.makeCurrent

* Dont add MustBeClosed this time since affects other code.
2020-10-24 19:38:24 -07:00
dengliming a4e23f9ed9
Span return `this` to enable chain calls (#1869)
* Span return `this` enable chain calls

* Fix spotlessCheck

* Keep return void in end method
2020-10-23 09:29:01 -07:00
Giovanni Liva d0785ff84f
Automatically generate Semantic Convention attributes (#1846)
* Automatically generate Semantic Convention attributes

* Fix checkstyle

* Transition to automatically generated class

* Pin to specific commit

* Move EXCEPTION_EVENT_NAME inside the template
2020-10-23 09:00:42 -07:00
John Watson e2f648da63
Add a toBuilder method to the Baggage (#1868)
* Add a toBuilder method to the Baggage to make it easy to amend baggage.

* formatting
2020-10-23 07:49:33 -07:00
Bogdan Drutu 185d10e395
Serialize the entire trace flags not only the sample bit (#1774)
* 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>
2020-10-23 13:33:41 +09:00
Anuraag Agrawal 23444d6e5c
Update google java format to 1.9 (#1854)
* Update google java format to 1.9

* Spotless

* Update Contributing.md
2020-10-23 12:47:10 +09:00
John Watson 14c2faf064
Simplify a call so that we don't have cycles in the TCU->Span call chain. (#1867) 2020-10-23 11:10:45 +09:00
Bogdan Drutu 52a6af86d4
Remove baggage sdk package, move tests to API (#1865)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-10-22 09:55:28 -07:00
Anuraag Agrawal ee03c5eabc
Remove unused BaggageManagerFactory SPI. (#1858) 2020-10-22 09:53:50 -07:00
Anuraag Agrawal 36a0339e15
Add a factory method for creating PropagatedSpan to allow auto-instrumentation to intercept the method. (#1859) 2020-10-22 08:39:28 -07:00
Anuraag Agrawal ed5136bcda
Move Span context accessors to Span static methods. (#1843)
* Move Span context accessors to Span static methods.

* Bad IDE

* More merge

* More merge
2020-10-21 20:02:58 -07:00
Anuraag Agrawal f5082d10f6
Context.with/get, AttributesBuilder/LabelsBuilder.set (#1838)
* Context.with, AttributesBuilder/LabelsBuilder.set

* put
2020-10-21 19:51:14 -07:00
Anuraag Agrawal 34e66a1175
Rename getContext to getSpanContext. (#1852) 2020-10-21 19:38:08 -07:00
Anuraag Agrawal ea1a0a0486
Rename OpenTelemetry interface methods to normal interface conventions. (#1842) 2020-10-21 19:21:57 -07:00
John Watson f3df455d2b
Make Baggage implement ImplicitContextKeyed and make the BaggageUtils.withBaggage non-public. (#1849) 2020-10-21 16:05:25 -07:00
Anuraag Agrawal 6544923215
Extract an interface for the OpenTelemetry API to later allow an SDK … (#1805)
* Extract an interface for the OpenTelemetry API to later allow an SDK to implement it.

* Cleanups

* mine

* final

* Fix shortcuts

* Fix javadoc

* More merge
2020-10-21 12:33:50 -07:00
John Watson e13e631847
Make the baggage API fully functional in the API (#1822)
* 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
2020-10-20 21:57:17 -07:00
Anuraag Agrawal ecdfc391f2
Add a ContextValue interface to allow Context.withValue(value) withou… (#1827)
* Add a ContextValue interface to allow Context.withValue(value) without a key.

* Assertions

* Renames
2020-10-20 19:26:54 -07:00
Christian Neumüller 9b73fb06fd
Fix non-null carrier not working in extract. (#1835) 2020-10-19 13:07:02 -07:00
John Watson 57097873c8
rename StatusCanonicalCode to StatusCode (#1804) 2020-10-15 17:55:05 -07:00
Bogdan Drutu b73a063901
Remove getCurrentContext and withSpan from Tracer (#1809)
* 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>
2020-10-15 10:58:41 -07:00
Anuraag Agrawal 2d0f91b538
Remove DefaultSpan from public API. (#1791)
* Cleanup

* Fix comment

* isValid not valid
2020-10-15 11:37:03 +09:00
Anuraag Agrawal 0ceff17dfa
Remove since tags until 1.0.0 (#1796)
* Remove since tags until 1.0.0

* Spotless
2020-10-14 09:29:27 -07:00
Anuraag Agrawal e2b5245d73
Rename newBuilder to builder for consistency. (#1790) 2020-10-13 13:17:06 -07:00
John Watson 939d1b8ddc
Baggage propagator first implementation (#1771)
* 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
2020-10-13 15:30:01 +09:00
Anuraag Agrawal 487e57ea11
Add constants for message operations which are defined by spec. (#1783) 2020-10-12 09:45:13 -07:00
Anuraag Agrawal 72e17bb2cc
Add a few missing package-info.java (#1776)
* Add a few missing package-info.java

* Spotless
2020-10-09 08:06:58 -07:00
John Watson 012da09027
Remove the method to parent via Baggage. (#1767)
* 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
2020-10-08 10:54:33 -07:00
John Watson 5f6c5bf297
Turn the Baggage metadata into a simple wrapper for a String. (#1764)
* 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
2020-10-08 10:34:52 -07:00
Anuraag Agrawal 78fd4d1c8f
Add package-info.java to all packages and ParamatersAreNonNullByDefault. (#1772) 2020-10-08 08:26:49 -07:00
Anuraag Agrawal fd49b3f65f
Migrate usage of gRPC context to OTel context. (#1751) 2020-10-07 11:19:49 -07:00
dengliming 1a7396413a
Fix specification link in SemanticAttributes.java (#1763)
* Fix specification link in SemanticAttributes.java

* Update link
2020-10-06 10:17:44 -07:00
Bogdan Drutu 6c660d92e5
Add overload for setStatus without description, fix usages (#1754)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-10-05 09:05:46 -07:00
Bogdan Drutu eb4a18febc
Remove Status object from API, keep StatusCanonicalCode (#1741)
* Remove Status object from API, keep StatusCanonicalCode

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

* Respond to comments, change more old usages

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

* Fix build, run gojf

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-10-05 11:33:40 +09:00
Ioannis Mavroukakis 42cdff446c
subsume methods from AttributesKeys to AttributeKey (#1743)
* subsume methods from AttributesKeys to AttributeKey

* remove missed instance of AttributesKeys

* make javadoc wording more representative of method intent
2020-10-04 10:41:37 -07:00
Bogdan Drutu 50a8fbff30
Remove unnecessary methods from api/internal (#1747)
* Remove unnecessary methods from api/internal

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

* Make sdk/StringUtils package protected

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-10-04 09:50:34 -07:00
Bogdan Drutu b93d1a4d55
Remove Link from API, use SpanData.Link in Sampler (#1739)
* 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>
2020-10-02 10:42:22 -07:00
dengliming 71ba8e1b87
Use the concise license header without the year (#1623)
* Use the concise license header without the year

* Use the concise license header without the year
2020-10-02 22:42:53 +09:00
Bogdan Drutu 391043fa1f
Remove redundant type argument conversion (#1734)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-10-01 18:41:56 -07:00
Bogdan Drutu 790018f004
Remove addLink that accepts Link interface (#1732)
* 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>
2020-10-01 18:24:02 -07:00
Bogdan Drutu b78fbb31fa
Remove Event interface, and it's usage (#1733)
* 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>
2020-10-02 10:05:28 +09:00
John Watson 231ca02400
Make setting null-valued attributes a no-op, and document that their behavior is undefined. (#1706)
* 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>
2020-09-30 08:08:32 -07:00
Sergei Malafeev c577ee17f7
check traceparent for extra trailing characters for version 00 (#1727)
* 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>
2020-09-30 08:01:46 -07:00
John Watson 287eae9e5c
Update for the more restricted span status codes. (#1701)
* Update for the more restricted span status codes.

* Update status codes to match the proposed proto codes
2020-09-28 10:42:44 -07:00
Nikita Salnikov-Tarnovski e7706d63f9
Fix type for REDIS_DATABASE_INDEX semantic attribute (#1720) 2020-09-28 08:31:55 -07:00
Anuraag Agrawal 8b7ea5e366
Add overrides to allow using a long key with an int value. (#1713) 2020-09-27 12:54:24 +09:00
Bogdan Drutu 840ae850ec
Rename CorrelationContext with Baggage (#1691)
* Rename CorrelationContext with Baggage

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

* Fix review comments

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

* Rename contextBuildet to baggageBuilder

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-09-26 08:42:01 -07:00
John Watson 12af6d9fdf
Change the default Propagator in the API to be a no-op (#1709) 2020-09-26 08:34:19 -07:00
Christian Neumüller 83b9ba5701
Implement spec change to only accept Context as span parent. (#1611)
* Prototype for Context as span parent.

* Simplify ZipkinSpanExporterEndToEndHttpTest.

* Minimize PR diff.

* Make Codecov happy.

* Fix overcomplicated DefaultTracer.

* Fix build after merge.

* Fix build after merge.

* Revert storage of full Context.

* Lint.

* Clean up OpenTracing SpanBuilderShim.

* Rename Context -> RequestHandlerContext in testbed.
2020-09-25 11:37:37 +09:00
Sergei Malafeev 5498ab2b82
validate version from traceparent according to spec (#1688)
* #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>
2020-09-25 09:05:29 +09:00
Bogdan Drutu 3d72a7d86d
Avoid usage of getSpanWithoutDefault when possible. (#1690)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-09-24 15:17:12 +09:00
Bogdan Drutu 2d146bbbb9
Remove constant labels from instruments and MetricData (#1692)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-09-24 15:14:04 +09:00
Christian Neumüller d9bd619b55
Add exception.escaped, clean up exception attributes javadoc. (#1672) 2020-09-23 08:50:49 -07:00
John Watson 136d5b9b7f
Make the getKey method non-nullable (#1682)
This was done by tricking AutoValue with a separate field for the storage.
2020-09-22 21:30:23 -07:00
Jason Plumb cfbe6bfe81
Rename dangling references to MeterRegistry (#1683)
* rename getMeterRegistry() to getMeterProvider() in javadocs.

* rename meterRegistry variable to meterProvider

* reformat
2020-09-22 19:37:47 -07:00
John Watson bd51a606a7
Remove the obsolete HTTP_STATUS_TEXT semantic attribute. (#1679) 2020-09-22 10:52:37 -07:00
John Watson 4f613da552
Reverse the precedence on Labels and Attributes to prefer the last one added, rather than the first. (#1656)
* 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
2020-09-21 15:58:03 -07:00
John Watson bf52c0af73
Implement the keyed-attributes proposal (#1631)
* 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
2020-09-21 08:52:40 -07:00
John Watson 27090b8336
Switch to java 8 (#1665)
* 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.
2020-09-19 11:28:13 +09:00
Giovanni Liva 2f9443b3eb
Case-insensitive names for metric instruments (#1643)
* Fix case-insensitive

* s/NAME_MAX_LENGTH/METRIC_NAME_MAX_LENGTH
2020-09-16 16:31:42 +09:00
John Watson ddb38970fa
Move the TraceFlags isSampled boolean into the SpanContext (#1628)
* 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>
2020-09-14 09:28:08 -07:00
Anuraag Agrawal 751177f6f1
Add FaaS attributes. (#1634)
* Add FaaS attributes.

* Move to javadoc
2020-09-11 10:55:07 -07:00
John Watson d42d4cd9e2
Add a generic type for the key on the ImmutableKeyValuePairs. (#1619)
* 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
2020-09-08 19:18:58 -07:00
Sergei Malafeev f13fd58d25
#1372 Have Propagators expose only a singleton instance (#1622)
Signed-off-by: Sergei Malafeev <sergei@malafeev.org>
2020-09-07 10:47:05 -07:00
John Watson 485cc52c6f
SpanContext hides the TraceId/SpanId implementations (#1594)
*  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>
2020-09-03 10:03:41 -07:00
Christian Neumüller 8418753af7
Fix noParent being ignored after explicit parent. (#1617) 2020-09-02 10:28:44 -07:00
dengliming ed08e9f287
Add an overload to the recordException method to support additional attributes (#1599)
* Add an overload to the recordException method to support additional attributes

* Fix Codecov

* Fix review

* Fix review
2020-08-28 12:41:36 -07:00
Sergei Malafeev 88582202c4
Rename 'HttpTextFormat' to 'TextMapPropagator' (#1586)
* #1581 Rename 'HttpTextFormat' to 'TextMapPropagator'

Signed-off-by: Sergei Malafeev <sergei@malafeev.org>

* fix long line

Signed-off-by: Sergei Malafeev <sergei@malafeev.org>

* add change log entry

Signed-off-by: Sergei Malafeev <sergei@malafeev.org>

* add change log entry

Signed-off-by: Sergei Malafeev <sergei@malafeev.org>
2020-08-26 08:19:48 -07:00
John Watson 1175997dd1
Remove two unused internal methods. (#1591) 2020-08-25 21:06:31 -07:00
dengliming bea5492e6d
Create a static method on Attributes to create an Attributes builder from ReadableAttributes (#1578)
* Create a static method on Attributes to create an Attributes builder from ReadableAttributes

* Fix review
2020-08-24 07:47:55 -07:00
John Watson 79b6f0e14c
Update the TraceState key validations to more closely match the w3c spec (#1561)
* 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
2020-08-23 09:52:45 -07:00
Mateusz Rzeszutek 3a8ed95bcd
Implement thread.id and thread.name semantic attributes (#1554)
See https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/semantic_conventions/span-general.md#general-thread-attributes
2020-08-19 08:36:49 -07:00
Giovanni Liva 792f0f452b
Update Attributes API to comply the spec (#1437)
* Forbit null values

* Simplify code and better naming

* Fix error prone error

* Uniform null handling

* Improve tests for SpanAttributes

* Improve tests for Resource Attributes

* Change interface of AttributeValue

* isEmpty overrided only when necessary

* Update Attributes API

* Remove unused code

* Rename method

* Address PR feedback

* fix javadoc
2020-08-18 12:03:32 -07:00
Giovanni Liva 4a0ca4b9fc
Update android API text (#1544) 2020-08-17 07:53:34 -07:00
pjan vandaele 41504596c1
Fixes Name of Cassandra Keyspace attribute key (#1542) 2020-08-17 07:48:43 -07:00
dengliming 36abf5fd27
Add convenience methods for when empty labels are used. (#1538)
* Add convenience methods for when empty labels are used.

* Fix review
2020-08-17 07:47:28 -07:00
Anuraag Agrawal 857b004603
Clarify timestamps of events in javadoc. (#1540)
* Clarify timestamps of events in javadoc.

* Spelling
2020-08-14 07:46:50 -07:00
Anuraag Agrawal 8a95b34308
Add Attributes.toBuilder (#1516)
* Add Attributes.toBuilder

* Add tests that original instance not mutated.
2020-08-10 19:02:47 -07:00
Anuraag Agrawal c930e033f8
Return Span from DefaultSpan factories. (#1519) 2020-08-10 13:04:19 -07:00
Anuraag Agrawal 05f336fb4a
Update to latest RPC semantic attributes. (#1520) 2020-08-07 16:17:43 +02:00
Anuraag Agrawal 8d0a4787ff
Migrate from Truth to AssertJ (#1493)
* Migrate from Truth to AssertJ

* Fix test

* Update andAndUpdate
2020-08-03 17:08:36 -07:00
Nikita Salnikov-Tarnovski 70e84334c0
Add new configuration option to limit the size of string attribute values (#1484)
* Add new configuration option to limit the size of string attribute values

* Polish

* Polish

* Polish

* Polish

* Add benchmark.

* Format

* Format
2020-08-03 08:11:58 -07:00
Anuraag Agrawal 6dffbb8fc4
Migrate tests to JUnit5 (#1489)
* Add JUnit 5 dependency

* Revert unintended
2020-07-31 11:10:27 -07:00
Anuraag Agrawal 8005c7eddd
Return a readable tostring for attribute setters. (#1470) 2020-07-27 13:39:43 +02:00
Helen Y 8525405239
Update database attributes (#1459)
* Add new database attributes

* Address comments

* Update javadoc and rename

* Update javadoc for Cassandra.

Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>

* Rename Cassandra constant.

Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>

* Apply GoogleJavaFormat

* Fix javadoc exception

* Delete db.url

Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>
2020-07-24 13:33:53 -07:00
Anuraag Agrawal f816ad5733
Implement Span.recordException (#1434)
* Implement Span.recordException

* License

* javadoc

* Fix javadoc

* Tests for DefaultSpan

* PrintStream benchmark

* Check arguments

* Use StringWriter

* more merge and event name

* Remove timestamp recordException
2020-07-22 18:53:26 -07:00
Giovanni Liva 88da16e3ed
Forbid empty/null keys (#1440) 2020-07-22 16:20:44 +02:00
Anuraag Agrawal 498b245c57
Add version of attribute setters that operate on Attributes. (#1446) 2020-07-21 20:00:31 -07:00
John Watson af54bee5d8
Return Invalid Spans from the no-op Tracer when there is no SpanContext (#1386)
* return an invalid span from the no-op tracer, rather than a random span, when there is no span context.

* add a test to verify that no context means an invalid span
2020-07-21 19:26:26 -07:00
John Watson 73d8edcf39
Change numeric attributes to be numeric (#1443) 2020-07-21 19:19:38 -07:00
Anuraag Agrawal f5452f4f2b
Remove null checks in Span API. (#1433)
* Remove null checks in Span API.

* Add tests and loosen events as well.
2020-07-20 19:00:13 -07:00
Anuraag Agrawal 1b0f20d647
Reuse char[] when constructing trace context header for injection. (#1432)
* Reuse char[] when constructing trace context header for injection.

* Spotless

* License
2020-07-20 09:06:56 -07:00
Carlos Alberto Cortez 2f204c2bb0
Add overloads for setParent(Context context). (#1262)
* Add overloads for setParent(Context context).

* Fix the original version.

* Apply feedback.

* Update version for CorrelationContext.

* Add simple extra test for DefaultCorrelationContextManagerTest.
2020-07-17 08:42:01 -07:00
Nikita Salnikov-Tarnovski 2ec91e1763
Add semantic attributes for messaging (#1410) 2020-07-14 15:07:10 +02:00
John Watson e1ddcaec24
update errorprone, grpc and autovalue (#1403)
Also, clean up new errorprone warnings
2020-07-12 07:56:44 -07:00
Anuraag Agrawal f7b7681610
Don't allow null error messages and some cleanup (#1404) 2020-07-10 08:32:12 -07:00
John Watson 7ca698f845
Add a toBuilder method to Labels (#1399)
* Add a toBuilder method to Labels

* add a toString to the pairs, for debugging/testing

* tweak the toString implementation to match that of Map
2020-07-09 08:36:23 -07:00
Carlos Alberto Cortez 890ba28fbc
MultiTracePropagator implementation (#1339) 2020-07-01 19:14:21 +02:00
Anuraag Agrawal 50a424c4b4
Add semantic attribute for peer.service (#1379) 2020-06-30 09:35:47 -07:00
Anuraag Agrawal 35eb6411e9
Add semantic attributes for HTTP content length. (#1376) 2020-06-26 13:56:03 +02:00
John Watson 24b4be90c3
Convert CorrelationContext entry keys and values to simple Strings (#1363)
* convert CC entry keys and values to simple Strings

* fix broken javadoc
2020-06-22 14:37:21 -07:00
Bogdan Drutu d02667929b
Change instrument operations to use immutable Labels (#1358)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-06-18 13:48:39 -07:00
Tyler Benson b685eab4fa
Fix OpenTelemetry since versions. (#1359)
These API's weren't added until 0.5.0.
2020-06-18 21:52:15 +02:00
Bogdan Drutu 4633676593
Use lambda references where possible (#1355)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-06-18 11:54:14 -07:00
Bogdan Drutu 42cdd7ed3d
Use the new immutable Labels for Bind (#1354)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-06-18 11:53:41 -07:00
Nikita Salnikov-Tarnovski 46f0c5f0b7
Extension packages should not use "internal" API package (#1342)
* Extension packages should not use "internal" API package

Add InternalApiProtectionTest which uses ArchUnit to enforce architectural constraints.
This change only verifies that classes in `extensions` packages do not use classes in `internal` package of API module.

Test was added into `opentelemetry-all` module because the latter depends on all other submodules
and therefore sees all classes in the project.

* Polish

* Polish
2020-06-18 09:10:18 -07:00
Bogdan Drutu 76ef38955a
Start using real java8 in tests. (#1352)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-06-18 09:09:28 -07:00
Bogdan Drutu b734e366ec
Change to use labels for async instruments (#1349)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-06-17 17:22:32 -07:00
John Watson 922891cfed
fix compiler error about lambdas (#1346) 2020-06-17 14:35:39 -07:00
Bogdan Drutu 2312932a76
Add a ReadableKeyValuePairs and make ReadableAttribute a simple sub-interface (#1340)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-06-17 11:05:43 -07:00
jarebudev 22f5b1a15b
use java 8 for tests (#1237)
* use java 8 for tests, and disabled specific errorprone checks for tests

* modified existing test to use java 8 features

* updated contributing doc
2020-06-17 11:05:27 -07:00
John Watson fccc6d9bc3
Convert the usages of the LabelSetSdk to use the Labels class. (#1338) 2020-06-17 10:43:11 -07:00
John Watson f1f5975d5c
Introduce an ReadableAttributes interface, with 2 implementations (#1336)
* Introduce an Attributes interface and have ImmutableAttributes and the AttributesMap implement it.

* make the attribute limiting a little clearer.

* tiny javadoc fix

* Rework to restore the Attributes class, and introduce a ReadableAttributes interface

* polish the javadoc a bit

* fix some broken javadoc

* revert example change; revert test name change

* javadoc de-escalation

* fix bad merge
2020-06-17 09:29:52 -07:00
John Watson 7644ef4d56
Convert SpanData to use immutable Attributes (#1330) 2020-06-15 17:51:49 +02:00
Nikita Salnikov-Tarnovski 546867b1ff
Allow setting semantic attributes on Span.Builder (#1317)
* Allow setting semantic attributes on Span.Builder

* Make test actually verify something
2020-06-10 12:53:09 -07:00
John Watson d80bd1ad67
Convert Link and Event types to use the new immutable Attributes (#1325)
* Convert Link and Event types to use the new immutable Attributes

update from the upstream branch

update from parent branch changes

* move the limiting of attributes to a custom consumer class
2020-06-10 12:13:57 -07:00
John Watson ee435201b5
Immutable Attributes and Labels (#1304)
* prototype for class to replace Map<String, AttributeValue)

* safely copy the builder's data

* add the empty constant

* optimization for attributes with a single key/value

* Add an iterator/iterable and some simple tests

* fix animalsniffer complaint

* tests for de-duping and order-independent equality, plus removal of possibly unneeded access methods.

* clean up the sort&filter method a tad

* replace the iterator with a foreach method

* Make the Attributes parameterized by the value type.

* Add basic javadoc

* remove helper class; add a simple test for the builder; make the tests more robust

* Add a varargs method for creating an arbitrary number of key/value pairs.

* static import the check method, for consistency

* Refactor to have an interface and two implementations, with some shared logic.

* fix an accidental rename

* really fix it for real

* add a few more tests

* preserve the `setAttribute` names from existing Span API

* Replace the treemap sorting and filtering with a quicksort and post-filter.

* remove an unneeded list.

* switch to an abstract base class to remove some code duplication

* Updated docs based on feedback.

* Small change to use the builder for the empty implementations.
2020-06-08 17:16:39 -07:00
Bogdan Drutu afabbd1e06
Remove duplicate Result interfaces (#1312)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-06-05 14:37:50 -07:00
Shivkanya Andhare b68b994b6c
Fix:spelling mistakes (#1294)
* Fix:spelling mistakes

* Fix:spelling mistakes
2020-05-31 15:49:32 -07:00
Carlos Alberto Cortez dbf365c978
Do not inject invalid SpanContext instances. (#1285) 2020-05-29 08:57:31 -07:00
Bogdan Drutu 833c30af98
Do not allow adding attributes, links after startSpan. (#1266)
* Do not allow adding attributes, links after startSpan.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

* Add tests for edge cases

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-05-26 06:47:24 -07:00
shivkanya9146 ff4d055655
Fix:Spelling mistake (#1270) 2020-05-25 14:16:40 -07:00
Bogdan Drutu 84f5a3eab0
Add API for ValueObserver (#1265)
* Add API for ValueObserver

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

* Address feedback

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-05-22 06:32:06 -07:00
John Watson ccb99f1c4c
change the naming of the SPI provider classes to be less confusing and line up with the auto-instrumentation project (#1261) 2020-05-21 14:05:01 -07:00
Bogdan Drutu 33b33c17f9
Add more tests for the metrics API (#1251)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-05-20 06:30:24 -07:00
Bogdan Drutu 6d2a8a6f54
Remove check for non-negative values in ValueRecorder (#1247)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-05-19 16:02:18 -07:00
Bogdan Drutu 8a1a241efa
Rename Measure to ValueRecorder, fix comments and javadoc (#1243)
* Rename Measure to ValueRecorder, fix comments and javadoc

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

* Fix more legacy javadoc

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

* Address feedback

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-05-19 11:31:16 -07:00
John Bley 49f271f3a1
Correct spelling of key/file for the TraceProvider service lookup. (#1240)
* Correct spelling of key/file for the TraceProvider service lookup.

* More name fixing.

* Java Format.
2020-05-18 08:26:51 -07:00
Bogdan Drutu 317ccbc393
Add API for UpDownSumObservers (#1220)
* Add API for UpDownSumObservers

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

* Fix minor nits

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

* Fix more nits

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-05-15 12:07:12 -07:00
Bogdan Drutu 019c4dbe19
Add a Builder in the SynchronousInstrument (#1221)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-05-15 09:06:08 -07:00
Bogdan Drutu f9c054c3c5
Remove absolute property from measure (#1219)
* Remove absolute property from measure

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

* Fix tests

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-05-14 12:25:55 -07:00
Bogdan Drutu fcd627d717
Rename observers, cleanup comments (#1215)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-05-13 11:43:07 -07:00
Bogdan Drutu e67fe84c60
Add API for UpDownCounter (#1210)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-05-13 10:00:09 -07:00
Bogdan Drutu 5b625d2e1f
Avoid unnecessary public classes. (#1211)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-05-13 08:20:32 -07:00
Bogdan Drutu 5b31c5ae0c
Remove monotonic property from counters (#1208)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-05-12 16:43:47 -07:00
Bogdan Drutu 5dff1b9165
Remove unnecessary throws statements (#1205)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-05-12 10:54:16 -07:00
Bogdan Drutu 7aec1aee71
More minor cleanups in the code (#1204)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-05-12 10:00:51 -07:00
Bogdan Drutu 4d2f6cc91d
Cleanup names in metrics and ensure consistency with specs (#1202)
* Cleanup names in metrics and ensure consistency with specs

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

* Rename SyncInstrument to SynchronousInstrument

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

* Update api/src/main/java/io/opentelemetry/metrics/SynchronousInstrument.java

Co-authored-by: John Watson <jkwatson@gmail.com>

Co-authored-by: John Watson <jkwatson@gmail.com>
2020-05-12 09:50:02 -07:00
Bogdan Drutu bcacf39a9c
Apply intelij inspect suggestions for Java code (#1196)
* Apply intelij inspect suggestions for Java code

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

* Fix comments.
2020-05-11 16:54:39 -07:00
Giovanni Liva cd041c9d30
Fix getTracerLower behavior (#1193)
* Fix getTracerLower behavior

* Add test for negative trace representation
2020-05-11 11:21:14 -07:00
Gregor Zeitlinger ebcd508a88
add shortcut methods to get tracers and meters (#1159)
* add shortcut methods to get tracers and meters

* add shortcut methods to get tracers and meters

* add shortcut methods to get tracers and meters

* add shortcut methods to get tracers and meters
2020-05-06 11:30:33 -07:00
Armin Ruech 19d7e03572
Fix typo in OpenTelemetry.getTracerProvider (#1179) 2020-05-06 08:48:41 -07:00
Trask Stalnaker 79d664fc10
Prevent casting to TraceProviderSdk (#1152)
* Prevent casting to TraceProviderSdk

* Fix javadoc

* Parameterize Obfuscated interface
2020-05-01 12:12:12 -07:00
Uladzislau Kiva 5aa00c57c3
Iterations benchmark (#1151)
* test: use iterations in benchmarks

* test: use iterations in benchmarks

* docs: added javadoc
2020-04-28 11:33:45 -07:00
Giovanni Liva 4bcfdb703f
Array values for span attributes (#807)
* [API] - Add Arrays for span attributes

* [SDK] - Add Arrays for span attributes

* [Exporters/Shim] - Add Arrays for span attributes

* add tests

* Adjust jaeger exporter to specification. Add tests.

* Fix checkstyle naming issue

* Add further tests.

* Align null value behavior of attributes with spec

* fix javadoc @since

* API must not crash on misusage of AttributeValue

* API - Remove Attribute ArrayValues from Span surface

* Immutable String array values for AttributeValue

* Immutable values for AttributeValue arrays

* ./gradlew goJF

* Implement ArrayAttribute

* Rebase and add tests

* Adapt RecordEventsReadableSpan
2020-04-21 11:08:24 -07:00
Bogdan Drutu 6a4fd2d46a
Remove labels keys from instruments (#1121)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-04-20 09:24:45 -07:00
Carlos Alberto Cortez 36661f1a06
Update the Jaeger benchmarks code. (#1118) 2020-04-15 18:40:43 -07:00
jarebudev a19b0075fb
Add jaeger propagator benchmarks (#1108) 2020-04-16 00:55:27 +02:00
Bogdan Drutu e11344c235
Fix HttpTraceContext propagator (#1102)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-04-11 16:31:01 -07:00
Carlos Alberto Cortez 68bac8f431
Move B3/Jaeger propagators to their own contrib artifact (#1098) 2020-04-10 18:03:09 +02:00
John Watson 73858ccf7b
Let the carrier be null on the inject methods, to support possible lambda usages (#1088) 2020-04-09 22:23:26 +02:00
John Watson 8b0fcfbc99
simple benchmarks for the default tracer APIs (#1090)
* simple benchmarks for the default tracer APIs
* do some painful gyrations to make the animalsniffer happy
2020-04-08 14:05:10 -07:00