Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabling configuration of jfr params #371

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion newrelic-agent/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ dependencies {
}

shadowIntoJar("com.newrelic.agent.java:newrelic-module-util-java:2.0")
shadowIntoJar("com.newrelic:jfr-daemon:1.4.0")
shadowIntoJar("com.newrelic:jfr-daemon:1.5.0")
shadowIntoJar 'org.ow2.asm:asm:8.0.1'
shadowIntoJar 'org.ow2.asm:asm-tree:8.0.1'
shadowIntoJar 'org.ow2.asm:asm-commons:8.0.1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ public interface JfrConfig {
*/
boolean isEnabled();

/**
* The harvest interval to be used by the JfrController to trigger a harvest.
* @return the amount of seconds between two JFR data harvests
*/
Integer getHarvestInterval();

/**
* The size of the queue that holds JFR's RecordedEvents to be processed in each harvest.
* @return the number of events to process
*/
Integer getQueueSize();

/**
* Check if audit_logging is enabled for the JFR service.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

package com.newrelic.agent.config;

import com.newrelic.jfr.daemon.DaemonConfig;

import java.util.Collections;
import java.util.Map;

Expand All @@ -18,12 +20,19 @@ class JfrConfigImpl extends BaseConfig implements JfrConfig {
public static final String AUDIT_LOGGING = "audit_logging";
public static final Boolean AUDIT_LOGGING_DEFAULT = Boolean.FALSE;
public static final Boolean USE_LICENSE_KEY_DEFAULT = Boolean.TRUE;
public static final String HARVEST_INTERVAL = "harvest_interval";
public static final String QUEUE_SIZE = "queue_size";
Copy link
Contributor

Choose a reason for hiding this comment

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

If the intent is for these to be publicly configurable then we'll probably want them in the default yaml: https://github.com/newrelic/newrelic-java-agent/blob/main/newrelic-agent/src/main/resources/newrelic.yml#L274-L289

And also in the usage section of the readme: https://github.com/newrelic/newrelic-jfr-core#usage-for-new-relic-java-agent-jfr-service

Thats said, I'm not sure if the intent is for these to be publicized as of yet...


private final boolean isEnabled;
private final Integer harvestInterval;
private final Integer queueSize;


public JfrConfigImpl(Map<String, Object> pProps) {
super(pProps, SYSTEM_PROPERTY_ROOT);
isEnabled = getProperty(ENABLED, ENABLED_DEFAULT);
harvestInterval = getProperty(HARVEST_INTERVAL, DaemonConfig.DEFAULT_HARVEST_INTERVAL);
queueSize = getProperty(QUEUE_SIZE, DaemonConfig.DEFAULT_QUEUE_SIZE);
}

static JfrConfigImpl createJfrConfig(Map<String, Object> settings) {
Expand All @@ -38,6 +47,16 @@ public boolean isEnabled() {
return isEnabled;
}

@Override
public Integer getHarvestInterval() {
return harvestInterval;
}

@Override
public Integer getQueueSize() {
return queueSize;
}

@Override
public boolean auditLoggingEnabled() {
return getProperty(AUDIT_LOGGING, AUDIT_LOGGING_DEFAULT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ DaemonConfig buildDaemonConfig() {
.apiKey(defaultAgentConfig.getLicenseKey())
.monitoredAppName(defaultAgentConfig.getApplicationName())
.auditLogging(jfrConfig.auditLoggingEnabled())
.harvestInterval(jfrConfig.getHarvestInterval())
.queueSize(jfrConfig.getQueueSize())
.metricsUri(URI.create(defaultAgentConfig.getMetricIngestUri()))
.eventsUri(URI.create(defaultAgentConfig.getEventIngestUri()))
.proxyHost(defaultAgentConfig.getProxyHost())
Expand Down