Documentation ¶
Index ¶
- Constants
- func AssertOTelMetrics(t testing.TB, ms []metricdata.Metrics, assert func(m metricdata.Metrics))
- func DecodeBulkRequest(r *http.Request) ([][]byte, esutil.BulkIndexerResponse)
- func HandleBulk(mux *http.ServeMux, bulkHandler http.HandlerFunc)
- func NewAssertCounter(t testing.TB, asserted *atomic.Int64) func(metric metricdata.Metrics, count int64, attrs attribute.Set)
- func NewMockElasticsearchClient(t testing.TB, bulkHandler http.HandlerFunc) *elasticsearch.Client
- func NewMockElasticsearchClientConfig(t testing.TB, bulkHandler http.HandlerFunc) elasticsearch.Config
Constants ¶
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 ¶ added in v1.0.0
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 ¶ added in v1.0.0
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 ¶
This section is empty.