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

[WIP] Upgrade storage integration test: Use V2 Archive ReaderWriter #6489

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ekefan
Copy link
Contributor

@ekefan ekefan commented Jan 6, 2025

Which problem is this PR solving?

Description of the changes

  • Incrementally swaps the fields of StorageIntegration to align with v2 storage api

    • replaced ArchiveSpanReader with ArchiveTraceReader
    • replaced ArchiveSpanWriter with ArchiveTraceWriter
  • Updates test functions accordingly to work with the updated fields

How was this change tested?

Checklist

@ekefan ekefan requested a review from a team as a code owner January 6, 2025 00:51
@ekefan ekefan requested a review from pavolloffay January 6, 2025 00:51
@ekefan ekefan force-pushed the archive-reader-writer branch from 2ca2f23 to 9ad6870 Compare January 6, 2025 00:53
@ekefan ekefan marked this pull request as draft January 6, 2025 02:26
@yurishkuro yurishkuro added the changelog:ci Change related to continuous integration / testing label Jan 6, 2025
@yurishkuro yurishkuro marked this pull request as ready for review January 6, 2025 02:51
@yurishkuro yurishkuro enabled auto-merge (squash) January 6, 2025 02:52
@yurishkuro yurishkuro disabled auto-merge January 6, 2025 02:54
@yurishkuro
Copy link
Member

looks like some archive tests are failing

    --- ❌ FAIL: TestElasticsearchStorage/ArchiveTrace (0.00s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x22fe57b]

goroutine 65 [running]:
testing.tRunner.func1.2({0x2532840, 0x3a10eb0})
	/opt/hostedtoolcache/go/1.23.4/x64/src/testing/testing.go:1632 +0x3fc
testing.tRunner.func1()
	/opt/hostedtoolcache/go/1.23.4/x64/src/testing/testing.go:1635 +0x6b6
panic({0x2532840?, 0x3a10eb0?})
	/opt/hostedtoolcache/go/1.23.4/x64/src/runtime/panic.go:785 +0x132
github.com/jaegertracing/jaeger/plugin/storage/integration.(*StorageIntegration).testArchiveTrace.func1(0x6c0f40?)
	/home/runner/work/jaeger/jaeger/plugin/storage/integration/integration.go:214 +0x47b
github.com/jaegertracing/jaeger/plugin/storage/integration.(*StorageIntegration).waitForCondition(0x2a7de18?, 0xc000523040, 0xc000439e58)
	/home/runner/work/jaeger/jaeger/plugin/storage/integration/integration.go:128 +0x165

@ekefan
Copy link
Contributor Author

ekefan commented Jan 6, 2025

there's no new change with the recent push... just trying to update the branch.

I will get back to these issues later in my day.

@ekefan ekefan force-pushed the archive-reader-writer branch from aaab620 to a43bc9a Compare January 7, 2025 09:16
@ekefan
Copy link
Contributor Author

ekefan commented Jan 7, 2025

Hello @yurishkuro,

I can't find the cause of this bug, but for elastic search and open search, the testArchiveTrace test fails; the archive trace reader returns an empty trace...
I want to try updating the reader before the writer, but I'd be glad to get any help or way forward from you.
Thanks alot.

@yurishkuro
Copy link
Member

Did you look at the logs? I see nil pointer segfaults, that should be easy to troubleshoot.

Copy link

codecov bot commented Jan 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.22%. Comparing base (b04e0ba) to head (120f2f1).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6489      +/-   ##
==========================================
- Coverage   96.24%   96.22%   -0.03%     
==========================================
  Files         373      373              
  Lines       21406    21409       +3     
==========================================
- Hits        20602    20600       -2     
- Misses        612      616       +4     
- Partials      192      193       +1     
Flag Coverage Δ
badger_v1 10.64% <0.00%> (-0.01%) ⬇️
badger_v2 2.77% <0.00%> (-0.01%) ⬇️
cassandra-4.x-v1-manual 16.61% <100.00%> (+0.02%) ⬆️
cassandra-4.x-v2-auto 2.71% <0.00%> (-0.01%) ⬇️
cassandra-4.x-v2-manual 2.71% <0.00%> (-0.01%) ⬇️
cassandra-5.x-v1-manual 16.61% <100.00%> (+0.02%) ⬆️
cassandra-5.x-v2-auto 2.71% <0.00%> (-0.01%) ⬇️
cassandra-5.x-v2-manual 2.71% <0.00%> (-0.01%) ⬇️
elasticsearch-6.x-v1 20.38% <100.00%> (+0.01%) ⬆️
elasticsearch-7.x-v1 20.46% <100.00%> (+0.02%) ⬆️
elasticsearch-8.x-v1 20.61% <100.00%> (+0.02%) ⬆️
elasticsearch-8.x-v2 2.77% <0.00%> (-0.11%) ⬇️
grpc_v1 12.17% <100.00%> (+0.01%) ⬆️
grpc_v2 9.02% <0.00%> (-0.01%) ⬇️
kafka-3.x-v1 10.32% <0.00%> (-0.01%) ⬇️
kafka-3.x-v2 2.77% <0.00%> (-0.01%) ⬇️
memory_v2 2.77% <0.00%> (+<0.01%) ⬆️
opensearch-1.x-v1 20.51% <100.00%> (+0.03%) ⬆️
opensearch-2.x-v1 20.50% <100.00%> (+0.01%) ⬆️
opensearch-2.x-v2 2.76% <0.00%> (-0.02%) ⬇️
tailsampling-processor 0.51% <0.00%> (-0.01%) ⬇️
unittests 95.06% <0.00%> (-0.04%) ⬇️

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.

@ekefan ekefan force-pushed the archive-reader-writer branch from ccf0435 to 54a0a07 Compare January 8, 2025 08:46
@ekefan ekefan marked this pull request as draft January 11, 2025 05:56
@ekefan ekefan changed the title Upgrade storage integration test: Use V2 Archive ReaderWriter [WIP] Upgrade storage integration test: Use V2 Archive ReaderWriter Jan 11, 2025
@ekefan ekefan closed this Jan 14, 2025
@ekefan ekefan force-pushed the archive-reader-writer branch from 1febf80 to c678a64 Compare January 14, 2025 04:44
@ekefan ekefan reopened this Jan 14, 2025
@ekefan ekefan force-pushed the archive-reader-writer branch from 7e58074 to cc0a508 Compare January 17, 2025 08:07
@ekefan ekefan force-pushed the archive-reader-writer branch from cc0a508 to 7486084 Compare January 17, 2025 19:01
@@ -65,6 +65,11 @@ func (tr *TraceReader) GetTraces(
}
}

func (tr *TraceReader) GetArchiveTraces(ctx context.Context, traceID tracestore.GetTraceParams) (*model.Trace, error) {
Copy link
Contributor Author

@ekefan ekefan Jan 17, 2025

Choose a reason for hiding this comment

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

Hello @yurishkuro,

For some reason, getting archive traces on es v1 fails when looping through traceIDs

I spent some time, reading codes in the es dir, and recent changes to config for archive traces but I couldn't find anything that pointed the reason for not reading traces. Then I tried this GetArchiveTraces function:

func (tr *TraceReader) GetArchiveTraces(ctx context.Context, traceIDs ...tracestore.GetTraceParams) ([]*model.Trace, error) {
	traces := []*model.Trace{}
	var err error
	for _, traceID := range traceIDs {
		tID := model.TraceIDFromOTEL(traceID.TraceID)
		trace, err := tr.spanReader.GetTrace(ctx, spanstore.GetTraceParameters{TraceID: tID})
		if err != nil {
			if errors.Is(err, spanstore.ErrTraceNotFound) {
				fmt.Printf("Trace with id: %v, not found", tID)
				continue
			} else {
				return nil, err
			}
		}
		traces = append(traces, trace)
	}
	return traces, err
}

and it failed to read too..

But this variant didn't fail..

func (tr *TraceReader) GetArchiveTraces(ctx context.Context, traceIDs ...tracestore.GetTraceParams) ([]*model.Trace, error) {
	traces := []*model.Trace{}
	traceID := traceIDs[0] // trying this out, since only one archive trace is to be read
	tID := model.TraceIDFromOTEL(traceID.TraceID)
	trace, err := tr.spanReader.GetTrace(ctx, spanstore.GetTraceParameters{TraceID: tID})
	if err != nil {
		if errors.Is(err, spanstore.ErrTraceNotFound) {
			fmt.Printf("Trace with id: %v, not found", tID)
		}
		return nil, err
	}
	traces = append(traces, trace)
	return traces, err
}

Since, all jaeger backend storage will be upgraded to version 2, we could use this function till then.
What do you think? about the bug, the suggestion?

@ekefan ekefan marked this pull request as ready for review January 17, 2025 19:54
@ekefan ekefan force-pushed the archive-reader-writer branch 2 times, most recently from fb698f7 to 2d8a157 Compare January 17, 2025 22:24
Copy link
Member

@yurishkuro yurishkuro left a comment

Choose a reason for hiding this comment

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

// if len(traces) > 0 {
// actual = traces[0]
// }
actual, err = s.ArchiveTraceReader.(*v1adapter.TraceReader).GetArchiveTraces(context.Background(), tracestore.GetTraceParams{TraceID: tID.ToOTELTraceID()})
Copy link
Member

Choose a reason for hiding this comment

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

we should not assume that the ArchiveTraceReader is implemented as v1adapter. You can use v2 API to read ptrace.Traces, then convert that into model.Trace for comparison.

@@ -65,6 +65,11 @@ func (tr *TraceReader) GetTraces(
}
}

func (tr *TraceReader) GetArchiveTraces(ctx context.Context, traceID tracestore.GetTraceParams) (*model.Trace, error) {
Copy link
Member

Choose a reason for hiding this comment

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

there is no such thing as GetArchiveTraces, we never had it even in v1 storage interface, and we explicitly are moving away from in it v2.

Copy link
Contributor Author

@ekefan ekefan Jan 18, 2025

Choose a reason for hiding this comment

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

I totally get that...

I only created it for the purpose of solving the bug we are experiencing hoping it would be no longer be needed soon.

Signed-off-by: Emmanuel Emonueje Ebenezer <eebenezer949@gmail.com>
Signed-off-by: Emmanuel Emonueje Ebenezer <eebenezer949@gmail.com>
@ekefan ekefan force-pushed the archive-reader-writer branch from 2d8a157 to 120f2f1 Compare January 18, 2025 08:01
@ekefan ekefan marked this pull request as draft January 18, 2025 08:03
@ekefan
Copy link
Contributor Author

ekefan commented Jan 18, 2025

@yurishkuro, @mahadzaryab1, I have two questions please:

  • When all jaeger storage backends are upgraded to v2, will the Archive ReaderWriter fields still exist in StorageIntegration for the storage integration tests?
  • Will testArchiveTrace still be part of the integration tests?

@mahadzaryab1
Copy link
Collaborator

I'm currently in the process of trying to completely phase out the difference between primary and archive interfaces in #6567. If that can be pulled off, then this PR can initialize primary and archive storage in the same way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants