Documentation ¶
Index ¶
- func HTTPStatusCode(status int) attribute.KeyValue
- func SplitHostPort(hostport string) (host string, port int)
- type CurrentHTTPClient
- type CurrentHTTPServer
- type HTTPClient
- func (c HTTPClient) ErrorType(err error) attribute.KeyValue
- func (c HTTPClient) MetricOptions(ma MetricAttributes) MetricOpts
- func (s HTTPClient) RecordMetrics(ctx context.Context, md MetricData, opts MetricOpts)
- func (s HTTPClient) RecordResponseSize(ctx context.Context, responseData int64, opts metric.AddOption)
- func (c HTTPClient) RequestTraceAttrs(req *http.Request) []attribute.KeyValue
- func (c HTTPClient) ResponseTraceAttrs(resp *http.Response) []attribute.KeyValue
- func (c HTTPClient) Status(code int) (codes.Code, string)
- type HTTPServer
- func (s HTTPServer) RecordMetrics(ctx context.Context, md ServerMetricData)
- func (s HTTPServer) RequestTraceAttrs(server string, req *http.Request) []attribute.KeyValue
- func (s HTTPServer) ResponseTraceAttrs(resp ResponseTelemetry) []attribute.KeyValue
- func (s HTTPServer) Route(route string) attribute.KeyValue
- func (s HTTPServer) Status(code int) (codes.Code, string)
- type MetricAttributes
- type MetricData
- type MetricOpts
- type OldHTTPClient
- func (o OldHTTPClient) MetricAttributes(req *http.Request, statusCode int, additionalAttributes []attribute.KeyValue) []attribute.KeyValue
- func (o OldHTTPClient) RequestTraceAttrs(req *http.Request) []attribute.KeyValue
- func (o OldHTTPClient) ResponseTraceAttrs(resp *http.Response) []attribute.KeyValue
- type OldHTTPServer
- func (o OldHTTPServer) MetricAttributes(server string, req *http.Request, statusCode int, ...) []attribute.KeyValue
- func (o OldHTTPServer) RequestTraceAttrs(server string, req *http.Request) []attribute.KeyValue
- func (o OldHTTPServer) ResponseTraceAttrs(resp ResponseTelemetry) []attribute.KeyValue
- func (o OldHTTPServer) Route(route string) attribute.KeyValue
- type ResponseTelemetry
- type ServerMetricData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HTTPStatusCode ¶
HTTPStatusCode returns the attribute for the HTTP status code. This is a temporary function needed by metrics. This will be removed when MetricsRequest is added.
func SplitHostPort ¶ added in v0.58.0
SplitHostPort splits a network address hostport of the form "host", "host%zone", "[host]", "[host%zone], "host:port", "host%zone:port", "[host]:port", "[host%zone]:port", or ":port" into host or host%zone and port.
An empty host is returned if it is not provided or unparsable. A negative port is returned if it is not provided or unparsable.
Types ¶
type CurrentHTTPClient ¶ added in v0.58.0
type CurrentHTTPClient struct{}
func (CurrentHTTPClient) ErrorType ¶ added in v0.58.0
func (n CurrentHTTPClient) ErrorType(err error) attribute.KeyValue
func (CurrentHTTPClient) RequestTraceAttrs ¶ added in v0.58.0
func (n CurrentHTTPClient) RequestTraceAttrs(req *http.Request) []attribute.KeyValue
RequestTraceAttrs returns trace attributes for an HTTP request made by a client.
func (CurrentHTTPClient) ResponseTraceAttrs ¶ added in v0.58.0
func (n CurrentHTTPClient) ResponseTraceAttrs(resp *http.Response) []attribute.KeyValue
ResponseTraceAttrs returns trace attributes for an HTTP response made by a client.
type CurrentHTTPServer ¶ added in v0.58.0
type CurrentHTTPServer struct{}
func (CurrentHTTPServer) RequestTraceAttrs ¶ added in v0.58.0
TraceRequest returns trace attributes for an HTTP request received by a server.
The server must be the primary server name if it is known. For example this would be the ServerName directive (https://httpd.apache.org/docs/2.4/mod/core.html#servername) for an Apache server, and the server_name directive (http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name) for an nginx server. More generically, the primary server name would be the host header value that matches the default virtual host of an HTTP server. It should include the host identifier and if a port is used to route to the server that port identifier should be included as an appropriate port suffix.
If the primary server name is not known, server should be an empty string. The req Host will be used to determine the server instead.
func (CurrentHTTPServer) ResponseTraceAttrs ¶ added in v0.58.0
func (n CurrentHTTPServer) ResponseTraceAttrs(resp ResponseTelemetry) []attribute.KeyValue
TraceResponse returns trace attributes for telemetry from an HTTP response.
If any of the fields in the ResponseTelemetry are not set the attribute will be omitted.
type HTTPClient ¶ added in v0.54.0
type HTTPClient struct {
// contains filtered or unexported fields
}
func NewHTTPClient ¶ added in v0.54.0
func NewHTTPClient(meter metric.Meter) HTTPClient
func (HTTPClient) ErrorType ¶ added in v0.54.0
func (c HTTPClient) ErrorType(err error) attribute.KeyValue
func (HTTPClient) MetricOptions ¶ added in v0.56.0
func (c HTTPClient) MetricOptions(ma MetricAttributes) MetricOpts
func (HTTPClient) RecordMetrics ¶ added in v0.56.0
func (s HTTPClient) RecordMetrics(ctx context.Context, md MetricData, opts MetricOpts)
func (HTTPClient) RecordResponseSize ¶ added in v0.56.0
func (HTTPClient) RequestTraceAttrs ¶ added in v0.54.0
func (c HTTPClient) RequestTraceAttrs(req *http.Request) []attribute.KeyValue
RequestTraceAttrs returns attributes for an HTTP request made by a client.
func (HTTPClient) ResponseTraceAttrs ¶ added in v0.54.0
func (c HTTPClient) ResponseTraceAttrs(resp *http.Response) []attribute.KeyValue
ResponseTraceAttrs returns metric attributes for an HTTP request made by a client.
type HTTPServer ¶
type HTTPServer struct {
// contains filtered or unexported fields
}
func NewHTTPServer ¶
func NewHTTPServer(meter metric.Meter) HTTPServer
func (HTTPServer) RecordMetrics ¶ added in v0.54.0
func (s HTTPServer) RecordMetrics(ctx context.Context, md ServerMetricData)
func (HTTPServer) RequestTraceAttrs ¶
RequestTraceAttrs returns trace attributes for an HTTP request received by a server.
The server must be the primary server name if it is known. For example this would be the ServerName directive (https://httpd.apache.org/docs/2.4/mod/core.html#servername) for an Apache server, and the server_name directive (http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name) for an nginx server. More generically, the primary server name would be the host header value that matches the default virtual host of an HTTP server. It should include the host identifier and if a port is used to route to the server that port identifier should be included as an appropriate port suffix.
If the primary server name is not known, server should be an empty string. The req Host will be used to determine the server instead.
func (HTTPServer) ResponseTraceAttrs ¶
func (s HTTPServer) ResponseTraceAttrs(resp ResponseTelemetry) []attribute.KeyValue
ResponseTraceAttrs returns trace attributes for telemetry from an HTTP response.
If any of the fields in the ResponseTelemetry are not set the attribute will be omitted.
type MetricAttributes ¶ added in v0.56.0
type MetricData ¶ added in v0.54.0
type MetricOpts ¶ added in v0.56.0
type MetricOpts struct {
// contains filtered or unexported fields
}
func (MetricOpts) AddOptions ¶ added in v0.56.0
func (o MetricOpts) AddOptions() metric.AddOption
func (MetricOpts) MeasurementOption ¶ added in v0.56.0
func (o MetricOpts) MeasurementOption() metric.MeasurementOption
type OldHTTPClient ¶ added in v0.58.0
type OldHTTPClient struct{}
func (OldHTTPClient) MetricAttributes ¶ added in v0.58.0
func (OldHTTPClient) RequestTraceAttrs ¶ added in v0.58.0
func (o OldHTTPClient) RequestTraceAttrs(req *http.Request) []attribute.KeyValue
func (OldHTTPClient) ResponseTraceAttrs ¶ added in v0.58.0
func (o OldHTTPClient) ResponseTraceAttrs(resp *http.Response) []attribute.KeyValue
type OldHTTPServer ¶ added in v0.58.0
type OldHTTPServer struct{}
func (OldHTTPServer) MetricAttributes ¶ added in v0.58.0
func (OldHTTPServer) RequestTraceAttrs ¶ added in v0.58.0
RequestTraceAttrs returns trace attributes for an HTTP request received by a server.
The server must be the primary server name if it is known. For example this would be the ServerName directive (https://httpd.apache.org/docs/2.4/mod/core.html#servername) for an Apache server, and the server_name directive (http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name) for an nginx server. More generically, the primary server name would be the host header value that matches the default virtual host of an HTTP server. It should include the host identifier and if a port is used to route to the server that port identifier should be included as an appropriate port suffix.
If the primary server name is not known, server should be an empty string. The req Host will be used to determine the server instead.
func (OldHTTPServer) ResponseTraceAttrs ¶ added in v0.58.0
func (o OldHTTPServer) ResponseTraceAttrs(resp ResponseTelemetry) []attribute.KeyValue
ResponseTraceAttrs returns trace attributes for telemetry from an HTTP response.
If any of the fields in the ResponseTelemetry are not set the attribute will be omitted.
type ResponseTelemetry ¶
type ServerMetricData ¶ added in v0.56.0
type ServerMetricData struct { ServerName string ResponseSize int64 MetricData MetricAttributes }