Skip to content

Commit

Permalink
[exporter/elasticsearch] Replace go-elasticsearch BulkIndexer with go…
Browse files Browse the repository at this point in the history
…-docappender (#32359)

**Description:** <Describe what has changed.>
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
Replace go-elasticsearch BulkIndexer with go-docappender BulkIndexer for
Flush function in preparation for reliability fixes. Maintain similar
interface and implementation to go-elasticsearch BulkIndexer.

Further changes to expose individual `docappender.BulkIndexer` instances
are needed down the road but it is out of the scope of this PR.

Implications of this change:
- flush timeout is now enforced on client side
- oversize payload special handling is now removed
- go-docappender uses bulk request filterPath which means bulk response
is smaller, less JSON parsing and lower CPU usage
- document level retry debug logging is removed as retries are done
transparently

~~Blocked by #32585~~

**Link to tracking Issue:** <Issue number if applicable> Fixes #32378 

**Testing:** Integration test is passing

---------

Co-authored-by: Vishal Raj <vishal.raj@elastic.co>
  • Loading branch information
carsonip and lahsivjar authored May 9, 2024
1 parent 17f5711 commit bcc9fe4
Show file tree
Hide file tree
Showing 18 changed files with 555 additions and 116 deletions.
33 changes: 33 additions & 0 deletions .chloggen/elasticsearchexporter_go-docappender.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: elasticsearchexporter

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Replace go-elasticsearch BulkIndexer with go-docappender

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [32378]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext: |
Replace go-elasticsearch BulkIndexer with go-docappender bulk indexer, in preparation for future reliability fixes.
As a result of this change, there are minor behavioral differences:
- flush timeout is now enforced on client side
- oversize payload special handling is now removed
- go-docappender uses bulk request filterPath which means bulk response is smaller, less JSON parsing and lower CPU usage
- document level retry debug logging is removed as retries are done transparently
# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [user]
11 changes: 11 additions & 0 deletions cmd/configschema/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ require (
github.com/apache/thrift v0.20.0 // indirect
github.com/ardielle/ardielle-go v1.5.2 // indirect
github.com/armon/go-metrics v0.4.1 // indirect
github.com/armon/go-radix v1.0.0 // indirect
github.com/aws/aws-sdk-go v1.52.4 // indirect
github.com/aws/aws-sdk-go-v2 v1.26.1 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.2 // indirect
Expand Down Expand Up @@ -364,8 +365,13 @@ require (
github.com/eapache/go-resiliency v1.6.0 // indirect
github.com/eapache/go-xerial-snappy v0.0.0-20230731223053-c322873962e3 // indirect
github.com/eapache/queue v1.1.0 // indirect
github.com/elastic/elastic-transport-go/v8 v8.5.0 // indirect
github.com/elastic/go-docappender/v2 v2.1.0 // indirect
github.com/elastic/go-elasticsearch/v7 v7.17.10 // indirect
github.com/elastic/go-elasticsearch/v8 v8.13.1 // indirect
github.com/elastic/go-structform v0.0.10 // indirect
github.com/elastic/go-sysinfo v1.7.1 // indirect
github.com/elastic/go-windows v1.0.1 // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/envoyproxy/go-control-plane v0.12.0 // indirect
github.com/envoyproxy/protoc-gen-validate v1.0.4 // indirect
Expand Down Expand Up @@ -467,6 +473,7 @@ require (
github.com/jcmturner/gokrb5/v8 v8.4.4 // indirect
github.com/jcmturner/rpc/v2 v2.0.3 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/jpillora/backoff v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
Expand Down Expand Up @@ -670,6 +677,9 @@ require (
github.com/yuin/gopher-lua v0.0.0-20220504180219-658193537a64 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
github.com/zeebo/xxh3 v1.0.2 // indirect
go.elastic.co/apm/module/apmzap/v2 v2.6.0 // indirect
go.elastic.co/apm/v2 v2.6.0 // indirect
go.elastic.co/fastjson v1.3.0 // indirect
go.etcd.io/bbolt v1.3.10 // indirect
go.mongodb.org/atlas v0.36.0 // indirect
go.mongodb.org/mongo-driver v1.15.0 // indirect
Expand Down Expand Up @@ -757,6 +767,7 @@ require (
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
gopkg.in/zorkian/go-datadog-api.v2 v2.30.0 // indirect
howett.net/plist v1.0.0 // indirect
k8s.io/api v0.29.3 // indirect
k8s.io/apimachinery v0.29.3 // indirect
k8s.io/client-go v0.29.3 // indirect
Expand Down
32 changes: 32 additions & 0 deletions cmd/configschema/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions cmd/otelcontribcol/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ require (
github.com/apache/thrift v0.20.0 // indirect
github.com/ardielle/ardielle-go v1.5.2 // indirect
github.com/armon/go-metrics v0.4.1 // indirect
github.com/armon/go-radix v1.0.0 // indirect
github.com/aws/aws-sdk-go v1.52.4 // indirect
github.com/aws/aws-sdk-go-v2 v1.26.1 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.2 // indirect
Expand Down Expand Up @@ -431,8 +432,13 @@ require (
github.com/eapache/go-resiliency v1.6.0 // indirect
github.com/eapache/go-xerial-snappy v0.0.0-20230731223053-c322873962e3 // indirect
github.com/eapache/queue v1.1.0 // indirect
github.com/elastic/elastic-transport-go/v8 v8.5.0 // indirect
github.com/elastic/go-docappender/v2 v2.1.0 // indirect
github.com/elastic/go-elasticsearch/v7 v7.17.10 // indirect
github.com/elastic/go-elasticsearch/v8 v8.13.1 // indirect
github.com/elastic/go-structform v0.0.10 // indirect
github.com/elastic/go-sysinfo v1.7.1 // indirect
github.com/elastic/go-windows v1.0.1 // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/envoyproxy/go-control-plane v0.12.0 // indirect
github.com/envoyproxy/protoc-gen-validate v1.0.4 // indirect
Expand Down Expand Up @@ -537,6 +543,7 @@ require (
github.com/jcmturner/gokrb5/v8 v8.4.4 // indirect
github.com/jcmturner/rpc/v2 v2.0.3 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/jpillora/backoff v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
Expand Down Expand Up @@ -717,6 +724,9 @@ require (
github.com/yuin/gopher-lua v0.0.0-20220504180219-658193537a64 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
github.com/zeebo/xxh3 v1.0.2 // indirect
go.elastic.co/apm/module/apmzap/v2 v2.6.0 // indirect
go.elastic.co/apm/v2 v2.6.0 // indirect
go.elastic.co/fastjson v1.3.0 // indirect
go.etcd.io/bbolt v1.3.10 // indirect
go.mongodb.org/atlas v0.36.0 // indirect
go.mongodb.org/mongo-driver v1.15.0 // indirect
Expand Down Expand Up @@ -783,6 +793,7 @@ require (
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
gopkg.in/zorkian/go-datadog-api.v2 v2.30.0 // indirect
howett.net/plist v1.0.0 // indirect
k8s.io/api v0.29.3 // indirect
k8s.io/apimachinery v0.29.3 // indirect
k8s.io/client-go v0.29.3 // indirect
Expand Down
Loading

0 comments on commit bcc9fe4

Please sign in to comment.