Commit Graph

69 Commits

Author SHA1 Message Date
Mateusz Rzeszutek 42f07eedd8
Deprecate `NetServerAttributesExtractor` (#9156) 2023-08-11 15:04:52 +02:00
Lauri Tulmin d749ac0091
Rework grpc cancelation propagation (#8957) 2023-08-08 11:00:10 +03:00
Mateusz Rzeszutek 4f12fba9c3
Implement new stable client semantic conventions (#8704) 2023-06-13 17:00:27 -07:00
Mateusz Rzeszutek cde2e70148
Implement new stable server semantic conventions (#8663) 2023-06-13 11:07:59 +02:00
Mateusz Rzeszutek 506ccb6b7d
Implement new stable network semantic conventions (#8616) 2023-06-12 16:51:47 +02:00
Mateusz Rzeszutek eeb6ffd6e3
Deprecate InetSocketAddressNetClientAttributesGetter and move its met… (#8591) 2023-05-31 08:30:56 +02:00
Mateusz Rzeszutek c4ee60dad4
Deprecate InetSocketAddressNetServerAttributesGetter and move its met… (#8341) 2023-05-29 10:04:32 +02:00
Mateusz Rzeszutek e3944a53a5
Make net.transport an optional attribute (#8279) 2023-04-20 08:14:03 -07:00
Lauri Tulmin 4023a59068
Grpc client instrumentation net.sock.peer.addr (#7742)
Currently grpc client instrumentation unreliably fills
`net.sock.peer.addr` which makes tests flaky
https://ge.opentelemetry.io/s/nni57d5zryafk/tests/:instrumentation:grpc-1.6:javaagent:test/io.opentelemetry.javaagent.instrumentation.grpc.v1_6.GrpcStreamingTest/conversation(int,%20int)%5B8%5D?expanded-stacktrace=WyIwIl0&top-execution=1
This pr moves capturing `net.sock.peer.addr` to a later point where it
seems to work reliably.
2023-02-14 12:04:53 -08:00
Mateusz Rzeszutek e1895e548c
Rename all methods in all Getters to use the `get*()` naming scheme (#7619)
Resolves #6562

This PR only contains renames; the actual content is in the `*Getter`
interfaces, the rest of changes is just IntelliJ doing its job.
2023-01-23 09:28:11 +00:00
Tav Herzlich b9c10c9607
Add gRPC request metadata instrumentation (#7011)
Solves. #6991 

This PR implements the request portion of the new gRPC metadata
instrumentation spec:

https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/rpc.md#grpc-request-and-response-metadata

The changes include:

- new CommonConfig entry for desired gRPC metadata values:
'otel.instrumentation.grpc.capture-metadata.request'
(Similar to http headers)
- setting the desired metadata values in GrpcTelemetry
- new property in GrpcAttributesExtractor that holds a reference to the
GrpcRpcAttributesGetter
- new property in GrpcAttributesExtractor that stores the desired values
so it can iterate them and extract each one from the request
- inject the GrpcRpcAttributesGetter to GrpcAttributesExtractor (in
GrpcTelemetryBuilder)
- logic in GrpcRpcAttributesGetter to safely extract the gRPC metadata
value
- A new test in GrpcTest that makes sure that when a certain metadata
key name is inserted, it also ends up in the span attributes

** Doesn't take care of the response because gRPC response is not
implemented in java-instrumentation yet. (This is absolutely necessary
but out of scope for this PR)
** "metadataValue" is only implemented inside GrpcRpcAttributesGetter
and not in RpcAttributesGetter to avoid providing implementations for
every RpcAttributesGetter in the repo as this PR only focuses on gRPC.

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
2023-01-17 21:18:37 -08:00
Anurag Agarwal 390803d3e7
GRPC: Adds peer socket address when the client call is ready (#7451)
Closes
https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/7445
2023-01-02 11:01:37 +01:00
Trask Stalnaker f9c2c80ef7
Avoid constructing URI (#7293)
Resolves #6568 (Reactor Netty optimization was already implemented in
#6600)
2022-11-24 10:14:10 +01:00
Aaron Ai 2d7395c44b
Introduce markdown lint check (#7175)
Fixes #7129
2022-11-16 20:48:42 -08:00
Arik Sher deebf6d06c
Enhancement/add additionalServerExtractors (#7155)
fixes issue #7153

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
2022-11-15 08:52:43 +01:00
Aaron Ai d266a604ed
Add docs for gRPC library instrumentation (#6981)
Fixes #6980
2022-10-27 15:31:28 +02:00
Mateusz Rzeszutek 77035fc88c
Extract `net.peer.{name,port}` on start for CLIENT spans (#6828)
The [HTTP
spec](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/http.md#http-client)
says these two attributes must be provided at span creation time - I
think it makes sense to extend it over to all `net`-related
instrumentations, cause these are supposed to be the logical peer
name/port, which are supposed to be known before the connection is
started/exchange is made.
2022-10-10 16:00:19 -07:00
Trask Stalnaker 429ecfc713
Update error prone (#6646)
(note that change from BDDMockito is due to
https://github.com/google/error-prone/issues/3396)
2022-09-23 11:24:40 -07:00
Mateusz Rzeszutek cfdbe758f2
Net attributes getters changes (in preparation for HTTP spec impl) (#6503)
* Net attributes getters changes: instrumentation-api-semconv changes

* Net attributes getters changes: getter implementations

* Net attributes getters changes: test fixes

* Remove net.sock.host.name

* code review comments

* default getter methods & getPeerSocketAddress() method name

* set authority in grpc earlier
2022-09-12 09:20:27 -07:00
Mateusz Rzeszutek 82b39b1012
Rename `newInstrumenter()` into `buildInstrumenter()` (#6363)
* Rename newInstrumenter() into buildInstrumenter()

* spotless
2022-07-25 12:02:46 -07:00
Sam Xie fcda760ad5
Add shouldStart() call to gRPC instrumentation (#6356) 2022-07-22 10:38:53 +02:00
Mateusz Rzeszutek 3af56e7d22
InstrumentationConfig part 3: HTTP headers and peer service mappings (#6302) 2022-07-15 14:52:52 -07:00
Trask Stalnaker 11dd0797f6
Make rpc.grpc.status_code required (#6184) 2022-06-17 13:50:57 -07:00
ET aca80bee40
Make gRPC metadata available to AttributeExtractors (#6125)
* Allow GrpcTelemetryBuilder to be customized to add Extractors, etc

* fixup! Allow GrpcTelemetryBuilder to be customized to add Extractors, etc

* Call GrpcRequest.setMetadata() in TracingClientInterceptor.start()

* stop spotless from complaining

* Checkstyle satisfaction

* Spotless

* Suggestions (#6)

* Suggestions

* Apply suggestions from code review

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
2022-06-03 12:51:12 +03:00
HaloFour b7fc80c98e
Change SpanStatusExtractor to use a builder that can set status description (#6035)
* Change SpanStatusExtractor to use a builder that can set status descripion

* Refactor SpanStatusExtractor to only support builder approach to setting status

* Revert setting the exception as the status description

* PR feedback

* Re-fix graghql instrumentation span extractor

* Spotless
2022-05-19 10:00:46 -07:00
Mateusz Rzeszutek 87b412fb40
Instrumentation API changes: OperationMetrics, OperationListener (#6016)
* Instrumentation API changes: OperationMetrics, OperationListener

* errorprone
2022-05-12 11:16:46 -07:00
jack-berg 6fe3299f52
Add metric support for grpc (#5923)
* Add metric support for grpc

* Spotless
2022-04-25 10:36:26 -07:00
Anuraag Agrawal 14372adb68
Migrate Guava tests to Java (#5668)
* Migrate Guava tests to Java

* Update instrumentation/guava-10.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/guava/ListenableFutureTest.java

Co-authored-by: Lauri Tulmin <tulmin@gmail.com>

* Workaround inline mock issue

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
Co-authored-by: Lauri Tulmin <tulmin@gmail.com>
2022-03-24 14:14:09 +09:00
Mateusz Rzeszutek 56f65e4fab
Convert all logging statements from slf4j to jul - part 1 (#5628)
* Convert all logging statements from slf4j to jul - part 1

* fix tests

* use placeholders

* fixed all comments, added static imports for Level
2022-03-22 10:35:27 -07:00
Anuraag Agrawal cd528e98fb
Rename library entrypoints to Telemetry (#5624)
* Rename library entrypoints to Telemetry

* Renames
2022-03-22 14:39:23 +09:00
Mateusz Rzeszutek 1ee60aa6e6
Split out RpcAttributesGetter (#5548)
* Split out RpcAttributesGetter

* code review comments

* go back to RpcAttributesGetter
2022-03-17 11:14:19 +01:00
Anuraag Agrawal 1d9c23bfb3
Do not propagate gRPC deadline when propagating OTel context via javaagent. (#5543)
* Add test for early return in gRPC pattern.

* Do not propagate gRPC deadline when propagating OTel context via javaagent.
2022-03-11 11:06:26 -08:00
Anuraag Agrawal 9e5fdcebd5
Migrate gRPC tests to Java (#5521)
* Migrate gRPC tests to Java

* check

* clean
2022-03-09 14:37:59 +09:00
Trask Stalnaker 3ab1b8516f
Add markdown spell check (#5450)
* Add markdown link check

* Fix links

* update workflows

* move comment

* Add misspell check

* Fix misspellings

* Fix more misspellings

* Run against all files

* Spotless
2022-03-01 19:18:53 -08:00
eugeniyk bf16564321
Set custom gRPC client/server span name extractor (#5244)
* Set custom gRPC client/server span name extractor

* Fix imports

* Fix compilation

* Fix style rule

* Update to use Functions instead

* Fix formatting
2022-02-24 13:59:00 +02:00
ralphgj e551d99db3
fix: add attributes of net.peer.* for grpc client span (#5324) 2022-02-10 09:54:43 -08:00
Mateusz Rzeszutek 551418c283
Refactor AttributesExtractor so that it extracts route from Context (#5288)
* Refactor AttributesExtractor so that it extracts route from Context

* typo

* fix tests

* Update instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpRouteHolder.java

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>

* fix all AttributesExtractors

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
2022-02-08 10:38:41 +01:00
Trask Stalnaker 1077258263
Add InternalJavadoc custom error prone check (#5277)
* Add InternalJavadoc custom error prone check

* Add example usage

* Move to conventions

* Revert "Move to conventions"

This reverts commit d8a8209b59.

* Just get it working

* Clearer error message

* versions

* Apply almost everywhere

* feedback

* Always at the end of javadoc

* Fix test

* Missed (at least) one

* No longer internal

* Fix NPE

* Spotless

* Convert awslambda Java test to JUnit 5 so can reduce visibility

* Reduce visibility

* Rename the check

* More

* Move into errorprone-convention

* Fix UserExcludedClassesConfigurerTest
2022-02-01 17:54:57 -08:00
Mateusz Rzeszutek 8b767ac435
Refactor HTTP attributes extractors to use composition over inheritance (#5267)
* Refactor HTTP attributes extractors to use composition over inheritance

* Rename remaining variables: *Extractor to *Getter
2022-01-31 09:25:27 -08:00
jason plumb fe8a132ee9
Factor out NetServerAttributesGetter (#5194)
* factor out NetServerAttributesGetter and favor composition over inheritance.

* Update instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetServerAttributesGetter.java

Co-authored-by: Mateusz Rzeszutek <mrzeszutek@splunk.com>

* errorprone and spotless

* spotless

Co-authored-by: Mateusz Rzeszutek <mrzeszutek@splunk.com>
2022-01-21 17:01:30 -08:00
jason plumb c5c0a2bcdf
NetClientAttributesAdapter - favor composition over inheritance (#5030)
* first pass at separating NetAttributesAdapter interface and make NetClientAttributesExtractor concrete

* rename the implementations extractor -> adapter

* hide constructor and make factory method

* rename to client and add javadoc

* spotless

* finish javadoc thought

* rebase

* renamed NetClientAttributesAdapter to NetClientAttributesGetter

* fix lettuce

* code review comments

* code review comments -- renaming for consistency

* adapter -> getter

* fix ratpack

* adapter -> getter
2022-01-20 10:51:13 -08:00
Anuraag Agrawal f6bcd76219
Update errorprone (#5016)
* Update errorprone

* gwt

* Remove unnecessary final

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
2022-01-06 14:21:56 -08:00
Mateusz Rzeszutek 9a4a68d836
Add Android API-friendliness checks (#4505)
* Add Android API-friendliness checks

* Improve comments

* Remove ignores

* Handle CompletionException

* Spotless

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
2021-11-24 12:59:11 -08:00
Nikita Salnikov-Tarnovski e7b8cca107
Convert TextMapSetters and TextMapGetters to enums (#4522)
* Convert TextMapSetters to enums

* Convert TextMapGetters to enums
2021-11-08 22:01:40 +02:00
Nikita Salnikov-Tarnovski 8ea59f0846
Rename all InjectAdapters to Setters (#4489)
* Rename all InjectAdapters to Setters

* Errorprone fixes

* Make setter public
2021-10-25 12:36:59 -07:00
Martin d314d76fce
rename `newBuilder()` to `builder()` (#4475)
* rename `newBuilder()` to `builder()`

* rename `newBuilder()` to `builder()`
2021-10-22 20:50:43 -07:00
Martin ac91dc090a
Type annotation placement (#4406)
* switch annotation `org.checkerframework.checker.nullness.qual.Nullable` to `javax.annotation.Nullable`

* code format
2021-10-17 17:38:43 -07:00
Nikita Salnikov-Tarnovski efddb72cef
Convert AttributesExtractor to interface (#4363) 2021-10-14 08:36:47 +03:00
Trask Stalnaker 63a2383905
Split NetAttributesExtractor into NetClientAttributesExtractor and NetServerAttributesExtractor (#4287)
* Net Extractors

* Either request or response but not both

* Fix merge conflicts

* Separate by OnStart/OnEnd

* PeerServiceAttributes

* Fix test

* Restructure to client/server

* Fix merge conflict in main

* more

* peer.service

* Feedback

* peer.service is only for clients

* Fix merge conflict

* rename

* Armeria

* peer.service is only for clients

* rename

* WIP

* Sync Dubbo with Armeria

* More Dubbo and Armeria

* gRPC

* Revert some Dubbo changes

* more peer.service

* Fix test

* Fix merge

* Fixes
2021-10-07 15:40:15 -07:00
Trask Stalnaker d28f0d3d3f
Remove unneeded catch blocks (#4130)
* Remove unneeded catch blocks

* Update test!
2021-09-15 09:42:18 -07:00