Documentation
¶
Overview ¶
Package semconv provides OpenTelemetry semantic convention types and functionality.
Package semconv provides OpenTelemetry semantic convention types and functionality.
Index ¶
- func SplitHostPort(hostport string) (host string, port int)
- type HTTPClient
- func (n HTTPClient) MetricAttributes(req *http.Request, statusCode int, additionalAttributes []attribute.KeyValue) []attribute.KeyValue
- func (n HTTPClient) MetricOptions(ma MetricAttributes) MetricOpts
- func (n HTTPClient) RecordMetrics(ctx context.Context, md MetricData, opts MetricOpts)
- func (n HTTPClient) RequestTraceAttrs(req *http.Request) []attribute.KeyValue
- func (n HTTPClient) ResponseTraceAttrs(resp *http.Response) []attribute.KeyValue
- func (n HTTPClient) Status(code int) (codes.Code, string)
- func (n HTTPClient) TraceAttributes(host string) []attribute.KeyValue
- type HTTPServer
- func (n HTTPServer) MetricAttributes(server string, req *http.Request, statusCode int, route string, ...) []attribute.KeyValue
- func (s HTTPServer) NetworkTransportAttr(network string) []attribute.KeyValue
- func (n HTTPServer) RecordMetrics(ctx context.Context, md ServerMetricData)
- func (n HTTPServer) RequestTraceAttrs(server string, req *http.Request, opts RequestTraceAttrsOpts) []attribute.KeyValue
- func (n HTTPServer) ResponseTraceAttrs(resp ResponseTelemetry) []attribute.KeyValue
- func (n HTTPServer) Route(route string) attribute.KeyValue
- func (n HTTPServer) Status(code int) (codes.Code, string)
- type MetricAttributes
- type MetricData
- type MetricOpts
- type RequestTraceAttrsOpts
- type ResponseTelemetry
- type ServerMetricData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SplitHostPort ¶
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 HTTPClient ¶
type HTTPClient struct {
// contains filtered or unexported fields
}
func NewHTTPClient ¶
func NewHTTPClient(meter metric.Meter) HTTPClient
func (HTTPClient) MetricAttributes ¶ added in v0.68.0
func (HTTPClient) MetricOptions ¶
func (n HTTPClient) MetricOptions(ma MetricAttributes) MetricOpts
func (HTTPClient) RecordMetrics ¶
func (n HTTPClient) RecordMetrics(ctx context.Context, md MetricData, opts MetricOpts)
func (HTTPClient) RequestTraceAttrs ¶
func (n HTTPClient) RequestTraceAttrs(req *http.Request) []attribute.KeyValue
RequestTraceAttrs returns trace attributes for an HTTP request made by a client.
func (HTTPClient) ResponseTraceAttrs ¶
func (n HTTPClient) ResponseTraceAttrs(resp *http.Response) []attribute.KeyValue
ResponseTraceAttrs returns trace attributes for an HTTP response made by a client.
func (HTTPClient) TraceAttributes ¶
func (n HTTPClient) TraceAttributes(host string) []attribute.KeyValue
TraceAttributes returns attributes for httptrace.
type HTTPServer ¶
type HTTPServer struct {
// contains filtered or unexported fields
}
func NewHTTPServer ¶
func NewHTTPServer(meter metric.Meter) HTTPServer
func (HTTPServer) MetricAttributes ¶ added in v0.68.0
func (HTTPServer) NetworkTransportAttr ¶
func (s HTTPServer) NetworkTransportAttr(network string) []attribute.KeyValue
func (HTTPServer) RecordMetrics ¶
func (n HTTPServer) RecordMetrics(ctx context.Context, md ServerMetricData)
func (HTTPServer) RequestTraceAttrs ¶
func (n HTTPServer) RequestTraceAttrs(server string, req *http.Request, opts RequestTraceAttrsOpts) []attribute.KeyValue
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 (n 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 ¶
type MetricData ¶
type MetricOpts ¶
type MetricOpts struct {
// contains filtered or unexported fields
}
func (MetricOpts) AddOptions ¶
func (o MetricOpts) AddOptions() metric.AddOption
func (MetricOpts) MeasurementOption ¶
func (o MetricOpts) MeasurementOption() metric.MeasurementOption
type RequestTraceAttrsOpts ¶
type RequestTraceAttrsOpts struct {
// If set, this is used as value for the "http.client_ip" attribute.
HTTPClientIP string
}
type ResponseTelemetry ¶
type ServerMetricData ¶
type ServerMetricData struct {
ServerName string
ResponseSize int64
MetricData
MetricAttributes
}