use of com.newrelic.agent.config.AgentConfig in project newrelic-java-agent by newrelic.
the class Transaction method getLogEventData.
public Logs getLogEventData() {
Logs logEventData = logEvents.get();
if (logEventData == null) {
AgentConfig defaultConfig = ServiceFactory.getConfigService().getDefaultAgentConfig();
logEvents.compareAndSet(null, ServiceFactory.getServiceManager().getLogSenderService().getTransactionLogs(defaultConfig));
logEventData = logEvents.get();
}
return logEventData;
}
use of com.newrelic.agent.config.AgentConfig in project newrelic-java-agent by newrelic.
the class Transaction method getInsightsData.
public Insights getInsightsData() {
Insights insightsData = insights.get();
if (insightsData == null) {
AgentConfig defaultConfig = ServiceFactory.getConfigService().getDefaultAgentConfig();
insights.compareAndSet(null, ServiceFactory.getServiceManager().getInsights().getTransactionInsights(defaultConfig));
insightsData = insights.get();
}
return insightsData;
}
use of com.newrelic.agent.config.AgentConfig in project newrelic-java-agent by newrelic.
the class AgentLinkingMetadata method getLinkingMetadata.
/**
* Get a map of all agent linking metadata.
*
* @param traceMetadata TraceMetadataImpl instance to get spanId and traceId
* @param configService ConfigService to get hostName and entityName
* @param rpmService IRPMService to get entityGuid
* @return Map of all agent linking metadata
*/
public static Map<String, String> getLinkingMetadata(TraceMetadata traceMetadata, ConfigService configService, IRPMService rpmService) {
AgentConfig agentConfig = configService.getDefaultAgentConfig();
Map<String, String> linkingMetadata = new ConcurrentHashMap<>();
linkingMetadata.put(TRACE_ID, getTraceId(traceMetadata));
linkingMetadata.put(SPAN_ID, getSpanId(traceMetadata));
linkingMetadata.put(HOSTNAME, getHostname(agentConfig));
linkingMetadata.put(ENTITY_NAME, getEntityName(agentConfig));
linkingMetadata.put(ENTITY_TYPE, getEntityType());
try {
String entityGuid = getEntityGuid(rpmService);
if (!entityGuid.isEmpty()) {
linkingMetadata.put(ENTITY_GUID, entityGuid);
}
} catch (NullPointerException ignored) {
logWarning();
}
return linkingMetadata;
}
use of com.newrelic.agent.config.AgentConfig in project newrelic-java-agent by newrelic.
the class ExtensionService method getExtensionDirectory.
/**
* Retrieves the extension directory using the config property or the default directory.
*
* @return The config directory as a file or null if the directory does not exist or is not readable.
*/
private File getExtensionDirectory() {
AgentConfig agentConfig = config.getDefaultAgentConfig();
String configDirName = agentConfig.getProperty(AgentConfigImpl.EXT_CONFIG_DIR);
if (configDirName == null) {
configDirName = ConfigFileHelper.getNewRelicDirectory() + File.separator + ExtensionConversionUtility.DEFAULT_CONFIG_DIRECTORY;
}
File configDir = new File(configDirName);
if (!configDir.exists()) {
Agent.LOG.log(Level.FINE, "The extension directory " + configDir.getAbsolutePath() + " does not exist.");
configDir = null;
} else if (!configDir.isDirectory()) {
Agent.LOG.log(Level.WARNING, "The extension directory " + configDir.getAbsolutePath() + " is not a directory.");
configDir = null;
} else if (!configDir.canRead()) {
Agent.LOG.log(Level.WARNING, "The extension directory " + configDir.getAbsolutePath() + " is not readable.");
configDir = null;
}
return configDir;
}
use of com.newrelic.agent.config.AgentConfig in project newrelic-java-agent by newrelic.
the class ClassTransformerServiceImpl method isRetransformationSupported.
private boolean isRetransformationSupported(InstrumentationProxy instrProxy) {
AgentConfig config = ServiceFactory.getConfigService().getDefaultAgentConfig();
Boolean enableClassRetransformation = config.getProperty(AgentConfigImpl.ENABLE_CLASS_RETRANSFORMATION);
if (enableClassRetransformation != null) {
return enableClassRetransformation;
}
try {
return instrProxy.isRetransformClassesSupported();
} catch (Exception e) {
// AIX throws an UnsupportedOperationException
String msg = MessageFormat.format("Unexpected error asking current JVM configuration if it supports retransformation of classes: {0}", e);
getLogger().warning(msg);
return false;
}
}
Aggregations