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
- type RequestStats
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 ¶
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.
func DecodeBulkRequestWithStatsAndDynamicTemplates ¶ added in v2.3.0
func DecodeBulkRequestWithStatsAndDynamicTemplates(r *http.Request) ( docs [][]byte, res esutil.BulkIndexerResponse, stats RequestStats, dynamicTemplates []map[string]string)
DecodeBulkRequestWithStatsAndDynamicTemplates decodes a /_bulk request's body, returning the decoded documents and a response body and stats about request, and per-request dynamic templates.