Modifier and Type | Method and Description |
---|---|
Context |
build()
Creates a
Context object for this builder. |
Context.Builder |
loadCloudTraceContext(String cloudTrace)
Sets the trace id and span id values by parsing the string which represents xCloud Trace
Context.
|
Context.Builder |
loadW3CTraceParentContext(String traceParent)
Sets the trace id and span id values by parsing the string which represents the standard W3C
trace context propagation header.
|
Context.Builder |
setReferer(String referer)
Sets the referer URL of the request, as defined in HTTP/1.1 Header Field Definitions.
|
Context.Builder |
setRemoteIp(String remoteIp)
Sets the IP address (IPv4 or IPv6) of the client that issued the HTTP request.
|
Context.Builder |
setRequest(HttpRequest request)
Sets the HTTP request.
|
Context.Builder |
setRequestMethod(HttpRequest.RequestMethod method)
Sets the HTTP request method.
|
Context.Builder |
setRequestUrl(String url) |
Context.Builder |
setServerIp(String serverIp)
Sets the IP address (IPv4 or IPv6) of the origin server that the request was sent to.
|
Context.Builder |
setSpanId(String spanId)
Sets the string as a span id value.
|
Context.Builder |
setTraceId(String traceId)
Sets the string as a trace id value.
|
@CanIgnoreReturnValue public Context.Builder setRequest(HttpRequest request)
@CanIgnoreReturnValue public Context.Builder setRequestUrl(String url)
@CanIgnoreReturnValue public Context.Builder setRequestMethod(HttpRequest.RequestMethod method)
@CanIgnoreReturnValue public Context.Builder setReferer(String referer)
@CanIgnoreReturnValue public Context.Builder setRemoteIp(String remoteIp)
192.168.1.1
, FE80::0202:B3FF:FE1E:8329
.@CanIgnoreReturnValue public Context.Builder setServerIp(String serverIp)
192.168.1.1
, FE80::0202:B3FF:FE1E:8329
.@CanIgnoreReturnValue public Context.Builder setTraceId(String traceId)
@CanIgnoreReturnValue public Context.Builder setSpanId(String spanId)
@CanIgnoreReturnValue public Context.Builder loadCloudTraceContext(String cloudTrace)
x-cloud-trace-context
header (can be in
Pascal case format). The string format is TRACE_ID/SPAN_ID;o=TRACE_TRUE
.@CanIgnoreReturnValue public Context.Builder loadW3CTraceParentContext(String traceParent)
traceparent
header. The method currently supports ONLY version "00"
. The string
format is 00-TRACE_ID-SPAN_ID-FLAGS
. field of the version-format
value.IllegalArgumentException
- if passed argument does not follow the @W3C trace format or
the format version is not supported.Copyright © 2023 Google LLC. All rights reserved.