glo

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2022 License: Apache-2.0 Imports: 5 Imported by: 3

Documentation

Overview

Package glo helps with google cloud logging

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogCriticalNoRetry

func LogCriticalNoRetry(ev EntryValues,
	description string,
	assetType string,
	ruleName string)

LogCriticalNoRetry logs the critical error before giving up, aka not retry

func LogCriticalRetry

func LogCriticalRetry(ev EntryValues,
	description string,
	assetType string,
	ruleName string)

LogCriticalRetry logs the creitical error before crashing execution, aka asking for a retry

func LogFinish

func LogFinish(ev EntryValues,
	message string,
	description string,
	end time.Time,
	assetInventoryOrigin string,
	assetType string,
	ruleName string)

LogFinish logs the end of a successfull execution with data enabling measurement

func LogInfo

func LogInfo(ev EntryValues, message string, description string)

LogInfo logs information

func LogInitColdStart

func LogInitColdStart(ev EntryValues)

LogInitColdStart logs the start of the coldstart actions

func LogInitDone

func LogInitDone(ev EntryValues, latencySeconds float64)

LogInitDone logs sucessfull end of the cold start actions and enables to measure it

func LogInitFatal

func LogInitFatal(ev EntryValues, description string, err error)

LogInitFatal logs a critical error and crashes the init function so that deployment fails

func LogStartCloudEvent

func LogStartCloudEvent(ev EntryValues,
	cloudEventJSONBytes []byte,
	triggeringEventAgeSeconds float64,
	now *time.Time)

LogStartCloudEvent logs the start of the entrypoint function and the triggering cloud event

func LogWarning

func LogWarning(ev EntryValues, message string, description string)

LogWarning logs a non blocking issue

Types

type ComonEntryValues

type ComonEntryValues struct {
	Environment           string
	InitID                string
	LogOnlySeveritylevels string
	MicroserviceName      string
}

ComonEntryValues structure used for common value to logging entries

type Entry

type Entry struct {
	MicroserviceName           string     `json:"microservice_name,omitempty"`
	InstanceName               string     `json:"instance_name,omitempty"`
	Environment                string     `json:"environment,omitempty"`
	Severity                   string     `json:"severity,omitempty"`
	Message                    string     `json:"message"`
	Description                string     `json:"description,omitempty"`
	Now                        *time.Time `json:"now,omitempty"`
	Trace                      string     `json:"logging.googleapis.com/trace,omitempty"`
	Component                  string     `json:"component,omitempty"`
	InitID                     string     `json:"init_id,omitempty"`
	TriggeringPubsubID         string     `json:"triggering_pubsub_id,omitempty"`
	TriggeringEventID          string     `json:"triggering_event_id,omitempty"`
	TriggeringPubsubTimestamp  *time.Time `json:"triggering_pubsub_timestamp,omitempty"`
	TriggeringEventTimestamp   *time.Time `json:"triggering_event_timestamp,omitempty"`
	TriggeringPubsubAgeSeconds float64    `json:"triggering_pubsub_age_seconds,omitempty"`
	TriggeringEventAgeSeconds  float64    `json:"triggering_event_age_seconds,omitempty"`
	OriginEventID              string     `json:"origin_event_id,omitempty"`
	OriginEventTimestamp       *time.Time `json:"origin_event_timestamp,omitempty"`
	LatencySeconds             float64    `json:"latency_seconds,omitempty"`
	LatencyE2ESeconds          float64    `json:"latency_e2e_seconds,omitempty"`
	LatencyT2SSeconds          float64    `json:"latency_t2s_seconds,omitempty"`
	StepStack                  Steps      `json:"step_stack,omitempty"`
	StepStackLength            int        `json:"step_stack_length,omitempty"`
	Compliant                  bool       `json:"compliant,omitempty"`
	AssetInventoryOrigin       string     `json:"assetInventoryOrigin,omitempty"`
	AssetType                  string     `json:"assetType,omitempty"`
	RuleName                   string     `json:"ruleName,omitempty"`
}

Entry defines a Google Cloud logging structured entry https://cloud.google.com/logging/docs/agent/configuration#special-fields

func (Entry) String

func (e Entry) String() string

String renders an entry structure to the JSON format expected by Cloud Logging.

type EntryValues

type EntryValues struct {
	ComonEntryValues ComonEntryValues
	Step             Step
	StepStack        Steps
}

EntryValues structure used by logging functions

type Step

type Step struct {
	StepID        string    `json:"step_id,omitempty"`
	StepTimestamp time.Time `json:"step_timestamp,omitempty"`
}

Step defines a step in a serverless chain of events

type Steps

type Steps []Step

Steps defines a stack of step

Jump to

Keyboard shortcuts

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