httpv1

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 15, 2026 License: MIT Imports: 5 Imported by: 3

Documentation

Overview

Package httpv1 provides the normalized HTTP request log record v1.

Index

Constants

View Source
const (
	SchemaVersion = "logschema.http.request/v1"
	Kind          = "http.request"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Request

type Request struct {
	SchemaVersion        string               `json:"schema_version"`
	Kind                 string               `json:"kind"`
	TimeUnixNano         *corev1.DecimalInt64 `json:"time_unix_nano"`
	ObservedTimeUnixNano *corev1.DecimalInt64 `json:"observed_time_unix_nano"`
	DurationNano         corev1.DecimalUint64 `json:"duration_nano"`
	Source               corev1.Source        `json:"source"`
	Resource             corev1.Resource      `json:"resource"`
	TraceContext         *corev1.TraceContext `json:"trace_context"`
	Data                 RequestData          `json:"data"`
}

func NewRequest

func NewRequest(
	durationNano corev1.DecimalUint64,
	source corev1.Source,
	data RequestData,
) (Request, error)

NewRequest creates and validates an HTTP request record with canonical metadata.

func (Request) MarshalJSON

func (r Request) MarshalJSON() ([]byte, error)

MarshalJSON validates and encodes an HTTP request record.

func (*Request) UnmarshalJSON

func (r *Request) UnmarshalJSON(data []byte) error

func (Request) Validate

func (r Request) Validate() error

type RequestData

type RequestData struct {
	Method                string                `json:"method"`
	URLScheme             *string               `json:"url_scheme"`
	URLAuthority          *string               `json:"url_authority"`
	URLPath               string                `json:"url_path"`
	URLQuery              *string               `json:"url_query"`
	Route                 *string               `json:"route"`
	StatusCode            *int                  `json:"status_code"`
	RequestBodySizeBytes  *corev1.DecimalUint64 `json:"request_body_size_bytes"`
	ResponseBodySizeBytes *corev1.DecimalUint64 `json:"response_body_size_bytes"`
	Attributes            corev1.Attributes     `json:"attributes"`
}

func (RequestData) URI

func (d RequestData) URI() string

URI returns the request target derived from the path and query components.

func (RequestData) URLFull

func (d RequestData) URLFull() (string, bool)

URLFull returns an absolute URL when both scheme and authority are available.

func (RequestData) URLReference

func (d RequestData) URLReference() string

URLReference returns the most complete URL reference represented by the normalized components.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL