Documentation ¶
Overview ¶
Package def provides default values for both commands and tests.
Index ¶
Constants ¶
View Source
const ( LogServer = "server" // "OpenAPI", "gRPC", "Prometheus metrics", etc. LogRemote = "remote" // Aligned IPv4:Port " 192.168.0.42:1234 ". LogAddr = "addr" // host:port. LogHost = "host" // DNS hostname or IPv4/IPv6 address. LogPort = "port" // TCP/UDP port number. LogHTTPMethod = "httpMethod" // GET, POST, etc. LogHTTPStatus = "httpStatus" // Status code: 200, 404, etc. LogFunc = "func" // RPC/event handler method name, REST resource path. LogUserID = "userID" )
Log field names.
Variables ¶
View Source
var ( ProgName = strings.TrimSuffix(path.Base(os.Args[0]), ".test") Hostname, _ = os.Hostname() TestSecond = time.Duration(float64(time.Second) * testTimeFactor) TestTimeout = 7 * TestSecond )
Constants.
Functions ¶
func FromContext ¶ added in v1.2.0
FromContext returns all values which might be stored in context using NewContext* functions of this package.
Types ¶
type Ctx ¶ added in v1.2.0
func NewContextWithRemoteIP ¶ added in v1.2.0
NewContextWithRemoteIP creates and returns new context containing given remoteIP.
type Metrics ¶
type Metrics struct { PanicsTotal prometheus.Counter MisconfigurationTotal prometheus.Counter }
Metrics shared by all packages.
func NewMetrics ¶
func NewMetrics(reg *prometheus.Registry) Metrics
NewMetrics registers and returns metrics shared by all packages.
Click to show internal directories.
Click to hide internal directories.