Skip to content

Always attach APM Agent#144120

Merged
mamazzol merged 7 commits intoelastic:mainfrom
mamazzol:attach-agent
Mar 16, 2026
Merged

Always attach APM Agent#144120
mamazzol merged 7 commits intoelastic:mainfrom
mamazzol:attach-agent

Conversation

@mamazzol
Copy link
Copy Markdown
Contributor

@mamazzol mamazzol commented Mar 12, 2026

Until there is a clean migration away from the APM Agent for both metrics and tracing, always attach the APM Agent so that, if tracing is enabled later on, the agent is present to record.

ES-14013

@mamazzol mamazzol requested a review from a team as a code owner March 12, 2026 16:38
@elasticsearchmachine elasticsearchmachine added needs:triage Requires assignment of a team area label v9.4.0 labels Mar 12, 2026
Copy link
Copy Markdown
Contributor

@mosche mosche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, just a small nit re adding more utilities to ESTestCase

* @param key The key of the system property
*/
@SuppressForbidden(reason = "Uses System.setProperty")
protected void restoreSystemProperty(String value, String key) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: This kind of util is easy to use wrong, I would suggest to keep it in your test suite. If you want to share this, a test rule might be a better option or a utility that takes a closure so you can guarantee to reset after executing it

@mamazzol mamazzol added Team:Core/Infra Meta label for core/infra team :Core/Infra/Metrics Metrics and metering infrastructure >non-issue labels Mar 13, 2026
@elasticsearchmachine elasticsearchmachine removed the needs:triage Requires assignment of a team area label label Mar 13, 2026
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

@Before
public void setup() throws IOException, UserException {
userDir = System.getProperty("user.dir");
otelMetricsEnabled = System.getProperty(OTEL_METRICS_ENABLED_SYSTEM_PROPERTY);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are JVM-wide properties that could affect other tests that happen to be running at the same time. Is there a precedent for doing this in other tests? If not, I wonder if we ought to consider another approach like settings?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I managed to avoid having to modify the user.dir prop. The OTEL prop is still modified but it looks safe given that it's used specifically only for these tests.

import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;

@SuppressForbidden(reason = "Need to change value of system property to cover all the scenarios")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is too broad I think. We try to scope these @SuppressForbidden annotations to individual methods, and keep those methods very small.

@mamazzol mamazzol merged commit 078d695 into elastic:main Mar 16, 2026
36 checks passed
@mamazzol mamazzol deleted the attach-agent branch March 16, 2026 10:59
ncordon pushed a commit to ncordon/elasticsearch that referenced this pull request Mar 16, 2026
szybia added a commit to szybia/elasticsearch that referenced this pull request Mar 16, 2026
…elocations

* upstream/main: (33 commits)
  Unmute InferenceRestIT and DefaultEndPointsIT (elastic#144217)
  feat: add keep_alive to async task status (elastic#144010)
  Add explicit isNoOpUpdate() method to MapperService (elastic#144113)
  Always attach APM Agent (elastic#144120)
  Fix random_score nightly tests (elastic#144176)
  Add nested query checks for disabled sequence numbers (elastic#144185)
  Return sentinel values from Fetch when sequence numbers are disabled (elastic#144212)
  [Test] Test peer-recovery with sequence numbers pruning (elastic#144116)
  Remove `scaled-*` field assertions from mixed cluster downsampling test (elastic#144295)
  Refactor: Use range syntax in ES|QL exponential histogram tests (elastic#144110)
  Move resolve aliases to IndexAbstractionOptions (elastic#143953)
  unmute test (elastic#144299)
  Fix approximation csvtests (elastic#144233)
  fix test (elastic#144171)
  Add int4 vector scoring benchmarks (elastic#144105)
  Mute org.elasticsearch.xpack.esql.qa.single_node.GenerativeIT test elastic#143023
  Mute org.elasticsearch.test.apmintegration.MetricsApmIT testApmIntegration {withOTel=false} elastic#144282
  Native cli launcher (elastic#143712)
  Mute org.elasticsearch.xpack.esql.qa.multi_node.GenerativeIT test elastic#143023
  Mute org.elasticsearch.xpack.esql.heap_attack.HeapAttackSubqueryIT testManyRandomKeywordFieldsInSubqueryIntermediateResults elastic#144274
  ...
mamazzol added a commit to mamazzol/elasticsearch that referenced this pull request Mar 17, 2026
michalborek pushed a commit to michalborek/elasticsearch that referenced this pull request Mar 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Core/Infra/Metrics Metrics and metering infrastructure >non-issue Team:Core/Infra Meta label for core/infra team v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants