Commit Graph

113 Commits

Author SHA1 Message Date
Trask Stalnaker a59be316b9
Simplify logging config (#10843) 2024-03-14 15:58:23 +00:00
cleverchuk 81f8bf6231
Add `service.name` to MDC (#9647)
Co-authored-by: Lauri Tulmin <ltulmin@splunk.com>
2023-11-13 09:37:19 -08:00
Mateusz Rzeszutek 76d0090f53
Define `url.scheme` in terms of logical operation in HTTP server semconv (#9698) 2023-10-17 11:04:39 -07:00
OpenTelemetry Bot acbab58a46
Update the OpenTelemetry SDK version to 1.28.0 (#8897)
Co-authored-by: Lauri Tulmin <ltulmin@splunk.com>
2023-07-10 12:45:01 -07:00
Mateusz Rzeszutek 8ee63d4441
Implement new stable URL semantic conventions (#8491) 2023-06-05 15:22:22 +00:00
Lauri Tulmin 81f6a3a0c2
Faster type matching (#8525) 2023-06-02 18:35:31 +03:00
Lauri Tulmin 43073e7df9
Allow transforming classes with missing field types (#8393) 2023-05-09 14:07:50 -07:00
Mateusz Rzeszutek 9b82a01dd7
Set up EarlyInitAgentConfig even earlier (#8413) 2023-05-06 16:24:23 -07:00
Ago Allikmaa a9788a22de
Provide ability to add HTTP server response headers, with Tomcat implementation (#7990)
This allows custom distributions of the agent to register
`HttpServerResponseCustomizer` implementations. When a supported HTTP
server instrumentation starts processing a response, the `onStart`
method of all registered implementations will be invoked with the
`Context` of the SERVER span, an instrumentation-specific response
object and `HttpServerResponseMutator` instance that allows appending
headers to that response.

The intent of this is to allow custom distributions to set a header
containing span context information, such as the trace and span IDs. As
such, the initial implementation only allows appending response headers
and nothing else.

The `HttpServerResponseCustomizer` and related classes are currently in
a subpackage of the `io.opentelemetry.javaagent.bootstrap` package in
`javaagent-extension-api`. This makes them get loaded in the bootstrap
classloader, thus directly accessible from instrumentations. I am not
aware if there is an elegant way to put it in the agent classloader
instead, yet have the same instance accessible from both
`AgentInstaller` and instrumentations.

This also includes Tomcat-specific implementation in order to be able to
demonstrate that it works, and add automated testing of this to
HttpServerTest including one implementation.
2023-03-13 17:46:39 +01:00
Lauri Tulmin dd32ff30f1
Improve compatibility with other agents (#7916)
Fixes the issue described in
https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/7887
Hopefully resolves
https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/7594
We should not use cached `TypeDescription` for currently transformed
class as the cached description will not be the same as newly created
one if the class bytes were transformed. For example if another agent
adds an interface to the class then returning the cached description
that does not have that interface would result in bytebuddy removing
that interface, see
665a090c73/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/scaffold/TypeWriter.java (L5012)
2023-03-01 09:06:59 +02:00
Mateusz Rzeszutek 18cffb7aeb
Make config file available in early agent initialization phase (#7550)
Fixes #7540

I think this kind of early config might be useful in general -- for
instance, I think I'd like to use it for properties introduced in
https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/7339
2023-01-11 20:26:28 -08:00
Mateusz Rzeszutek c03bfc255b
Don't call Thread#setContextClassLoader() (#7391)
Related to #7220

Unfortunately it doesn't fix the aforementioned issue; while the CL used
is no longer the agent classloader, gauge collection still throws that
error.
Still, I think this is a good change that removes one source of agent's
CL leaking into application runtime.
2022-12-13 10:24:40 -08:00
Mateusz Rzeszutek 59cb9ca0df
Remove deprecated code (#6501)
* Remove deprecated code

* unnecessary semicolon

* fix distro and extension examples
2022-08-24 14:36:57 -07:00
Mateusz Rzeszutek 976ab9411c
Deprecate Config (#6360)
* Deprecate Config

* suppress deprecation on ConfigTest
2022-07-25 12:10:11 -07:00
Lauri Tulmin 57c9072df3
Instrumenting classes with missing method return or parameter types (#6286)
* Allow instrumenting classes with missing method return or parameter types

* add test
2022-07-18 19:13:10 -07:00
Mateusz Rzeszutek b917b3bf9c
Use ConfigProperties instead of Config in the agent code (#6322)
* Use ConfigProperties instead of Config in the agent code

* Fix merge conflict

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
2022-07-18 19:04:48 -07:00
Mateusz Rzeszutek 35c63a4184
Remove the 'noop API' feature (#6313)
* Remove the 'noop API' feature

* remove noop api dep

* fix tooling tests
2022-07-12 10:36:19 -07:00
Mateusz Rzeszutek b23db97a28
Use ConfigProperties in javaagent SPIs (#6285)
* Use ConfigProperties in javaagent SPIs

* remove deprecated

* errorprone

* fix javaagent build

* fix javaagent-tooling tests

* spotless
2022-07-12 08:41:01 +02:00
Mateusz Rzeszutek e7887ac929
Idea: deprecate `Config`, add agent-only `InstrumentationConfig` (#6264)
* Idea: deprecate Config, add agent-only InstrumentationConfig

* fix

* fix camel test

* fix external-annotation tests
2022-07-08 16:20:49 +02:00
Mateusz Rzeszutek 198dad00d6
Prefer using ConfigProperties over Config in AgentListener (#6202)
* Prefer using ConfigProperties over Config in AgentListener

* normalize property name

* add TODOs
2022-07-07 15:44:32 +02:00
Trask Stalnaker 701ed54311
Use "class loader" instead of "classloader" consistently in docs and comments (#6236)
* Use "class loader" consistently instead of classloader

* Java comments too

* Fix bad merge
2022-06-30 14:57:07 -07:00
Mateusz Rzeszutek 25d929b5e7
Deprecate the AgentListener#beforeAgent() method (#6006)
* Deprecate the AgentListener#beforeAgent() method

* errorprone
2022-05-10 10:30:40 -07:00
Trask Stalnaker 8afa13eec8
Minor changes to startup code (#5992)
* Minor changes to startup code

* Fix test
2022-05-10 09:26:38 -07:00
Mateusz Rzeszutek 7c760acea6
Move some classes out of `javaagent-instrumentation-api` (#5841)
* Move concurrent instrumentation utils out from javaagent-instrumentation-api

* Move AgentLogEmitterProvider, InstrumentedTaskClasses and OpenTelemetrySdkAccess out of javaagent-instrumentation-api
2022-04-15 12:09:28 -07:00
Trask Stalnaker 4879cedccb
Prevent possible deadlock (#5830) 2022-04-14 15:00:39 -07:00
Lauri Tulmin 3940529dd2
Agent tooling already has access to bootstrap proxy (#5802) 2022-04-11 12:41:30 -07:00
Lauri Tulmin 4ad44909ca
Faster type matching (#5724)
* Faster type matching

* make findLoadedClass accessible on java17

* enable jaxrs instrumentation for quarkus test

* fix websphere

* fix muzzle

* javadoc formating

* ignore classes that are know to fail to load for virtual field transforms

* add back jaxrs and jaxws annotation instrumentations

* Apply suggestions from code review

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

* fix compile error

* comments

* replace deprecated method usage

* add comment

* add an spi to get access to bootstrap proxy from muzzle module

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
2022-04-08 10:38:50 -07:00
Mateusz Rzeszutek 65717dae3e
Cleanup Config & ConfigBuilder API (#5733)
* Cleanup Config & ConfigBuilder API

* errorprone

* errorprone & spotless

* spotless
2022-04-05 20:20:52 -07:00
Mateusz Rzeszutek 8e722cc264
Library instrumentation should read its version from a file (#5692)
* Library instrumentation should read its version from a file

* errorprone

* animalsniffer

* code review comments

* add name as task input too

* code review comments
2022-04-04 11:52:23 -07:00
Mateusz Rzeszutek 2fd167cfe0
Move BootstrapPackagesConfigurer to javaagent-tooling (#5734) 2022-04-01 11:33:07 -07:00
Mateusz Rzeszutek b668e73e13
Convert all logging statements from slf4j to jul (#5674)
* Convert all logging statements from slf4j to jul

* code review comments

* fix tests

* Fix randomly failing test
2022-03-25 10:02:51 -07:00
Lauri Tulmin c461d22d83
Define helper classes in loadClass (#5528)
* Define helper classes in loadClass similarly to regular classes

* fix test

* spotless

* address review comments
2022-03-09 09:12:25 -08:00
Anuraag Agrawal ec375116be
Fix more lint warnings (#5174)
* Fix more lint warnings

* Redisable lint

* Drift

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
2022-01-20 12:48:46 +09:00
Lauri Tulmin c76345a973
Always set parent of agent class loader to bootstrap class loader (#5169)
* Always set parent of agent class loader to bootstrap class loader

* remove parent class loader argument
2022-01-18 19:36:28 -08:00
jack-berg 45dca4fc5d
Expose AutoConfiguredOpenTelemetrySdk to AgentListener (#4831)
* Expose AutoConfiguredOpenTelemetrySdk to AgentListener

* Only call AgentListener if noop is disabled, deprecate AgentListener methods

* Call AgentListener in DelayedAfterAgentCallback
2021-12-10 12:55:57 -08:00
Lauri Tulmin f5142f24e9
Remove internal-proxy instrumentation (#4749) 2021-11-30 07:56:26 -08:00
Nikita Salnikov-Tarnovski 821a4b870b
Drop instrumentation-api-caching module and move weak cache implementation to instrumentation-api (#4667)
* Drop instrumentation-api-caching module and move weak cache implementation to instrumentation-api

* Some test fixes

* Some cleanup

* Temporary workaround for using weak values in FutureListenerWrappers

* Spotless

* Update ClassNames and SpanNames

* Compilation and comment

* Add bounded cache and clean interface

* Polish

* Add comment

* Vendor ConcurrentLinkedHashMap in

* Let errorprone ignore vendored CLHM for now

* Keep license in java files too

* Convert Netty wrapper cache to VirtualField

* Work around lambda instrumentation failure

Ideally we would ignore instrumenting helper classes...

* Revert "Work around lambda instrumentation failure"

This reverts commit 6d63815b44.

* Revert "Convert Netty wrapper cache to VirtualField"

This reverts commit dac1522a3f.

* Handle cleared weak values

* Fix comment

* Delete instrumentation-api-caching

* Copy in weak-lock-free

* Remove caffeine remnants

* Fix checkstyle

* Rename BoundedCache to MapBackedCached

* Remove duplicate LICENSE

* Remove outdated comment

* Sync with SDK copy of weaklockfree

* Enable checkstyle:off comment

* Re-generate license report

* Move NOTICE file to package-info.java

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
2021-11-24 09:05:12 -08:00
Lauri Tulmin c109773f17
Test modular jdk (#4501)
* Test modular jdk

* review comment
2021-10-28 10:54:00 -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
Mateusz Rzeszutek fda4779127
Fix a bug in the field backed VirtualField implementation (#4310)
* Fix a bug in the field backed VirtualField implementation

* Multiple interface fields
2021-10-06 09:40:53 -07:00
Mateusz Rzeszutek 3e93dc8f29
Move Trie back to javaagent-tooling (#4300)
* Move Trie back to javaagent-tooling

* Code review comments
2021-10-05 16:07:33 -07:00
Mateusz Rzeszutek b4984657b5
Move BootstrapPackagePrefixesHolder to javaagent-bootstrap (#4303) 2021-10-05 11:26:24 -07:00
Mateusz Rzeszutek 9d6fb65b41
Remove ContextStore/InstrumentationContext mentions from internal age… (#4267)
* Remove ContextStore/InstrumentationContext mentions from internal agent classes

* Fix internal-reflection module
2021-10-04 09:24:25 -07:00
Nikita Salnikov-Tarnovski 2eadca8c83
Move AgentExtension to the tooling module (#4253) 2021-09-30 18:57:39 +03:00
Lauri Tulmin 559cdcbbee
Transform lambda classes (#4182)
* Transform lambda classes

* improve comment
2021-09-24 09:52:15 -07:00
Lauri Tulmin 0f3d0cb05b
Generate our own sun.misc.Unsafe if it is not available (#4124)
* Generate our own sun.misc.Unsafe if it is not available

* skip generating invokeCleaner method

* grpc isn't shaded so setting system property doesn't affect only our bundled copy

* generate invokeCleaner when it is present in internal unsafe
2021-09-22 20:18:20 -07:00
Trask Stalnaker 6cc403cdf2
Add strict context stressor testing option (#4001) 2021-09-10 13:53:46 -07:00
Mateusz Rzeszutek 5c71d28ed7
Remove deprecated Config methods (#3908) 2021-08-23 16:44:54 -07:00
Nikita Salnikov-Tarnovski 6a2ee3255a
Extract muzzle check plugin (#3657)
* Extract muzzle check plugin
2021-07-26 12:37:14 +03:00
Trask Stalnaker 9e4da754c2
Use consistent logger field name (#3515) 2021-07-07 10:47:46 -07:00