-
Notifications
You must be signed in to change notification settings - Fork 3.1k
[exporter/prometheusremotewrite] feat: prom rw exporter add support for rw2 #35888
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mx-psi
merged 127 commits into
open-telemetry:main
from
jmichalek132:jm-prom-rw-exporter-add-support-for-rw2
May 9, 2025
Merged
Changes from 6 commits
Commits
Show all changes
127 commits
Select commit
Hold shift + click to select a range
8a0b38e
feat: prom rw exporter add support for rw2
jmichalek132 3d54298
Merge branch 'main' into jm-prom-rw-exporter-add-support-for-rw2
jmichalek132 4c4ef36
Merge branch 'main' into jm-prom-rw-exporter-add-support-for-rw2
jmichalek132 d5521bf
chore: try to reduce code duplication
jmichalek132 146bf31
chore: try to reduce code duplication 2
jmichalek132 07185a8
chore: removed batching for now to make PR smaller
jmichalek132 0cdd754
chore: addressed comments from PR
jmichalek132 b8052ce
Merge branch 'main' into jm-prom-rw-exporter-add-support-for-rw2
jmichalek132 1b5d693
chore: implement enum for rw2 instead of bool
jmichalek132 c5518b0
chore: add feature flag for enabling support for rw2
jmichalek132 446e58a
chore: fix issues pointed out by linter
jmichalek132 a15354d
Update exporter/prometheusremotewriteexporter/config.go
jmichalek132 da15f91
chore: addressed feedback from review
jmichalek132 81805f3
Merge branch 'main' into jm-prom-rw-exporter-add-support-for-rw2
jmichalek132 e4ddae3
chore: addressed feedback from review
jmichalek132 4340649
chore: addressed feedback from review
jmichalek132 56c09c1
Merge branch 'main' into jm-prom-rw-exporter-add-support-for-rw2
jmichalek132 a44abba
refactor PushMetrics based on suggestion from review
jmichalek132 6e2a0d8
chore: undo unneeded changes
jmichalek132 8bd8bc7
chore: updated unit tests & added an rw2 case
jmichalek132 6b3bea6
Merge branch 'main' into jm-prom-rw-exporter-add-support-for-rw2
jmichalek132 c8f832d
chore: ran make gci
jmichalek132 658ff26
Merge branch 'main' into jm-prom-rw-exporter-add-support-for-rw2
jmichalek132 cf476d6
chore: move debug line to correct place
jmichalek132 eae3908
chore: fix typo in feature flag description
jmichalek132 7e18afb
chore: move debug line to correct place
jmichalek132 aca5734
chore: small refactor based on review
jmichalek132 3abd46e
chore: update failing unit test
jmichalek132 9719de0
chore: updated readme first iteration
jmichalek132 7f2b253
chore: added changelog draft
jmichalek132 1770b82
Merge branch 'main' into jm-prom-rw-exporter-add-support-for-rw2
jmichalek132 047b4ba
chore: ran make generate
jmichalek132 48a3544
chore: moved v2 function to v2 file
jmichalek132 bc6c1dc
chore: delete empty file
jmichalek132 4f04e82
chore: import proto message from prometheus and validate it from config
jmichalek132 6be771d
chore: ran make generate
jmichalek132 cc1599c
chore: added check if flag enabled where missing
jmichalek132 a5bab73
chore: fix broken tests
jmichalek132 7917ee0
Merge branch 'main' into jm-prom-rw-exporter-add-support-for-rw2
jmichalek132 018fde1
chore: fixed go.sum after resolving conflicts
jmichalek132 7fd2376
Update .chloggen/jm-prom-rw-exporter-add-support-for-rw2.yaml
jmichalek132 a5cea35
chore: updqated changelong entry based on feedback
jmichalek132 0e8d921
Update exporter/prometheusremotewriteexporter/exporter.go
jmichalek132 7f283c0
chore: ran make gotidy
jmichalek132 e78df16
Update exporter/prometheusremotewriteexporter/factory.go
jmichalek132 5b7a338
chore: avoid setting feature flag for all tests
jmichalek132 9415ebe
chore: ran make gci
jmichalek132 5747e4a
chore: added log line with proto message
jmichalek132 f6eb6ab
Merge branch 'main' into jm-prom-rw-exporter-add-support-for-rw2
jmichalek132 e730d21
Update .chloggen/jm-prom-rw-exporter-add-support-for-rw2.yaml
jmichalek132 8180fa4
Update exporter/prometheusremotewriteexporter/README.md
jmichalek132 18f933d
Update exporter/prometheusremotewriteexporter/exporter.go
jmichalek132 1b6c001
Update exporter/prometheusremotewriteexporter/exporter.go
jmichalek132 4ed165b
Update exporter/prometheusremotewriteexporter/exporter.go
jmichalek132 322d135
Update exporter/prometheusremotewriteexporter/README.md
jmichalek132 7db3003
Merge branch 'main' into jm-prom-rw-exporter-add-support-for-rw2
jmichalek132 e53e521
chore: ran go mod tidy
jmichalek132 8e85d8c
chore: remove unnecessary config option
jmichalek132 b2198a8
chore: moved validation of proto message into correct place
jmichalek132 10345a6
chore: updated comment on exportV2 func
jmichalek132 d770a2c
Merge branch 'main' into jm-prom-rw-exporter-add-support-for-rw2
jmichalek132 40be25d
chore: ran make generate
jmichalek132 4b8ca99
Merge branch 'main' into jm-prom-rw-exporter-add-support-for-rw2
jmichalek132 f6505d1
chore: fix tests and v2 after rebase
jmichalek132 fdf6b7a
chore: fix linter errors
jmichalek132 95476c8
chore: ran make generate
jmichalek132 bfd072f
Merge branch 'main' into jm-prom-rw-exporter-add-support-for-rw2
jmichalek132 01d77a6
Merge branch 'main' into jm-prom-rw-exporter-add-support-for-rw2
dashpole 3ddd34e
Merge branch 'main' into jm-prom-rw-exporter-add-support-for-rw2
jmichalek132 50caa19
chore: cleanup for pipeline to pass after rebase
jmichalek132 f950fb4
chore: ran go mod tidy in prom recevier to fix pipeline
jmichalek132 a65bd59
Merge branch 'main' into jm-prom-rw-exporter-add-support-for-rw2
jmichalek132 56ba3ba
Merge branch 'main' into jm-prom-rw-exporter-add-support-for-rw2
jmichalek132 bf37b71
choreL ran make go tidy
jmichalek132 1dd7935
choreL ran make go tidy
jmichalek132 fe755ad
Update exporter/prometheusremotewriteexporter/exporter_v2.go
jmichalek132 217bf6a
Update exporter/prometheusremotewriteexporter/exporter.go
jmichalek132 71327df
Update exporter/prometheusremotewriteexporter/exporter.go
jmichalek132 4e11b39
Update exporter/prometheusremotewriteexporter/exporter.go
jmichalek132 0e29bad
Update exporter/prometheusremotewriteexporter/exporter.go
jmichalek132 cdb12dc
Update exporter/prometheusremotewriteexporter/config.go
jmichalek132 dcad87a
Update exporter/prometheusremotewriteexporter/config.go
jmichalek132 64f0223
chore: addressed feedback from review
jmichalek132 53dcdce
Merge branch 'main' into jm-prom-rw-exporter-add-support-for-rw2
jmichalek132 23a5aae
chore: ran go mod tidy
jmichalek132 c031d95
chore: ran make gci
jmichalek132 1f9fac9
chore: explicitly put back buffer after usage
jmichalek132 deeb455
chore: fix linting issues
jmichalek132 b23d48d
chore: ran make generate
jmichalek132 fb4abec
Merge branch 'main' into jm-prom-rw-exporter-add-support-for-rw2
jmichalek132 a037f25
chore: solving conflict
jmichalek132 e790e84
chore: solving conflict
jmichalek132 8a929c1
chore: solving conflict
jmichalek132 702ff70
chore: solving conflict
jmichalek132 6b8fafa
chore: solving conflict
jmichalek132 5312467
Merge branch 'main' into jm-prom-rw-exporter-add-support-for-rw2
dashpole fb91537
Merge remote-tracking branch 'origin/main' into jm-prom-rw-exporter-a…
jmichalek132 e5e21f5
chore: merged main in and ran make generate
jmichalek132 c1b7d47
chore: cleanup after merge of main
jmichalek132 2e8b9f5
chore: partial backport changes from main
jmichalek132 090c9b4
chore: partial backport changes from main fix
jmichalek132 439ac2b
chore: partial backport changes from main
jmichalek132 5fcf463
chore: finished backport of changes from maing
jmichalek132 7386a3d
chore: go leak ignore known issue
jmichalek132 41c501c
Merge branch 'main' into jm-prom-rw-exporter-add-support-for-rw2
jmichalek132 e3b32dc
Update exporter/prometheusremotewriteexporter/exporter.go
jmichalek132 abfda66
chore: ran make gci
jmichalek132 b33f1f9
chore: ran go mod tidy
jmichalek132 0ca5f11
chore: clean up wording in readme
jmichalek132 b53dc43
chore: remove unnecessary comment
jmichalek132 f718d56
chore: added lock to avoid a risk of race condition
jmichalek132 7cbca48
Merge branch 'main' into jm-prom-rw-exporter-add-support-for-rw2
jmichalek132 8624afe
chore: ran make go generate
jmichalek132 3fb80fd
chore: clarify send metadata config options has no effect on PRW2
jmichalek132 f747881
Merge branch 'main' into jm-prom-rw-exporter-add-support-for-rw2
jmichalek132 8615f7b
chore: ran go mod tidy
jmichalek132 ffb9fd6
Apply suggestions from code review
ArthurSens f826169
Update .chloggen/jm-prom-rw-exporter-add-support-for-rw2.yaml
jmichalek132 9a08f49
Update .chloggen/jm-prom-rw-exporter-add-support-for-rw2.yaml
jmichalek132 b78dfab
Update exporter/prometheusremotewriteexporter/README.md
jmichalek132 8d14690
Update exporter/prometheusremotewriteexporter/factory.go
jmichalek132 8190e73
chore: exit with error if rw2 set in config but feature flag not enabled
jmichalek132 8e2539f
Merge branch 'main' into jm-prom-rw-exporter-add-support-for-rw2
jmichalek132 2fb5c5d
chore: ran make gotidy
jmichalek132 2bb013e
Improve wording
ArthurSens d979e92
Merge branch 'main' into jm-prom-rw-exporter-add-support-for-rw2
jmichalek132 3744f3d
chore: ran make gotidy
jmichalek132 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| // Copyright The OpenTelemetry Authors | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| package prometheusremotewriteexporter // import "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusremotewriteexporter" | ||
|
|
||
| import ( | ||
| "context" | ||
| writev2 "github.com/prometheus/prometheus/prompb/io/prometheus/write/v2" | ||
| "math" | ||
| "sync" | ||
|
|
||
| "go.opentelemetry.io/collector/consumer/consumererror" | ||
| "go.uber.org/multierr" | ||
| ) | ||
|
|
||
| // TODO update comment | ||
jmichalek132 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| // export sends a Snappy-compressed WriteRequest containing TimeSeries to a remote write endpoint in order | ||
| func (prwe *prwExporter) exportV2(ctx context.Context, requests []*writev2.Request) error { | ||
| input := make(chan *writev2.Request, len(requests)) | ||
| for _, request := range requests { | ||
| input <- request | ||
| } | ||
| close(input) | ||
|
|
||
| var wg sync.WaitGroup | ||
|
|
||
| concurrencyLimit := int(math.Min(float64(prwe.concurrency), float64(len(requests)))) | ||
| wg.Add(concurrencyLimit) // used to wait for workers to be finished | ||
|
|
||
| var mu sync.Mutex | ||
| var errs error | ||
| // Run concurrencyLimit of workers until there | ||
| // is no more requests to execute in the input channel. | ||
| for i := 0; i < concurrencyLimit; i++ { | ||
| go func() { | ||
| defer wg.Done() | ||
| for { | ||
| select { | ||
| case <-ctx.Done(): // Check firstly to ensure that the context wasn't cancelled. | ||
| return | ||
|
|
||
| case request, ok := <-input: | ||
| if !ok { | ||
| return | ||
| } | ||
| if errExecute := prwe.execute(ctx, nil, request, true); errExecute != nil { | ||
| mu.Lock() | ||
| errs = multierr.Append(errs, consumererror.NewPermanent(errExecute)) | ||
| mu.Unlock() | ||
| } | ||
| } | ||
| } | ||
| }() | ||
| } | ||
| wg.Wait() | ||
|
|
||
| return errs | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.