Commit Graph

94 Commits

Author SHA1 Message Date
Lorenzo Dematté 27a09d8529
Upgrade apm-agent to 1.55.0 (#131510) 2025-07-18 15:04:07 +02:00
Moritz Mack 4e81b75e2a
Remove old entitlements legacy code (#131224) 2025-07-15 08:03:09 +02:00
Moritz Mack 83c0c12aa6
Cleanup tracing header name constants (#130800)
Cleanup tracing header name constants
2025-07-08 17:13:15 +02:00
Moritz Mack e2bc52e662
Improved usability of the mock APM server for local testing. (#130609)
To verify specific metrics or transactions, you can now filter the
output using one or several of the options below. Each of these takes a
comma-separated list of wildcard expressions.
- `-apm-metrics`
- `-apm-transactions`
- `-apm-transactions-excludes`

Relates to ES-10969
2025-07-04 15:03:37 +02:00
Lorenzo Dematté 6bf531660c
Fix NPE in APMTracer through RestController (#128314)
Our APMTracer doesn't like nulls - this is a sensible thing, as APM in general does not allow nulls (it only allows a precise set of types).
This PR changes the attribute to a sentinel "" in place of null values. It also makes a small change to APMTracer to give a better error message in case of null values in attributes.
2025-05-23 09:32:22 +02:00
Ryan Ernst 8ad272352b
Remove doPrivileged from ES modules (#127848)
Continuing the cleanup of SecurityManager related code, this commit
removes uses of doPrivileged in all Elasticsearch modules.
2025-05-09 14:15:48 -04:00
Ryan Ernst 22a52a9c64
Remove security manager policy files (#127727)
Now that security manager is gone, the policy files are no longer
needed. This commit removes the server, test and plugin specific policy
files
2025-05-06 19:37:46 +02:00
Lorenzo Dematté c663e3ded8
Add missing APM entitlements (#123462) 2025-03-04 08:32:59 +01:00
Ievgen Degtiarenko 201a37012d
Document how to enable tracing (#123713) 2025-02-28 16:16:04 +01:00
Alexey Ivanov ab835a96b1
Update elastic-apm-agent to support Java 24 (#123052)
Updates elastic-apm-agent to 1.52.2 to support Java 24.
2025-02-28 00:14:33 +00:00
Moritz Mack 6648a03bab
Revert "Revert "Remove deprecated tracing.apm.* settings for v9 (#119926)"" (#120895)
This reverts commit 5f44911ef8.
Reverts revert in #120268 after blockers have been resolved.
Relates to ES-10293
2025-01-27 16:04:36 +01:00
Moritz Mack 190720d2d8
Special handling for invalid global labels for APM agent (#120795) 2025-01-24 17:46:27 +01:00
Lorenzo Dematté bdd2fc00d3
[Entitlements] Policy and checks for loading native libraries (#120044) 2025-01-22 14:00:40 +01:00
Moritz Mack f1447fe821
[Entitlements] Instrument write access to System properties (#120357)
Instrument write access to System properties by means of the `WriteSystemPropertiesEntitlement`.
`System.setProperties(Properties)` is always denied.

Part of #ES-10359
2025-01-21 18:07:40 +01:00
Moritz Mack 5f44911ef8
Revert "Remove deprecated tracing.apm.* settings for v9 (#119926)" (#120268)
Temporarily reverts elastic/elasticsearch#119926 due to unforeseen
usage.

Relates to ES-10293
2025-01-16 22:47:49 +11:00
Moritz Mack 5123b948a9
Remove deprecated tracing.apm.* settings for v9 (#119926) 2025-01-14 08:41:11 +01:00
Moritz Mack eb5ce98bfd
Bump deprecated tracing.apm settings to critical to be shown in the Upgrade assistent (#119677) 2025-01-08 10:12:10 +01:00
Jack Conradson 7297390378
Add entitlement checks for `java.lang.ClassLoader` (#119027)
This commit adds an entitlement for creating a classloader.
2025-01-02 21:55:00 +00:00
Lorenzo Dematté 5df57fda72
[Entitlements] Add `set_https_connection_properties` entitlement and checks (#118577) 2025-01-02 16:06:37 +01:00
Nikolaj Volgushev 12acc89539
Minimize APM automaton (#119344)
https://github.com/elastic/elasticsearch/pull/119309 brought back
automaton minimization. The `APMTracer` is another instance where we can
save some heap with minimization.
2024-12-31 05:09:23 +11:00
Rene Groeschke ba61f8c7f7
Update Gradle wrapper to 8.12 (#118683)
This updates the gradle wrapper to 8.12

We addressed deprecation warnings due to the update that includes:

- Fix change in TestOutputEvent api
- Fix deprecation in groovy syntax
- Use latest ospackage plugin containing our fix
- Remove project usages at execution time
- Fix deprecated project references in repository-old-versions
2024-12-30 15:34:24 +01:00
Lorenzo Dematté 4f08b7e578
Update APM Java Agent to support JDK 23 (#115194) 2024-10-21 16:04:54 +02:00
Luca Cavanna 8efd08b019
Upgrade to Lucene 10 (#114741)
The most relevant ES changes that upgrading to Lucene 10 requires are:

- use the appropriate IOContext
- Scorer / ScorerSupplier breaking changes
- Regex automaton are no longer determinized by default
- minimize moved to test classes
- introduce Elasticsearch900Codec
- adjust slicing code according to the added support for intra-segment concurrency
- disable intra-segment concurrency in tests
- adjust accessor methods for many Lucene classes that became a record
- adapt to breaking changes in the analysis area

Co-authored-by: Christoph Büscher <christophbuescher@posteo.de>
Co-authored-by: Mayya Sharipova <mayya.sharipova@elastic.co>
Co-authored-by: ChrisHegarty <chegar999@gmail.com>
Co-authored-by: Brian Seeders <brian.seeders@elastic.co>
Co-authored-by: Armin Braun <me@obrown.io>
Co-authored-by: Panagiotis Bailis <pmpailis@gmail.com>
Co-authored-by: Benjamin Trent <4357155+benwtrent@users.noreply.github.com>
2024-10-21 13:38:23 +02:00
Armin Braun fca267ebc3
Minimize Automaton used in APMTracer (#113775)
This thing was taking up 400k of heap since it wasn't minimized, turns
into ~2k after minimization.
2024-10-02 18:40:12 +02:00
Mark Vieira a59c182f9f
Add AGPLv3 as a supported license 2024-09-13 15:29:46 -07:00
Jan Kuipers 26623f14d8
Inference autoscaling telemetry (#110630)
* Wire MeterRegistry

* Allow for collections of values in async APM measurements

* Adaptive allocations scaler metrics

* Update docs/changelog/110630.yaml

* Update 110630.yaml
2024-07-29 10:38:18 +02:00
Moritz Mack 7ee5c73e7d
Deprecate Telemetry / APM legacy settings in favor of the new telemetry.* settings (#104908) 2024-04-11 08:44:20 +02:00
Dmitry Cherniachenko e21a4874ab
Use String.replace() instead of replaceAll() for non-regexp replacements (#105127)
* Use String.replace() instead of replaceAll() for non-regexp replacements

When arguments do not make use of regexp features replace() is a more efficient option, especially the char-variant.
2024-02-12 13:11:15 -05:00
Moritz Mack 54088839b4
Do not enable APM agent 'instrument', it's not required for manual tracing. (#105055) 2024-02-02 18:13:00 +01:00
Moritz Mack dbf59c5414
Update/Cleanup references to old tracing.apm.* legacy settings in favor of the telemetry.* settings (#104917) 2024-01-31 09:20:05 +01:00
Moritz Mack 9ea187dd76
Fix enabling / disabling of APM agent "recording" in APMAgentSettings (#104324) 2024-01-30 17:29:21 +01:00
Moritz Mack a3b1d86c45
Reuse APMMeterService of APMTelemetryProvider (#104906) 2024-01-30 15:49:56 +01:00
Moritz Mack 35cc9e1159
New APM settings using `telemetry.` prefix deprecate ambiguous `tracing.apm.` settings. (#104376)
Telemetry / APM settings are renamed from "tracing.apm.{name}" to "telemetry.tracing.{name}" for tracing related settings. General APM settings are renamed to "telemetry.{name}". The old legacy settings are kept for now and applied as fallback.
2024-01-30 09:34:03 +01:00
Stuart Tettemer 3493e425ac
Metrics: Agent settings prefix telemetry.agent preferred over tracing.apm.agent (#104345)
Prefer the telemetry.agent prefix for APM agent settings.

Add a fallback prefix to Affix settings to migrating between an old prefix
and a new prefix.
2024-01-22 12:53:36 -06:00
Gareth Ellis 764269b395
Thread pool metrics (#104500)
This implements metrics for the threadpools.

The aim is to emit metrics for the various threadpools, the metric callback should be created when the threadpool is created, and removed before the threadpool is shutdown.

The PR also includes a test for the new metrics, and some additions to the metrics test plugin.

Finally the metric name check has been modified to allow some of the non compliant threadpools (too long, includes - )
Co-authored-by: Przemyslaw Gomulka <przemyslaw.gomulka@elastic.co>
2024-01-18 10:15:58 +01:00
Przemyslaw Gomulka aa42368dba
Revert "Adding threadpool metrics (#102371)" (#104467)
This reverts commit afd915af1e.
2024-01-17 17:01:28 +01:00
Gareth Ellis afd915af1e
Adding threadpool metrics (#102371)
This implements metrics for the threadpools.

The aim is to emit metrics for the various threadpools, the metric callback should be created when the threadpool is created, and removed before the threadpool is shutdown.

The PR also includes a test for the new metrics, and some additions to the metrics test plugin.

Finally the metric name check has been modified to allow some of the non compliant threadpools (too long, includes - )

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Przemyslaw Gomulka <przemyslaw.gomulka@elastic.co>
2024-01-17 15:27:12 +01:00
Moritz Mack c11f329720
Temporarily tolerate tracing.apm.agent.global_labels.XYZ settings (#104317) 2024-01-12 16:16:27 +01:00
Moritz Mack 063fc26a20
Temporarily tolerate tracing.apm.agent.global_labels.XYZ settings (#104315) 2024-01-12 14:56:32 +01:00
Moritz Mack 00ca64bcf2
Use allow-list for APM agent settings and consolidate defaults in APMJvmOptions (#104141)
Prevent invalid and miss-configuration of APM agent using an explicit allow-list of setting keys.
Additionally, configuration defaults of APMAgentSettings are consolidated in APMJvmOptions to keep defaults in a single location.
(ES-6916)
2024-01-12 10:30:04 +01:00
Przemyslaw Gomulka 07780a8282
Add metric name validation (#103388)
This commit adds a minimum metric name validation which checks:

metric name starts with es. prefix
metric name is using . as a separator of elements
metric name is using characters from a white list
validate min number of elements = 3 elements ( prefix, group and the suffix name)
validate max number of elements and max characters per element
validate the suffix element in a metric name to be from the enumerated allow list

It also modifies existing metric names to adhere to those rules
2024-01-09 11:05:00 +01:00
Stuart Tettemer 0ce3e8cb71
APM: Add TraceContext interface to reduce server dependencies in telemetry (#103635)
`Tracer.startTrace(ThreadContext threadContext, Traceable traceable, String name, Map<String, Object> attributes)` takes in a `ThreadContext` which creates a dependency on `server`.  This change adds a new interface, `ThreadContext` with those methods required from `ThreadContext` and uses that as the parameter to `startTrace`.

The methods in the `TraceContext` interface are
```
    <T> T getTransient(String key);
    void putTransient(String key, Object value);
    String getHeader(String key);
    void putHeader(String key, String value);
```

which are needed for getting the parent context, the remote headers, the x-opaque-id and setting the remote headers for a trace.

This is an ugly but functional way to remove a dependency on server to be able to move telemetry in to a library for static metric registration.
2023-12-27 13:09:52 -06:00
Stuart Tettemer 762e744aab
APM: Add Traceable interface to reduce server dependencies in telemetry (#103593)
`Tracer.startTrace` has overloaded methods for accepting `RestRequest` and `Task.` In order to implement static registration, we want to move APM into a library. Accepting these two types as parameters creates a dependency on server that needs to be removed for telemetry into lib.

This change removes the overloaded method in favor of the `Traceable` interface allows `Tracer` to get the `SpanId`.

The `ThreadContext` argument also creates a dependency on server, but that is more involved and will be addressed in another change.
2023-12-27 09:00:31 -06:00
Przemyslaw Gomulka 52c2011e84
Add debug logger when registering a metric (#103458)
This commit adds a log message at debug level when a metric is registered. This allows to start elasticsearch with a level changed for the apm package and get a list of metric names.
It should be useful when trying to came up with a new meteric name the command to run
./gradlew run -Dtests.es.logger.org.elasticsearch.telemetry.apm=debug
2023-12-18 10:38:13 +01:00
Przemyslaw Gomulka 12f5f96345
[fix] readme for APM metrics (#103428)
in previous #103400
I forgot to commit a code review follow up
2023-12-14 12:49:32 +01:00
Przemyslaw Gomulka c39a59503c
Add readme for APM metrics (#103400)
this commit adds documentation about the APM metrics usage in Elasticsearch
2023-12-14 11:25:14 +01:00
Lorenzo Dematté 7748638551
Adding metric guidelines to the repository (#103329) 2023-12-12 19:21:20 +01:00
Przemyslaw Gomulka 543919b7f3
Enable APM tracing when --with-apm-server is used (#103268)
when runtask (gradlew run) task is run with --with-apm-server apm tracing should also be enabled
2023-12-11 15:12:28 +01:00
Stuart Tettemer ab12d4e362
Metrics: Handle null observations in observers (#103091)
Avoid null pointer error when an observation is null [0].
* To get the tests working, replace the this-escape buildInstrument with a Builder.
* Removes locking around close
2023-12-08 09:24:10 -06:00
Stuart Tettemer 18691593e8
Metrics: Allow AsyncCounters to switch providers (#103025)
{Double,Long}AsyncCounters were not in the registrar list so they were not included when switching providers.

Other changes:
* Moved DoubleAsyncCounter's register and get to match the order of the rest of APMMeterRegistry.
* Fixed RecordingOtelMeter's Histogram and DoubleUpDownCounter
* Fixed String format in RecordingMeter's asserts.
2023-12-08 09:22:22 -06:00