Skip to content

Pass jfr, gc and jit telemetry devices to the provisioned pipelines - #143

Open
syahra712 wants to merge 1 commit into
apache:mainfrom
syahra712:telemetry-jvm-devices
Open

syahra712 wants to merge 1 commit into
apache:mainfrom
syahra712:telemetry-jvm-devices

Conversation

@syahra712

Copy link
Copy Markdown
Contributor

Description

--telemetry jfr, gc and jit did nothing under run. SolrProvisioner already appends each device's instrument_java_opts() to SOLR_OPTS, but solr_from_distribution and solr_from_sources never passed it any telemetry_devices.

This PR adds _create_jvm_telemetry_devices(cfg) to test_run_orchestrator.py. It builds FlightRecorder, Gc and JitCompiler from telemetry.devices / telemetry.params and returns only the enabled ones. It has to filter because the provisioner adds flags from every device it gets, not just the enabled ones. Both pipelines now pass the result to SolrProvisioner. Output goes to <test-run-dir>/telemetry/, so gc.log, profile.jfr and jit.log sit next to test_run.json. That directory is also outside the install dir, which clean() deletes on teardown.

I left the docker pipeline unchanged on purpose. The device flags contain host paths, and the JVM in the container exits on startup if it can't open them. With solr:9 I get Error opening log file '...gc.log': No such file or directory, then Could not create the Java Virtual Machine. Docker needs the log-storage change discussed in #138, so it comes in the second PR, together with heapdump.

docs/reference/telemetry.md now lists from-distribution / from-sources for these three devices and gives the output path. The multi-device example also uses from-distribution instead of docker.

Issues Resolved

Part of #138 (this covers from-distribution and from-sources; Docker and heapdump follow in a second PR)

Testing

  • New functionality includes testing

New tests in tests/test_execution_orchestrator_test.py:

  • test_from_distribution_passes_jvm_telemetry_devices and test_from_sources_passes_jvm_telemetry_devices run each pipeline with SolrProvisioner mocked and check the telemetry_devices it receives. On main they fail with KeyError: 'telemetry_devices'.
  • test_jvm_telemetry_devices_add_their_flags_to_solr_opts passes the devices to a real SolrProvisioner and checks that _build_env()["SOLR_OPTS"] contains the -Xlog:gc...:file=.../gc.log, StartFlightRecording...filename=.../profile.jfr and -XX:LogFile=.../jit.log flags. It also checks that gc-log-config from --telemetry-params is respected.
  • Two tests for the helper itself: it returns only enabled devices (segment-stats in the list is ignored) and nothing when --telemetry is empty.

The full tests/ suite passes locally on Python 3.13 (1180 passed, 5 skipped), and so does ruff check .. I haven't run the integration suite (it/).


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

The from-distribution and from-sources pipelines created SolrProvisioner
without telemetry_devices, so --telemetry jfr/gc/jit added nothing to
SOLR_OPTS. Build the enabled devices from telemetry.devices and
telemetry.params and pass them in. Output goes to the test run's
telemetry directory.

Docker is left out on purpose: the flags point at host paths, which the
JVM inside the container cannot open. That part needs the log storage
change discussed in apache#138.

Part of apache#138

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant