Commit Graph

424 Commits

Author SHA1 Message Date
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