Google API Common Protos Client - Class HttpRequest (4.8.3)

Reference documentation and code samples for the Google API Common Protos Client class HttpRequest.

A common proto for logging HTTP requests. Only contains semantics defined by the HTTP specification. Product-specific logging information MUST be defined in a separate message.

Generated from protobuf message google.logging.type.HttpRequest

Namespace

Google \ Cloud \ Logging \ Type

Methods

__construct

Constructor.

Parameters
Name Description
data array

Optional. Data for populating the Message object.

↳ request_method string

The request method. Examples: "GET", "HEAD", "PUT", "POST".

↳ request_url string

The scheme (http, https), the host name, the path and the query portion of the URL that was requested. Example: "http://example.com/some/info?color=red".

↳ request_size int|string

The size of the HTTP request message in bytes, including the request headers and the request body.

↳ status int

The response code indicating the status of response. Examples: 200, 404.

↳ response_size int|string

The size of the HTTP response message sent back to the client, in bytes, including the response headers and the response body.

↳ user_agent string

The user agent sent by the client. Example: "Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET CLR 1.0.3705)".

↳ remote_ip string

The IP address (IPv4 or IPv6) of the client that issued the HTTP request. This field can include port information. Examples: "192.168.1.1", "10.0.0.1:80", "FE80::0202:B3FF:FE1E:8329".

↳ server_ip string

The IP address (IPv4 or IPv6) of the origin server that the request was sent to. This field can include port information. Examples: "192.168.1.1", "10.0.0.1:80", "FE80::0202:B3FF:FE1E:8329".

↳ referer string

The referer URL of the request, as defined in HTTP/1.1 Header Field Definitions.

↳ latency Google\Protobuf\Duration

The request processing latency on the server, from the time the request was received until the response was sent.

↳ cache_lookup bool

Whether or not a cache lookup was attempted.

↳ cache_hit bool

Whether or not an entity was served from cache (with or without validation).

↳ cache_validated_with_origin_server bool

Whether or not the response was validated with the origin server before being served from cache. This field is only meaningful if cache_hit is True.

↳ cache_fill_bytes int|string

The number of HTTP response bytes inserted into cache. Set only when a cache fill was attempted.

↳ protocol string

Protocol used for the request. Examples: "HTTP/1.1", "HTTP/2", "websocket"

getRequestMethod

The request method. Examples: "GET", "HEAD", "PUT", "POST".

Returns
Type Description
string

setRequestMethod

The request method. Examples: "GET", "HEAD", "PUT", "POST".

Parameter
Name Description
var string
Returns
Type Description
$this

getRequestUrl

The scheme (http, https), the host name, the path and the query portion of the URL that was requested.

Example: "http://example.com/some/info?color=red".

Returns
Type Description
string

setRequestUrl

The scheme (http, https), the host name, the path and the query portion of the URL that was requested.

Example: "http://example.com/some/info?color=red".

Parameter
Name Description
var string
Returns
Type Description
$this

getRequestSize

The size of the HTTP request message in bytes, including the request headers and the request body.

Returns
Type Description
int|string

setRequestSize

The size of the HTTP request message in bytes, including the request headers and the request body.

Parameter
Name Description
var int|string
Returns
Type Description
$this

getStatus

The response code indicating the status of response.

Examples: 200, 404.

Returns
Type Description
int

setStatus

The response code indicating the status of response.

Examples: 200, 404.

Parameter
Name Description
var int
Returns
Type Description
$this

getResponseSize

The size of the HTTP response message sent back to the client, in bytes, including the response headers and the response body.

Returns
Type Description
int|string

setResponseSize

The size of the HTTP response message sent back to the client, in bytes, including the response headers and the response body.

Parameter
Name Description
var int|string
Returns
Type Description
$this

getUserAgent

The user agent sent by the client. Example: "Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET CLR 1.0.3705)".

Returns
Type Description
string

setUserAgent

The user agent sent by the client. Example: "Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET CLR 1.0.3705)".

Parameter
Name Description
var string
Returns
Type Description
$this

getRemoteIp

The IP address (IPv4 or IPv6) of the client that issued the HTTP request. This field can include port information. Examples: "192.168.1.1", "10.0.0.1:80", "FE80::0202:B3FF:FE1E:8329".

Returns
Type Description
string

setRemoteIp

The IP address (IPv4 or IPv6) of the client that issued the HTTP request. This field can include port information. Examples: "192.168.1.1", "10.0.0.1:80", "FE80::0202:B3FF:FE1E:8329".

Parameter
Name Description
var string
Returns
Type Description
$this

getServerIp

The IP address (IPv4 or IPv6) of the origin server that the request was sent to. This field can include port information. Examples: "192.168.1.1", "10.0.0.1:80", "FE80::0202:B3FF:FE1E:8329".

Returns
Type Description
string

setServerIp

The IP address (IPv4 or IPv6) of the origin server that the request was sent to. This field can include port information. Examples: "192.168.1.1", "10.0.0.1:80", "FE80::0202:B3FF:FE1E:8329".

Parameter
Name Description
var string
Returns
Type Description
$this

getReferer

The referer URL of the request, as defined in HTTP/1.1 Header Field Definitions.

Returns
Type Description
string

setReferer

The referer URL of the request, as defined in HTTP/1.1 Header Field Definitions.

Parameter
Name Description
var string
Returns
Type Description
$this

getLatency

The request processing latency on the server, from the time the request was received until the response was sent.

Returns
Type Description
Google\Protobuf\Duration|null

hasLatency

clearLatency

setLatency

The request processing latency on the server, from the time the request was received until the response was sent.

Parameter
Name Description
var Google\Protobuf\Duration
Returns
Type Description
$this

getCacheLookup

Whether or not a cache lookup was attempted.

Returns
Type Description
bool

setCacheLookup

Whether or not a cache lookup was attempted.

Parameter
Name Description
var bool
Returns
Type Description
$this

getCacheHit

Whether or not an entity was served from cache (with or without validation).

Returns
Type Description
bool

setCacheHit

Whether or not an entity was served from cache (with or without validation).

Parameter
Name Description
var bool
Returns
Type Description
$this

getCacheValidatedWithOriginServer

Whether or not the response was validated with the origin server before being served from cache. This field is only meaningful if cache_hit is True.

Returns
Type Description
bool

setCacheValidatedWithOriginServer

Whether or not the response was validated with the origin server before being served from cache. This field is only meaningful if cache_hit is True.

Parameter
Name Description
var bool
Returns
Type Description
$this

getCacheFillBytes

The number of HTTP response bytes inserted into cache. Set only when a cache fill was attempted.

Returns
Type Description
int|string

setCacheFillBytes

The number of HTTP response bytes inserted into cache. Set only when a cache fill was attempted.

Parameter
Name Description
var int|string
Returns
Type Description
$this

getProtocol

Protocol used for the request. Examples: "HTTP/1.1", "HTTP/2", "websocket"

Returns
Type Description
string

setProtocol

Protocol used for the request. Examples: "HTTP/1.1", "HTTP/2", "websocket"

Parameter
Name Description
var string
Returns
Type Description
$this