insights

package
v0.51.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package insights contains the logic for the k6 cloud insights output.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Enabled

func Enabled(config cloudapi.Config) bool

Enabled returns true if the k6 x Tempo feature is enabled.

Types

type Client

type Client interface {
	IngestRequestMetadatasBatch(context.Context, insights.RequestMetadatas) error
	Close() error
}

Client is an interface for sending request metadatas to the Insights API.

type Collector

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

Collector is an implementation of RequestMetadatasCollector. Its purpose is to filter and store httpext.Trail samples containing tracing data for later flushing.

func NewCollector

func NewCollector(testRunID int64) *Collector

NewCollector creates a new Collector.

func (*Collector) CollectRequestMetadatas

func (c *Collector) CollectRequestMetadatas(sampleContainers []metrics.SampleContainer)

CollectRequestMetadatas filters httpext.Trail samples containing trace ids and stores them as insights.RequestMetadatas in the buffer.

func (*Collector) PopAll

func (c *Collector) PopAll() insights.RequestMetadatas

PopAll returns all collected insights.RequestMetadatas and clears the buffer.

type Flusher

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

Flusher is an implementation of RequestMetadatasFlusher. Its purpose is to retrieve data from a collector and send it to the insights backend.

func NewFlusher

func NewFlusher(client Client, collector RequestMetadatasCollector) *Flusher

NewFlusher creates a new Flusher.

func (*Flusher) Flush

func (f *Flusher) Flush() error

Flush retrieves data from the collector and sends it to the insights backend.

type RequestMetadatasCollector

type RequestMetadatasCollector interface {
	CollectRequestMetadatas([]metrics.SampleContainer)
	PopAll() insights.RequestMetadatas
}

RequestMetadatasCollector is an interface for collecting request metadatas and retrieving them, so they can be flushed using a flusher.

type RequestMetadatasFlusher

type RequestMetadatasFlusher interface {
	Flush() error
}

RequestMetadatasFlusher is an interface for flushing data to the cloud.

Jump to

Keyboard shortcuts

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