PR #88443 implemented a tracer using the Elastic APM Java agent. As discussed in the PR, it was necessary to write a temporary config file for the agent, in order to configure settings that cannot be dynamically set at runtime. Although this config file is rapidly deleted again, it is not ideal that we have to do it at all.

We need to investigate alternatives, which will require a conversation with the APM team about alternative approaches to configure the agent.
distribution/tools/server-cli/src/main/java/org/elasticsearch/server/cli/APMJvmOptions.java
propertiesMap.putAll(STATIC_CONFIG);
        return propertiesMap;
    }
    /**
     * Writes a Java properties file with data from supplied map to a temporary config, and returns
     * the file that was created.
     *
     * @param tmpdir        the directory for the file
     * @param propertiesMap the data to write
     * @return the file that was created
     * @throws IOException if writing the file fails
     */
    private static Path writeApmProperties(Path tmpdir, Map<String, String> propertiesMap) throws IOException {
        final Properties p = new Properties();
        p.putAll(propertiesMap);
        final Path tmpFile = Files.createTempFile(tmpdir, ".elstcapm.", ".tmp");
        try (OutputStream os = Files.newOutputStream(tmpFile)) {
            p.store(os, " Automatically generated by Elasticsearch, do not edit!");
        }
        return tmpFile;
    }
    /**
     * The JVM argument that configure the APM agent needs to specify the agent jar path, so this method
     * finds the jar by inspecting the filesystem.
     * @return the agent jar file
     * @throws IOException if a problem occurs reading the filesystem
     */
    @Nullable
    private static Path findAgentJar() throws IOException, UserException {
        final Path apmModule = Path.of(System.getProperty("user.dir")).resolve("modules/apm");