Skip to content
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

[v2]Added Auto Index Rollover #6500

Closed
wants to merge 10 commits into from
Closed

Conversation

Manik2708
Copy link
Contributor

Which problem is this PR solving?

Fixes a part of: #6283

Description of the changes

  • Addition of ES-Rollover (Cron Job) in jaeger binary.

How was this change tested?

  • Unit and e2e tests

Checklist

Signed-off-by: Manik2708 <[email protected]>
Signed-off-by: Manik2708 <[email protected]>
Signed-off-by: Manik2708 <[email protected]>
Signed-off-by: Manik2708 <[email protected]>
Signed-off-by: Manik2708 <[email protected]>
@Manik2708 Manik2708 marked this pull request as draft January 7, 2025 18:58
Signed-off-by: Manik2708 <[email protected]>
Signed-off-by: Manik2708 <[email protected]>
Copy link

codecov bot commented Jan 7, 2025

Codecov Report

Attention: Patch coverage is 90.04149% with 24 lines in your changes missing coverage. Please review.

Project coverage is 96.19%. Comparing base (08503ca) to head (dd85780).
Report is 53 commits behind head on main.

Files with missing lines Patch % Lines
plugin/storage/es/factory.go 83.05% 18 Missing and 2 partials ⚠️
pkg/es/config/config.go 42.85% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6500      +/-   ##
==========================================
- Coverage   96.27%   96.19%   -0.09%     
==========================================
  Files         372      374       +2     
  Lines       21282    21504     +222     
==========================================
+ Hits        20490    20686     +196     
- Misses        605      628      +23     
- Partials      187      190       +3     
Flag Coverage Δ
badger_v1 9.87% <0.00%> (-0.81%) ⬇️
badger_v2 2.57% <0.00%> (-0.22%) ⬇️
cassandra-4.x-v1-manual 15.33% <0.00%> (-1.25%) ⬇️
cassandra-4.x-v2-auto 2.51% <0.00%> (-0.21%) ⬇️
cassandra-4.x-v2-manual 2.51% <0.00%> (-0.21%) ⬇️
cassandra-5.x-v1-manual 15.33% <0.00%> (-1.25%) ⬇️
cassandra-5.x-v2-auto 2.51% <0.00%> (-0.21%) ⬇️
cassandra-5.x-v2-manual 2.51% <0.00%> (-0.21%) ⬇️
elasticsearch-6.x-v1 19.49% <37.75%> (-0.75%) ⬇️
elasticsearch-7.x-v1 19.55% <37.75%> (-0.77%) ⬇️
elasticsearch-8.x-v1 19.69% <37.75%> (-0.77%) ⬇️
elasticsearch-8.x-v2 2.56% <0.00%> (-0.21%) ⬇️
grpc_v1 11.38% <0.00%> (-0.94%) ⬇️
grpc_v2 8.41% <0.00%> (-0.69%) ⬇️
kafka-3.x-v1 9.58% <0.00%> (-0.78%) ⬇️
kafka-3.x-v2 2.57% <0.00%> (-0.22%) ⬇️
memory_v2 2.57% <0.00%> (-0.21%) ⬇️
opensearch-1.x-v1 19.59% <37.75%> (-0.76%) ⬇️
opensearch-2.x-v1 19.60% <37.75%> (-0.76%) ⬇️
opensearch-2.x-v2 2.57% <0.00%> (-0.22%) ⬇️
tailsampling-processor 0.47% <0.00%> (-0.04%) ⬇️
unittests 95.00% <82.15%> (-0.15%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Manik2708 Manik2708 marked this pull request as ready for review January 7, 2025 19:29
@Manik2708
Copy link
Contributor Author

  1. I am not able to write unit tests for factory as it is a cron job which is neither returning any error (it is logging the errors), so need help in the approach to write these tests.
  2. There is an e2e test in ESRollover which is skipped in v2 as jaeger can't exit unlike es-rollover binary. But if this case happens in real, means use_ilm=true in jaeger but there is no policy created, then everytime rollover will fail and log that error, is that fine?
  3. I have not gone with election\follower algorithm as I was able to test the idempotency of rollover. In the e2e tests of jaeger v2 rollover, a frequency of 1s is kept but in test, it doesn't runs only once but multiple times still it passes all the tests.
  4. I am bit confused in the index prefix used in es-rollover and that used in jaeger v2. Are they same? This PR is along this assumption that they are same.

@@ -16,7 +16,7 @@ import (
"github.com/jaegertracing/jaeger/pkg/es/client"
)

func newESClient(endpoint string, cfg *Config, tlsCfg *tls.Config) client.Client {
func NewESClient(endpoint string, cfg *Config, tlsCfg *tls.Config) client.Client {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why can we not use ES client from pkg/es?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So are you saying to use the olivere client instead of those used in cmd/es-rollover?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not olivere client, but our internal abstraction from pkg/es

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not olivere client, but our internal abstraction from pkg/es

But then should I copy this function in factory?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest you step away from the main issue for now and think about if we need to do a bit of refactoring of the existing code first. I see no reason why all the cmd/es-*** would have to be creating new HTTP client and doing some bespoke stuff that is completely independent of how es storage implementation is written. Everything should be going through pkg/es abstraction.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok then, I could think of these steps on refactoring:

  1. Refactoring the configs of rollover and lookback, encorporating them into the single common config of es-rollover. This will be very helpful while integrating the rollover with jaeger binary.
  2. As said by you changing the http clients to our abstraction (pkg/es).
  3. Changing the Unit and UnitCount to a single parameter time.Duration.
    I am thinking of seperate PRs for each. For 1st point, if this suggestion looks good to you, I will change accordingly in the PR [refactor] Seperated the parts of ES-Rollover Config common with ES Config #6516

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes separate PRs sounds good

"github.com/jaegertracing/jaeger/pkg/testutils"
)

const (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the reason to delete so much code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to use these tests in jaeger v2 so as to test the auto rollover cron job, therefore we need to refactor these tests. No e2e test is removed in this PR, rather they are changed to use them in v2. I could create a different PR for this but then I had to test the auto rollover e2e, that's why I included it in this PR!

@@ -24,7 +24,7 @@ for dir in $*; do
invalid=0
for test in ${testFiles}; do
if grep -q "TestMain" "${test}" && grep -q "testutils.VerifyGoLeaks" "${test}"; then
if [ "${dir}" != "./plugin/storage/integration/" ] && grep -q "testutils.VerifyGoLeaksForES" "${test}"; then
if [ "${dir}" != "./plugin/storage/integration/" ] && [ "${dir}" != "./cmd/jaeger/internal/integration/" ] && grep -q "testutils.VerifyGoLeaksForES" "${test}"; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you are introducing leaks you need to fix them, not tweak the linter

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are not from v2 tests or cron job but the es-rollover tests use the v1 es-rollover tests which uses the official es-clients which are responsible for these leaks. Please see the comments of cmd/jaeger/internal/integration/package_test.go.

Signed-off-by: Manik2708 <[email protected]>
@Manik2708 Manik2708 marked this pull request as draft January 10, 2025 08:40
Signed-off-by: Manik2708 <[email protected]>
@yurishkuro
Copy link
Member

Closing per #6283 (comment)

@yurishkuro yurishkuro closed this Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants