Documentation ¶
Index ¶
- func ClientRequest(req *http.Request) []attribute.KeyValue
- func ClientResponse(resp *http.Response) []attribute.KeyValue
- func ClientStatus(code int) (codes.Code, string)
- type HTTPConv
- func (c *HTTPConv) ClientRequest(req *http.Request) []attribute.KeyValue
- func (c *HTTPConv) ClientResponse(resp *http.Response) []attribute.KeyValue
- func (c *HTTPConv) ClientStatus(code int) (codes.Code, string)
- func (c *HTTPConv) RequestHeader(h http.Header) []attribute.KeyValue
- func (c *HTTPConv) ResponseHeader(h http.Header) []attribute.KeyValue
- func (c *HTTPConv) ServerRequest(server string, req *http.Request) []attribute.KeyValue
- func (c *HTTPConv) ServerStatus(code int) (codes.Code, string)
- type NetConv
- func (c *NetConv) Client(address string, conn net.Conn) []attribute.KeyValue
- func (c *NetConv) Host(address string) []attribute.KeyValue
- func (c *NetConv) HostName(name string) attribute.KeyValue
- func (c *NetConv) HostPort(port int) attribute.KeyValue
- func (c *NetConv) Peer(address string) []attribute.KeyValue
- func (c *NetConv) PeerName(name string) attribute.KeyValue
- func (c *NetConv) PeerPort(port int) attribute.KeyValue
- func (c *NetConv) Server(address string, ln net.Listener) []attribute.KeyValue
- func (c *NetConv) SockPeerAddr(addr string) attribute.KeyValue
- func (c *NetConv) SockPeerPort(port int) attribute.KeyValue
- func (c *NetConv) Transport(network string) attribute.KeyValue
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClientRequest ¶
ClientRequest returns attributes for an HTTP request made by a client. The following attributes are always returned: "http.url", "http.flavor", "http.method", "net.peer.name". The following attributes are returned if the related values are defined in req: "net.peer.port", "http.user_agent", "http.request_content_length", "enduser.id".
func ClientResponse ¶
ClientResponse returns attributes for an HTTP response received by a client from a server. It will return the following attributes if the related values are defined in resp: "http.status.code", "http.response_content_length".
This does not add all OpenTelemetry required attributes for an HTTP event, it assumes ClientRequest was used to create the span with a complete set of attributes. If a complete set of attributes can be generated using the request contained in resp. For example:
append(ClientResponse(resp), ClientRequest(resp.Request)...)
Types ¶
type HTTPConv ¶
type HTTPConv struct { NetConv *NetConv EnduserIDKey attribute.Key HTTPClientIPKey attribute.Key HTTPFlavorKey attribute.Key HTTPMethodKey attribute.Key HTTPRequestContentLengthKey attribute.Key HTTPResponseContentLengthKey attribute.Key HTTPRouteKey attribute.Key HTTPSchemeHTTP attribute.KeyValue HTTPSchemeHTTPS attribute.KeyValue HTTPStatusCodeKey attribute.Key HTTPTargetKey attribute.Key HTTPURLKey attribute.Key HTTPUserAgentKey attribute.Key }
HTTPConv are the HTTP semantic convention attributes defined for a version of the OpenTelemetry specification.
func (*HTTPConv) ClientRequest ¶
ClientRequest returns attributes for an HTTP request made by a client. The following attributes are always returned: "http.url", "http.flavor", "http.method", "net.peer.name". The following attributes are returned if the related values are defined in req: "net.peer.port", "http.user_agent", "http.request_content_length", "enduser.id".
func (*HTTPConv) ClientResponse ¶
ClientResponse returns attributes for an HTTP response received by a client from a server. The following attributes are returned if the related values are defined in resp: "http.status.code", "http.response_content_length".
This does not add all OpenTelemetry required attributes for an HTTP event, it assumes ClientRequest was used to create the span with a complete set of attributes. If a complete set of attributes can be generated using the request contained in resp. For example:
append(ClientResponse(resp), ClientRequest(resp.Request)...)
func (*HTTPConv) ClientStatus ¶
ClientStatus returns a span status code and message for an HTTP status code value received by a client.
func (*HTTPConv) RequestHeader ¶
RequestHeader returns the contents of h as OpenTelemetry attributes.
func (*HTTPConv) ResponseHeader ¶
ResponseHeader returns the contents of h as OpenTelemetry attributes.
func (*HTTPConv) ServerRequest ¶
ServerRequest returns 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.
The following attributes are always returned: "http.method", "http.scheme", "http.flavor", "http.target", "net.host.name". The following attributes are returned if they related values are defined in req: "net.host.port", "net.sock.peer.addr", "net.sock.peer.port", "http.user_agent", "enduser.id", "http.client_ip".
type NetConv ¶
type NetConv struct { NetHostNameKey attribute.Key NetHostPortKey attribute.Key NetPeerNameKey attribute.Key NetPeerPortKey attribute.Key NetSockFamilyKey attribute.Key NetSockPeerAddrKey attribute.Key NetSockPeerPortKey attribute.Key NetSockHostAddrKey attribute.Key NetSockHostPortKey attribute.Key NetTransportOther attribute.KeyValue NetTransportTCP attribute.KeyValue NetTransportUDP attribute.KeyValue NetTransportInProc attribute.KeyValue }
NetConv are the network semantic convention attributes defined for a version of the OpenTelemetry specification.
func (*NetConv) Client ¶
Client returns attributes for a client network connection to address. See net.Dial for information about acceptable address values, address should be the same as the one used to create conn. If conn is nil, only network peer attributes will be returned that describe address. Otherwise, the socket level information about conn will also be included.
func (*NetConv) Server ¶
Server returns attributes for a network listener listening at address. See net.Listen for information about acceptable address values, address should be the same as the one used to create ln. If ln is nil, only network host attributes will be returned that describe address. Otherwise, the socket level information about ln will also be included.