Remove load-generator module
MODIFY
gradle/java.gradle
gradle/java.gradle
@@ -24,7 +24,6 @@ def applyCodeCoverage = !(
project.path.startsWith(":smoke-tests") ||
//TODO why some tests fail on java 11 if jacoco is present?
project.path == ":javaagent" ||
- project.path == ":load-generator" ||
project.path.startsWith(":benchmark") ||
project.path.startsWith(":instrumentation") ||
project.path.startsWith(":testing-common"))

DELETE
load-generator/Readme.md
-Load Generator
-=====
-
-Generates a simulated trace load. Run with
-
-```
-./gradlew launch --args='--rate 10'
-```
-
-**OR**
-
-```
-./gradlew :java-agent:load-generator:launch --args='--rate 10'
-```
-
-from the root of the repo.
-
-To print all options, use:
-
-```
---args='--help'
-```

DELETE
load-generator/load-generator.gradle
-apply from: "$rootDir/gradle/java.gradle"
-
-dependencies {
- implementation project(':javaagent-bootstrap')
-
- implementation 'info.picocli:picocli:4.0.4'
- implementation "com.google.guava:guava"
-}
-
-task launch(type: JavaExec) {
- dependsOn ':javaagent:shadowJar'
- doFirst {
- classpath = sourceSets.main.runtimeClasspath
- main = 'io.opentelemetry.loadgenerator.LoadGenerator'
- jvmArgs = ["-javaagent:${project(':javaagent').shadowJar.archivePath}"]
- systemProperties System.properties
- }
-}

DELETE
load-generator/src/main/java/io/opentelemetry/loadgenerator/LoadGenerator.java
-/*
- * Copyright The OpenTelemetry Authors
- * SPDX-License-Identifier: Apache-2.0
- */
-
-package io.opentelemetry.loadgenerator;
-
-import com.google.common.util.concurrent.RateLimiter;
-import com.google.common.util.concurrent.Uninterruptibles;
-import io.opentelemetry.api.GlobalOpenTelemetry;
-import io.opentelemetry.api.trace.Span;
-import io.opentelemetry.api.trace.Tracer;
-import io.opentelemetry.context.Scope;
-import java.time.Duration;
-import java.util.concurrent.Callable;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicLong;
-import picocli.CommandLine;
-import picocli.CommandLine.Command;
-import picocli.CommandLine.Option;
-
-@Command(
- mixinStandardHelpOptions = true,
- description = "Generates traces and spans at a specified rate")
-@SuppressWarnings("SystemOut")
-public class LoadGenerator implements Callable<Integer> {
-
- private static final Tracer tracer = GlobalOpenTelemetry.getTracer("test");
-
- @Option(names = "--rate", required = true, description = "rate, per second, to generate traces")
- private int rate;
-
- @Option(
- names = "--threads",
- defaultValue = "6",
- description = "Number of trace-generating threads (default: ${DEFAULT-VALUE})")
- private int threads;
-
- @Option(
- names = "--width",
- defaultValue = "2",
- description = "Number of spans directly below the root (default: ${DEFAULT-VALUE})")
- private int width;
-
- @Option(
- names = "--depth",
- defaultValue = "3",
- description = "Total spans deep per trace, including parent (default: ${DEFAULT-VALUE})")
- private int depth;
-
- @Option(
- names = "--warmup",
- defaultValue = "5",
- description = "Time, in seconds, to ramp up to target rate (default: ${DEFAULT-VALUE})")
- private int warmupPeriod;
-
- @Option(
- names = "--print-interval",
- defaultValue = "20",
- description = "Interval, in seconds, to print statistics (default: ${DEFAULT-VALUE})")
- private int printInterval;
-
- private RateLimiter rateLimiter;
- private final AtomicLong tracesSent = new AtomicLong();
-
- @Override
- public Integer call() throws Exception {
- rateLimiter = RateLimiter.create(rate, warmupPeriod, TimeUnit.SECONDS);
-
- long intervalStart = System.currentTimeMillis();
- long tracesAtLastReport = 0;
-
- for (int i = 0; i < threads; i++) {
- Thread workerThread = new Thread(new Worker(), "Worker-" + i);
- workerThread.setDaemon(true);
- workerThread.start();
- }
-
- while (true) {
- Uninterruptibles.sleepUninterruptibly(Duration.ofSeconds(printInterval));
-
- long currentTracesSent = tracesSent.get();
- long intervalEnd = System.currentTimeMillis();
-
- double currentRate =
- (currentTracesSent - tracesAtLastReport) / ((intervalEnd - intervalStart) / 1000d);
-
- System.out.println(
- "Total Traces Sent: " + currentTracesSent + ", Rate this interval: " + currentRate);
- intervalStart = System.currentTimeMillis();
- tracesAtLastReport = currentTracesSent;
- }
- }
-
- public static void main(String[] args) {
- int exitCode = new CommandLine(new LoadGenerator()).execute(args);
- System.exit(exitCode);
- }
-
- private class Worker implements Runnable {
-
- @Override
- public void run() {
-
- while (true) {
- rateLimiter.acquire();
- Span parent = tracer.spanBuilder("parentSpan").startSpan();
-
- try (Scope scope = parent.makeCurrent()) {
- for (int i = 0; i < width; i++) {
- Span widthSpan = tracer.spanBuilder("span-" + i).startSpan();
- try (Scope widthScope = widthSpan.makeCurrent()) {
- for (int j = 0; j < depth - 2; j++) {
- Span depthSpan = tracer.spanBuilder("span-" + i + "-" + j).startSpan();
- try (Scope depthScope = depthSpan.makeCurrent()) {
- // do nothing. Maybe sleep? but that will mean we need more threads to keep the
- // effective rate
- } finally {
- depthSpan.end();
- }
- }
- } finally {
- widthSpan.end();
- }
- }
- } finally {
- parent.end();
- }
-
- tracesSent.getAndIncrement();
- }
- }
- }
-}

MODIFY
settings.gradle
settings.gradle
@@ -62,7 +62,6 @@ include ':javaagent-bootstrap-tests'
include ':javaagent-extension-api'
include ':javaagent-tooling'
include ':javaagent'
-include ':load-generator'
include ':bom-alpha'
include ':instrumentation-api'

Remove load-generator module (#3177)