use of com.nr.agent.instrumentation.httpurlconnection.MetricState in project newrelic-java-agent by newrelic.
the class HttpURLConnection method getInputStream.
@Trace(leaf = true)
public synchronized InputStream getInputStream() throws IOException {
MetricState metricState = lazyGetMetricState();
TracedMethod method = AgentBridge.getAgent().getTracedMethod();
metricState.getInputStreamPreamble(connected, this, method);
InputStream inputStream;
try {
// This does a network request (if getResponseCode() wasn't called first)
inputStream = Weaver.callOriginal();
} catch (Exception e) {
// This is the default legacy behavior of the AbstractExternalComponentTracer
if (e instanceof UnknownHostException) {
method.setMetricName("External", "UnknownHost", "HttpURLConnection");
}
throw e;
}
metricState.getInboundPostamble(this, method);
return inputStream;
}
use of com.nr.agent.instrumentation.httpurlconnection.MetricState in project newrelic-java-agent by newrelic.
the class HttpURLConnection method getResponseCode.
@Trace(leaf = true)
public int getResponseCode() throws Exception {
MetricState metricState = lazyGetMetricState();
TracedMethod method = AgentBridge.getAgent().getTracedMethod();
metricState.getResponseCodePreamble(this, method);
int responseCodeValue;
try {
// This does a network request (if getInputStream() wasn't called first)
responseCodeValue = Weaver.callOriginal();
} catch (Exception e) {
// This is the default legacy behavior of the AbstractExternalComponentTracer
if (e instanceof UnknownHostException) {
method.setMetricName("External", "UnknownHost", "HttpURLConnection");
}
throw e;
}
metricState.getInboundPostamble(this, method);
return responseCodeValue;
}
Aggregations