use of com.nr.agent.instrumentation.grpc.GrpcResponse in project newrelic-java-agent by newrelic.
the class ServerStream_Instrumentation method close.
@Trace(async = true)
public void close(Status status, Metadata trailers) {
if (token != null) {
token.link();
Transaction transaction = NewRelic.getAgent().getTransaction();
transaction.setWebResponse(new GrpcResponse(status, trailers));
transaction.addOutboundResponseHeaders();
transaction.markResponseSent();
}
if (status != null) {
NewRelic.addCustomParameter("response.status", status.getCode().value());
if (GrpcConfig.errorsEnabled && status.getCause() != null) {
// If an error occurred during the close of this server call we should record it
NewRelic.noticeError(status.getCause());
}
}
Weaver.callOriginal();
if (token != null) {
token.expire();
token = null;
}
}
use of com.nr.agent.instrumentation.grpc.GrpcResponse in project newrelic-java-agent by newrelic.
the class ServerStream_Instrumentation method cancel.
// server had an internal error
@Trace(async = true)
public void cancel(Status status) {
if (token != null) {
token.link();
Transaction transaction = token.getTransaction();
transaction.setWebResponse(new GrpcResponse(status, new Metadata()));
transaction.addOutboundResponseHeaders();
transaction.markResponseSent();
}
if (status != null) {
NewRelic.addCustomParameter("response.status", status.getCode().value());
if (GrpcConfig.errorsEnabled && status.getCause() != null) {
// If an error occurred during the close of this server call we should record it
NewRelic.noticeError(status.getCause());
}
}
Weaver.callOriginal();
if (token != null) {
token.expire();
token = null;
}
}
Aggregations