in elastictransport/instrumentation.go [143:162]
func (i ElasticsearchOpenTelemetry) RecordRequestBody(ctx context.Context, endpoint string, query io.Reader) io.ReadCloser {
if i.shouldRecordRequestBody(endpoint) == false {
return nil
}
span := trace.SpanFromContext(ctx)
if span.IsRecording() {
buf := bytes.Buffer{}
buf.ReadFrom(query)
span.SetAttributes(attribute.String(attrDbStatement, buf.String()))
getBody := func() (io.ReadCloser, error) {
reader := buf
return io.NopCloser(&reader), nil
}
reader, _ := getBody()
return reader
}
return nil
}