gcplog

package
v1.6.2-0...-b66c343 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: AGPL-3.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GCPLogEntry

type GCPLogEntry struct {
	LogName  string `json:"logName"`
	Resource struct {
		Type   string            `json:"type"`
		Labels map[string]string `json:"labels"`
	} `json:"resource"`
	Timestamp string `json:"timestamp"`

	// The time the log entry was received by Logging.
	// Its important that `Timestamp` is optional in GCE log entry.
	ReceiveTimestamp string `json:"receiveTimestamp"`

	// Optional. The severity of the log entry. The default value is DEFAULT.
	// DEFAULT, DEBUG, INFO, NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY
	// https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry#LogSeverity
	Severity string `json:"severity"`

	// Optional. A map of key, value pairs that provides additional information about the log entry.
	// The labels can be user-defined or system-defined.
	Labels map[string]string `json:"labels"`

	TextPayload string `json:"textPayload"`
}

GCPLogEntry that will be written to the pubsub topic. According to the following spec. https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry nolint:revive

type GcplogTargetManager

type GcplogTargetManager struct {
	// contains filtered or unexported fields
}

nolint:revive

func NewGcplogTargetManager

func NewGcplogTargetManager(
	metrics *Metrics,
	logger log.Logger,
	client api.EntryHandler,
	scrape []scrapeconfig.Config,
) (*GcplogTargetManager, error)

func (*GcplogTargetManager) ActiveTargets

func (tm *GcplogTargetManager) ActiveTargets() map[string][]target.Target

func (*GcplogTargetManager) AllTargets

func (tm *GcplogTargetManager) AllTargets() map[string][]target.Target

func (*GcplogTargetManager) Ready

func (tm *GcplogTargetManager) Ready() bool

func (*GcplogTargetManager) Stop

func (tm *GcplogTargetManager) Stop()

type Metrics

type Metrics struct {
	// contains filtered or unexported fields
}

Metrics stores gcplog entry metrics.

func NewMetrics

func NewMetrics(reg prometheus.Registerer) *Metrics

NewMetrics creates a new set of metrics. Metrics will be registered to reg.

type PushMessage

type PushMessage struct {
	Message struct {
		Attributes       map[string]string `json:"attributes"`
		Data             string            `json:"data"`
		ID               string            `json:"message_id"`
		PublishTimestamp string            `json:"publish_time"`
	} `json:"message"`
	Subscription string `json:"subscription"`
}

PushMessage is the POST body format sent by GCP PubSub push subscriptions. See https://cloud.google.com/pubsub/docs/push for details.

func (PushMessage) Validate

func (pm PushMessage) Validate() error

type Target

type Target interface {
	target.Target
	Stop() error
}

Target is a common interface implemented by both GCPLog targets.

func NewGCPLogTarget

func NewGCPLogTarget(
	metrics *Metrics,
	logger log.Logger,
	handler api.EntryHandler,
	relabel []*relabel.Config,
	jobName string,
	config *scrapeconfig.GcplogTargetConfig,
	clientOptions ...option.ClientOption,
) (Target, error)

NewGCPLogTarget creates a GCPLog target either with the push or pull implementation, depending on the configured subscription type.

Jump to

Keyboard shortcuts

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