tatakae

package module
v0.0.0-...-08bc0a4 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: MIT Imports: 21 Imported by: 0

README

tatakae

Tatakae is a data generation tool for testing OpenTelemetry consumers such as the OpenTelemetry Collector and Grafana Agent Flow.

It generates metrics, logs and traces data and sends them over to a remote endpoint every 5 seconds using the OTLP HTTP exporter.

The remote endpoint can be adjusted using the following env variables

  • OTEL_EXPORTER_OTLP_ENDPOINT: sets the endpoint for all three signals. Defaults to http://localhost:4318
  • OTEL_EXPORTER_OTLP_METRICS_ENDPOINT: sets the metrics endpoint. Defaults to ${OTEL_EXPORTER_OTLP_ENDPOINT}/v1/metrics
  • OTEL_EXPORTER_OTLP_LOGS_ENDPOINT: sets the logs endpoint. Defaults to ${OTEL_EXPORTER_OTLP_ENDPOINT}/v1/logs
  • OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: sets the traces endpoint. Defaults to ${OTEL_EXPORTER_OTLP_ENDPOINT}/v1/traces

Tatakae also serves its own /metrics endpoint. (Although at the time no useful metrics have been wired in).

Build and run go binary

$ make build
$ ./build/tatakae
level=debug msg="Preparing to make HTTP request" url=http://localhost:4318/v1/traces
level=debug msg="Preparing to make HTTP request" url=http://localhost:4318/v1/metrics
level=debug msg="Preparing to make HTTP request" url=http://localhost:4318/v1/logs

TODO

  • Make it easier to run as a library
  • Make more parameters configurable (eg. rate of data being sent)
  • Make data generation configurable

What's with the name?

Means "fight!" in japanese. I just done binging Attack on Titan, and the stupid protagonist was saying this word every 10 minutes.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultEndpoint = "http://localhost:4318"
	DefaultConfig   = Config{
		MetricsEndpoint: DefaultEndpoint + "/v1/metrics",
		LogsEndpoint:    DefaultEndpoint + "/v1/logs",
		TracesEndpoint:  DefaultEndpoint + "/v1/traces",
	}
)

Functions

func NewLogs

func NewLogs() plog.Logs

func NewMetrics

func NewMetrics() pmetric.Metrics

func NewTraces

func NewTraces() ptrace.Traces

Types

type Config

type Config struct {
	MetricsEndpoint string
	LogsEndpoint    string
	TracesEndpoint  string
}

type Host

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

Host implements otelcomponent.Host for Grafana Agent Flow.

func NewHost

func NewHost(l log.Logger, opts ...HostOption) *Host

NewHost creates a new Host.

func (*Host) GetExporters

GetExporters implements otelcomponent.Host.

func (*Host) GetExtensions

func (h *Host) GetExtensions() map[otelcomponent.ID]otelextension.Extension

GetExtensions implements otelcomponent.Host.

func (*Host) GetFactory

func (h *Host) GetFactory(kind otelcomponent.Kind, componentType otelcomponent.Type) otelcomponent.Factory

GetFactory implements otelcomponent.Host.

func (*Host) ReportFatalError

func (h *Host) ReportFatalError(err error)

ReportFatalError implements otelcomponent.Host.

type HostOption

type HostOption func(*Host)

HostOption customizes behavior of the Host.

func WithHostExporters

func WithHostExporters(exporters map[otelcomponent.DataType]map[otelcomponent.ID]otelcomponent.Component) HostOption

WithHostExporters provides a custom set of exporters to the Host.

func WithHostExtensions

func WithHostExtensions(extensions map[otelcomponent.ID]otelextension.Extension) HostOption

WithHostExtensions provides a custom set of extensions to the Host.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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