public class TraceWriter extends Object
RuntimePb.UPResponse.| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_MAX_TRACE |
static String |
MAX_TRACE_PROPERTY |
| Constructor and Description |
|---|
TraceWriter(com.google.apphosting.api.CloudTraceContext context,
MutableUpResponse upResponse) |
| Modifier and Type | Method and Description |
|---|---|
void |
addStackTrace(com.google.apphosting.api.CloudTraceContext context,
StackTraceElement[] stackTrace)
Add stack trace into the current span.
|
void |
endApiSpan(com.google.apphosting.api.CloudTraceContext context)
End the API span.
|
void |
endRequestSpan()
End the request span.
|
void |
endSpan(com.google.apphosting.api.CloudTraceContext context)
End the current span.
|
void |
flushTrace()
Flush collected trace into
RuntimePb.UPResponse. |
com.google.apphosting.api.CloudTraceContext |
getTraceContext()
Gets the current trace context.
|
static TraceWriter |
getTraceWriterForRequest(com.google.apphosting.base.protos.RuntimePb.UPRequest upRequest,
MutableUpResponse upResponse) |
void |
setLabel(com.google.apphosting.api.CloudTraceContext context,
String key,
String value)
Set a label on the current span.
|
com.google.apphosting.api.CloudTraceContext |
startApiSpan(com.google.apphosting.api.CloudTraceContext parentContext,
String packageName,
String methodName)
Start a API span as a child of the current span.
|
com.google.apphosting.api.CloudTraceContext |
startChildSpan(com.google.apphosting.api.CloudTraceContext parentContext,
String name)
Start a new span as a child of the given context.
|
void |
startRequestSpan(String name)
Start a request span as a child of the current span.
|
public static final int DEFAULT_MAX_TRACE
public static final String MAX_TRACE_PROPERTY
public TraceWriter(com.google.apphosting.api.CloudTraceContext context,
MutableUpResponse upResponse)
@Nullable public static TraceWriter getTraceWriterForRequest(com.google.apphosting.base.protos.RuntimePb.UPRequest upRequest, MutableUpResponse upResponse)
public com.google.apphosting.api.CloudTraceContext getTraceContext()
public void startRequestSpan(String name)
name - the name of the request spanpublic com.google.apphosting.api.CloudTraceContext startApiSpan(@Nullable com.google.apphosting.api.CloudTraceContext parentContext, String packageName, String methodName)
parentContext - the parent contextpackageName - the name of the API packagemethodName - the name of the method within the API packageCloudTraceContextpublic com.google.apphosting.api.CloudTraceContext startChildSpan(com.google.apphosting.api.CloudTraceContext parentContext,
String name)
parentContext - the parent contextname - the name of the child spanCloudTraceContextpublic void setLabel(com.google.apphosting.api.CloudTraceContext context,
String key,
String value)
context - the current contextkey - key of the labelvalue - value of the labelpublic void addStackTrace(com.google.apphosting.api.CloudTraceContext context,
StackTraceElement[] stackTrace)
context - the current contextstackTrace - stack trace to be addedpublic void endSpan(com.google.apphosting.api.CloudTraceContext context)
context - the current contextpublic void endApiSpan(com.google.apphosting.api.CloudTraceContext context)
context - the trace context of the API spanpublic void endRequestSpan()
public void flushTrace()
RuntimePb.UPResponse.Copyright © 2022. All rights reserved.