Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ private NoOpAgent() {

@Override
public Logger getLogger() {
return NoOpLogger.INSTANCE;
return com.newrelic.api.agent.Agent.noop().getLogger();
}

@Override
public Config getConfig() {
return NoOpConfig.Instance;
return com.newrelic.api.agent.Agent.noop().getConfig();
}

@Override
Expand All @@ -57,17 +57,17 @@ public Transaction getWeakRefTransaction(boolean createIfNotExists) {

@Override
public MetricAggregator getMetricAggregator() {
return NoOpMetricAggregator.INSTANCE;
return com.newrelic.api.agent.Agent.noop().getMetricAggregator();
}

@Override
public Insights getInsights() {
return NoOpInsights.INSTANCE;
return com.newrelic.api.agent.Agent.noop().getInsights();
}

@Override
public ErrorApi getErrorApi() {
return NoOpErrorApi.INSTANCE;
return com.newrelic.api.agent.Agent.noop().getErrorApi();
}

@Override
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

117 changes: 0 additions & 117 deletions agent-bridge/src/main/java/com/newrelic/agent/bridge/NoOpLogger.java

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
package com.newrelic.agent;

import com.newrelic.agent.bridge.AgentBridge;
import com.newrelic.agent.bridge.NoOpMetricAggregator;
import com.newrelic.agent.bridge.NoOpTracedMethod;
import com.newrelic.agent.bridge.NoOpTransaction;
import com.newrelic.agent.bridge.TracedMethod;
Expand Down Expand Up @@ -127,7 +126,7 @@ public MetricAggregator getMetricAggregator() {
} catch (Throwable t) {
Agent.LOG.log(Level.FINE, "getMetricAggregator() call failed : {0}", t.getMessage());
Agent.LOG.log(Level.FINEST, t, "getMetricAggregator() call failed");
return NoOpMetricAggregator.INSTANCE;
return com.newrelic.api.agent.Agent.noop().getMetricAggregator();
}
}

Expand Down
7 changes: 7 additions & 0 deletions newrelic-api/src/main/java/com/newrelic/api/agent/Agent.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@
* The New Relic Java Agent's API.
*/
public interface Agent {
/**
* Returns a no-op instance of the Agent api.
* @since 8.7.1
*/
static Agent noop() {
return NoOpAgent.INSTANCE;
}

/**
* Returns the current traced method. This can only be invoked within methods that are traced.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public final class NewRelic {
* @since 3.9.0
*/
public static Agent getAgent() {
return NoOpAgent.INSTANCE;
return Agent.noop();
}

// ************************** Metric API ****************************************//
Expand Down