docappendertest

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const TimestampFormat = "2006-01-02T15:04:05.000Z07:00"

TimestampFormat holds the time format for formatting timestamps according to Elasticsearch's strict_date_optional_time date format, which includes a fractional seconds component.

Variables

This section is empty.

Functions

func AssertOTelMetrics

func AssertOTelMetrics(t testing.TB, ms []metricdata.Metrics, assert func(m metricdata.Metrics))

AssertOTelMetrics asserts OTel metrics using a closure.

func DecodeBulkRequest

func DecodeBulkRequest(r *http.Request) ([][]byte, esutil.BulkIndexerResponse)

DecodeBulkRequest decodes a /_bulk request's body, returning the decoded documents and a response body.

func HandleBulk

func HandleBulk(mux *http.ServeMux, bulkHandler http.HandlerFunc)

HandleBulk registers bulkHandler with mux for handling /_bulk requests, wrapping bulkHandler to conform with go-elasticsearch version checking.

func NewAssertCounter

func NewAssertCounter(t testing.TB, asserted *atomic.Int64) func(metric metricdata.Metrics, count int64, attrs attribute.Set)

NewAssertCounter returns a function that canbe used to assert counter metrics

func NewMockElasticsearchClient

func NewMockElasticsearchClient(t testing.TB, bulkHandler http.HandlerFunc) *elasticsearch.Client

NewMockElasticsearchClient returns an elasticsearch.Client which sends /_bulk requests to bulkHandler.

func NewMockElasticsearchClientConfig

func NewMockElasticsearchClientConfig(t testing.TB, bulkHandler http.HandlerFunc) elasticsearch.Config

NewMockElasticsearchClientConfig starts an httptest.Server, and returns an elasticsearch.Config which sends /_bulk requests to bulkHandler. The httptest.Server will be closed via t.Cleanup.

Types

type RequestStats added in v2.1.0

type RequestStats struct {
	UncompressedBytes int64
}

func DecodeBulkRequestWithStats added in v2.1.0

func DecodeBulkRequestWithStats(r *http.Request) (
	docs [][]byte,
	res esutil.BulkIndexerResponse,
	stats RequestStats)

DecodeBulkRequestWithStats decodes a /_bulk request's body, returning the decoded documents and a response body and stats about request.

Jump to

Keyboard shortcuts

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