Commit Graph

532 Commits

Author SHA1 Message Date
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
John Watson 7d4576e7f7
Use a reentrant lock as the mutex for initializing/reading the global instance (#1071) 2020-04-03 21:59:49 +02:00
John Watson 5ceff22cc6
fix a typo in the SemanticAttributes (#1078) 2020-04-03 20:34:49 +02:00
jarebudev b14a2dd87d
added jaeger propagator and tests (#1046)
* added jaeger propogator and test

* address PR comments about logging and static var names

* added jaeger client for testing jaeger propagator

* added comment to explain why UTF-8 decoding is needed
2020-04-02 08:27:36 -07:00
Bogdan Drutu 1f97c4bce0
Small fixes for #758 (#1057)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-03-30 21:33:19 -07:00
Kevin Brockhoff 46ee284b0a
Define constants for semantic convention attribute names (#758)
* Initial def of string constants for semantic convention span attribute names

* Change to recommended name and update to latest specifications

* Changed constants to objects which enabled typed setting of span attributes

* Sync Javadoc with specifications document.

* Update to latest factory name

* Renaming to make usage clearer

* API improvements and cleanup based on PR comments

* Removed methods required by code reviews

* Made setter classes final
2020-03-30 15:41:17 -07:00
Carlos Alberto Cortez 690651b65a
Context propagation update (OTEP 66) (#720)
* Initial Propagators refactor.

* Add tests for the new propagators changes.

* Make the SDK compile/pass.

* Make the OT shim compile/pass.

* Make contrib components compile/pass.

* Improvement over Span/SpanContext handling in Context.

* Add Span.setParent(Context) overload.

* Do not provide default values for Span/SpanContext keys in Context.

* Improve the Context's active state handling.

* Rename DistributedContext to CorrelationContext.

* Improve names for correlationcontext's ContextUtils methods.

* Don't provide an automatic default for current CorrelationContext.

* Improve the client-server example after the recent changes.

* Adds CorrelationContext.Builder.setParent(Context) overload.

* s/be/become.

* Fix javadoc.

* No need to use diamond.

* Simply import withScopedContext().

* Fix the API/SDK build.

* Remove the builder from the Propagators interface.

* Fix name.

* Use Collections.emptyList() directly.

* Rename Propagators to ContextPropagators.

* Move context/ members in api/ to context_prop/

* Add check/tests for null scoped Contexts.

* Rename ContextUtils classes to better alternatives.

* Update the context* util classes.

* Make the code compile after the latest master merge.

* Cache the fields() in our default composite propagator.

* Remove the overloads of setParent(Context) for now.

* Use DefaultSpan for the tests instead of calling getTracerProvider()

* Fix the sdk testbed artifact build.

* Make the B3 propagator comply with the new propagator API.

* Simplify the HttpTraceContextTest tests.

* Simplify the ContextUtils* classes handling of default values.

* Minor nit.

* Update api/src/main/java/io/opentelemetry/OpenTelemetry.java

Co-Authored-By: Giovanni Liva <giovanni.liva@dynatrace.com>

* Annotate ContextPropagators with ThreadSafe instead of Immutable.

* Do not use the fully qualified ContextUtils identifier.

* Remove SpanContext support from TracingContextUtils.

* Rever to using non-defaulted key for TracingContextUtils.

* Revert the default keys for CorrelationsContextUtils.

Co-authored-by: Giovanni Liva <giovanni.liva@dynatrace.com>
2020-03-20 13:38:05 -07:00
John Watson 8453bcb14a
Remove LabelSet from the API altogether. (#1023)
* remove LabelSet from the API surface altogether

* rename bindInternal to bind
2020-03-16 16:07:18 -07:00
John Watson 29297249ab
remove LabelSet from the Instrument binding API (#1010) 2020-03-16 13:38:10 -07:00
John Watson e248ea7ad7
Remove LabelSet from Observer API (#1008)
* Remove the LabelSet parameter on the DoubleCounter non-bound usage.

* remove LabelSet from the Observer API
2020-03-13 09:33:34 -07:00
John Watson 4d2a9f2bde
remove LabelSet from the BatchRecorder API. (#1006)
also removes a few more usages of the LabelSet interface.
2020-03-13 08:41:04 -07:00
Carlos Alberto Cortez 0ec6cca453
Rename the Context methods returning Scope as withCurrentContextWith() (#976) 2020-03-12 12:55:15 -07:00
John Watson efc49522ac
Remove LabelSet from non-bound instrument usage (#1001)
* Remove the LabelSet parameter on the DoubleCounter non-bound usage.

* remove non-bound labelset measure recording method

* remove non-bound labelset LongMeasure recording method

* remove non-bound labelset LongCounter recording method

* tidy up an access level
2020-03-12 12:54:43 -07:00
Mike Goldsmith 577bab0032
move AttributeValue to common package (#1005) 2020-03-12 12:54:00 -07:00
Mike Goldsmith 438ea8d24a
Add B3 propagator (#979) 2020-03-12 16:53:24 +01:00
Bogdan Drutu 4c7072a1e4
Add javadoc link to all readmes (#981)
Signed-off-by: Bogdan Cristian Drutu <bogdandrutu@gmail.com>
2020-03-09 14:32:22 -07:00
Bogdan Drutu 2080fe196c
Remove generic usage in the metrics API (#956)
Signed-off-by: Bogdan Cristian Drutu <bogdandrutu@gmail.com>
2020-03-09 14:31:55 -07:00
Carlos Alberto Cortez 1d913cb639
Initial relocation of ContextUtils classes. (#904)
* Initial relocation of ContextUtils classes.

Now they will live within the child `propagation` package,
with a prefix based on their cross-cutting concern, to be
referenced easily.
2020-03-08 18:34:46 +01:00
John Watson 6ca3d1deaf
Add missing thread safety & immutable annotations in the API. (#972) 2020-03-06 20:02:09 +01:00
Bogdan Drutu 01189f34c9
Add private ctor for singleton classes. (#957)
Signed-off-by: Bogdan Cristian Drutu <bogdandrutu@gmail.com>
2020-03-04 11:53:59 -08:00
Bogdan Drutu a395039e4f
Add default service provider for CorrelationContextManager. (#960)
Signed-off-by: Bogdan Cristian Drutu <bogdandrutu@gmail.com>
2020-03-04 10:38:31 -08:00
Carlos Alberto Cortez 26a4070d90
Remove Binary format and related members. (#891) 2020-03-03 08:47:41 -05:00
Uladzislau Kiva 43b59451ab
refactor: name method's according to return value and https://github.com/open-telemetry/opentelemetry-java/blob/master/QUICKSTART.md#tracing (#953) 2020-02-29 08:28:26 -08:00
Bogdan Drutu 1f202a95ea
Cleanup jmh and trace context benchmarks (#920)
Signed-off-by: Bogdan Cristian Drutu <bogdandrutu@gmail.com>
2020-02-24 13:56:58 -08:00
Bogdan Drutu 8c9f928340
Remove the exclusion of TestExceptionRefactoring from errorprone config. (#919)
Signed-off-by: Bogdan Cristian Drutu <bogdandrutu@gmail.com>
2020-02-24 11:36:35 -08:00
Bogdan Drutu 30e3bc8c63
Fix build after race condition between PRs merge (#917)
Signed-off-by: Bogdan Cristian Drutu <bogdandrutu@gmail.com>
2020-02-24 11:31:00 -08:00
Bogdan Drutu 5a09b818d9
More gradle cleanups (#910)
* More gradle cleanups, separate jmh and jmhreport config

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

* Remove the need to includ jmhreport

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

* Only projects with the plugin maven-publish will be published

Signed-off-by: Bogdan Cristian Drutu <bogdandrutu@gmail.com>
2020-02-24 09:58:04 -08:00
John Watson f37f5dc8ac
Make the HttpTraceContext be more forgiving in the face of invalid data. (#899) 2020-02-24 18:38:46 +01:00
Bogdan Drutu a148263597
Switch to use pluginManagement, Use gradle plugin for jmh. (#903)
* Switch to use pluginManagement, Use gradle plugin for jmh.

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

* Fix jmh report

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

* Use ' for the moment for plugin ids in main gradle
2020-02-21 10:19:51 -08:00
Uladzislau Kiva 1c7da07432
feat: make invalid span context public (#896) 2020-02-20 22:05:59 +01:00
Giovanni Liva b0d42dd4cc
Rename TracerRegistry -> Tracer Provider (#879)
* Rename TracerRegistry -> Tracer Provider

* Add comment to address the provider name

* gradlew goJF
2020-02-20 07:26:13 -08:00
Giovanni Liva 7d51abc5f9
Move metric check for name length (#893) 2020-02-20 07:24:06 -08:00
Carlos Alberto Cortez f4dea297be
Use Collections.emptyList() directly. (#892) 2020-02-19 21:27:23 -08:00
Bogdan Drutu 9e1882f06a
Fix errorprone errors and re-enable errorprone for jmh (#887)
Signed-off-by: Bogdan Cristian Drutu <bogdandrutu@gmail.com>
2020-02-19 10:57:16 -08:00
Giovanni Liva edbee8a19c
align valid metric names with spec (#877) 2020-02-19 08:11:02 -08:00
Uladzislau Kiva 1fced4898f
Http trace context benchmark (#815)
* test: add benchmarks for http trace context extract and inject

* test: add benchmarks for http trace context extract and inject

* docs: add docs

* style: apply google code style

* style: format jmh.gradle, use not deprecated archiveFileName

* test: add params for trace id and span id

* fix: fix merge conflicts

* feat: use HashMap move params to inner state

* feat: use same measurement params

* fix: apply google code style

* fix: extract span creation for more clear benchmark

* test: use vector of traceparents, increase iterations to 50k

* style: apply google code style

* feat: use vector of traceparents in inject benchmark
2020-02-18 14:36:06 -08:00
Giovanni Liva 9ae05f77b0
Rename MeterRegistry -> MeterProvider (#870)
* Rename MeterRegistry -> MeterProvider

* Remove extra code for independent PR

* Address review comments
2020-02-18 10:36:19 -08:00
John Watson 1e7239e74c
add the missing enclosing interface (#854) 2020-02-13 08:58:40 -08:00
John Watson 96cd311b87
Add a labelset to the creation of the batch recorder (#844)
* add a labelset to the creation of the batch recorder.

* add a tiny additional comment on the javadoc
2020-02-12 09:19:57 -08:00
John Watson 0014fff95b
Add counters to the batch recorder. (#838)
* Add counters to the batch recorder.
Also, allow non-monotonic batch recordings.

* remove the throws on the javadoc

* put the proper since tags on the new methods

* remove an import that seems only necessary for IDEA

* formatting
2020-02-11 06:27:32 -08:00
Bogdan Drutu e7be01474a
Move unbind to the Bound to simplify usage (#834)
* Move unbind to the Bound to simplify usage

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

* Change names to be English friendly

Signed-off-by: Bogdan Cristian Drutu <bogdandrutu@gmail.com>
2020-02-07 12:57:39 -08:00
Bogdan Drutu 2dd7612477
Remove guage from the API. (#830)
Signed-off-by: Bogdan Cristian Drutu <bogdandrutu@gmail.com>
2020-02-07 07:20:41 -08:00
Giovanni Liva 54b5b2eff1
Fix API doc (#825) 2020-02-06 10:50:02 -08:00
Bogdan Drutu 7365426d85
Add @ThreadSafe annotation to Bounds (#820)
Signed-off-by: Bogdan Cristian Drutu <bogdandrutu@gmail.com>
2020-02-04 19:24:03 -08:00
Bogdan Drutu c2843a1c6d
Rename MeasureBatchRecorded to BatchRecorder (#817)
Signed-off-by: Bogdan Cristian Drutu <bogdandrutu@gmail.com>
2020-02-04 16:13:56 -08:00
Bogdan Drutu c19174ee53
Rename Tracestate to TraceState (#816)
* Rename Tracestate to TraceState

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

* More renames

Signed-off-by: Bogdan Cristian Drutu <bogdandrutu@gmail.com>
2020-02-04 15:34:19 -08:00
Armin Ruech 5485e18280
Remove incorrect `@throws NullPointerException` in AttributeValue (#808) 2020-01-30 09:59:28 -08:00
Uladzislau Kiva 8b4c1488e9
Solves #767 HttpTraceContext should not throw exceptions for non-fatal cases (#782)
* fix: HttpTraceContext::extract() fails on traceparent == null (#767)

* fix: HttpTraceContext::extract() fails on traceparent == null (#767)

* fix: HttpTraceContext::extract() fails on traceparent == null (#767)

* docs: add an

* refactor: use invalid span context from HttpTraceContext

* style: apply google code style

Co-authored-by: Uladzislau Kiva <vladislav.kiva@moneyman.ru>
2020-01-29 13:38:23 -08:00
Armin Ruech db31f4a796
Rename StringUtils.isNullOrBlank to isNullOrEmpty (#806) 2020-01-29 10:29:11 -08:00
Bogdan Drutu d4cf312671
Rename spi providers to match {}Provider name (#800)
Signed-off-by: Bogdan Cristian Drutu <bogdandrutu@gmail.com>
2020-01-28 10:23:40 -08:00
Bogdan Drutu 01aece01a1
Remove bound support from Observers (#799)
* Remove bound support from Observers

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

* fix copyright

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

* Rename observer result method from put to observe

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

* Rename InstrumentWithBound to InstrumentWithBinding

Signed-off-by: Bogdan Cristian Drutu <bogdandrutu@gmail.com>
2020-01-27 10:21:44 -08:00
Jonathan Giles ecad8609aa Introduce automatic module names into all libraries being built. (#781)
* Introduce automatic module names into all libraries being built.

* Centralise manifest config of automatic module name into root build.gradle file.

* Adding empty new lines
2020-01-22 18:22:00 -08:00
Bogdan Drutu bd4f3737d4
Add a new artifact context propagation (#754)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-01-21 08:49:34 -08:00