gcplog

package
v3.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2022 License: AGPL-3.0 Imports: 19 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"`

	TextPayload string `json:"textPayload"`
}

LogEntry 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 GcplogTarget

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

GcplogTarget represents the target specific to GCP project. It collects logs from GCP and push it to Loki. nolint:revive

func NewGcplogTarget

func NewGcplogTarget(
	metrics *Metrics,
	logger log.Logger,
	handler api.EntryHandler,
	relabel []*relabel.Config,
	jobName string,
	config *scrapeconfig.GcplogTargetConfig,
) (*GcplogTarget, error)

NewGcplogTarget returns the new instannce of GcplogTarget for the given `project-id`. It scraps logs from the GCP project and push it Loki via given `api.EntryHandler.` It starts the `run` loop to consume log entries that can be stopped via `target.Stop()` nolint:revive,govet

func (*GcplogTarget) Details

func (t *GcplogTarget) Details() interface{}

func (*GcplogTarget) DiscoveredLabels

func (t *GcplogTarget) DiscoveredLabels() model.LabelSet

func (*GcplogTarget) Labels

func (t *GcplogTarget) Labels() model.LabelSet

func (*GcplogTarget) Ready

func (t *GcplogTarget) Ready() bool

func (*GcplogTarget) Stop

func (t *GcplogTarget) Stop() error

func (*GcplogTarget) Type

func (t *GcplogTarget) Type() target.TargetType

sent implements target.Target.

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 mertrics.

func NewMetrics

func NewMetrics(reg prometheus.Registerer) *Metrics

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

Jump to

Keyboard shortcuts

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