Skip to content

Commit

Permalink
NH-86006: enable profiling for benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
cleverchuk committed Jul 11, 2024
1 parent a45a24a commit 1a10b16
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,29 +39,11 @@

/** Span process to perform code profiling */
public class SolarwindsProfilingSpanProcessor implements SpanProcessor {
private static final Logger logger = LoggerFactory.getLogger();
private static final ProfilerSetting profilerSetting =
(ProfilerSetting) ConfigManager.getConfig(ConfigProperty.PROFILER);
private static final boolean PROFILER_ENABLED =
profilerSetting != null && profilerSetting.isEnabled();

static {
if (PROFILER_ENABLED) {
try {
Profiler.initialize(
profilerSetting,
ReporterFactory.getInstance()
.createQueuingEventReporter(
RpcClientManager.getClient(RpcClientManager.OperationType.PROFILING)));
} catch (ClientException e) {
logger.error("Error creating profiling report", e);
throw new RuntimeException(e);
}
} else {
logger.info("Profiler is disabled.");
}
}

@Override
public void onStart(@Nonnull Context parentContext, ReadWriteSpan span) {
if (span.getSpanContext().isSampled()) { // only profile on sampled spans
Expand Down
4 changes: 4 additions & 0 deletions long-running-test-arch/k8s/deployment-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ spec:
value: "petclinic"
- name: spring_datasource_password
value: "petclinic"
- name: SW_APM_PROFILER_ENABLED
value: "true"

---
apiVersion: apps/v1
Expand Down Expand Up @@ -124,6 +126,8 @@ spec:
value: "petclinic"
- name: spring_datasource_password
value: "petclinic"
- name: SW_APM_PROFILER_ENABLED
value: "true"

---
apiVersion: apps/v1
Expand Down

0 comments on commit 1a10b16

Please sign in to comment.