-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[clickhouse] Introduce trace writer for ClickHouse storage #7141
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
base: main
Are you sure you want to change the base?
[clickhouse] Introduce trace writer for ClickHouse storage #7141
Conversation
|
||
for range traces { | ||
// TODO Maybe AppendStruct is a better choice. | ||
err := batch.Append() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is not complete. The batch.Append
call should resemble the following:
err := batch.Append(
spanRow.StartTime,
spanRow.TraceId,
spanRow.SpanId,
spanRow.ParentSpanId,
spanRow.TraceState,
spanRow.ServiceName,
spanRow.Name,
spanRow.Kind,
spanRow.Duration,
spanRow.StatusCode,
spanRow.StatusMessage,
spanRow.Attributes.BoolKeys,
spanRow.Attributes.BoolValues,
spanRow.Attributes.DoubleKeys,
spanRow.Attributes.DoubleValues,
spanRow.Attributes.IntKeys,
spanRow.Attributes.IntValues,
spanRow.Attributes.StrKeys,
spanRow.Attributes.StrValues,
spanRow.Attributes.BytesKeys,
spanRow.Attributes.BytesValues,
scopeRow.Name,
scopeRow.Version,
scopeRow.Attributes.BoolKeys,
scopeRow.Attributes.BoolValues,
scopeRow.Attributes.DoubleKeys,
scopeRow.Attributes.DoubleValues,
scopeRow.Attributes.IntKeys,
scopeRow.Attributes.IntValues,
scopeRow.Attributes.StrKeys,
scopeRow.Attributes.StrValues,
scopeRow.Attributes.BytesKeys,
scopeRow.Attributes.BytesValues,
resourceRow.Attributes.BoolKeys,
resourceRow.Attributes.BoolValues,
resourceRow.Attributes.DoubleKeys,
resourceRow.Attributes.DoubleValues,
resourceRow.Attributes.IntKeys,
resourceRow.Attributes.IntValues,
resourceRow.Attributes.StrKeys,
resourceRow.Attributes.StrValues,
resourceRow.Attributes.BytesKeys,
resourceRow.Attributes.BytesValues,
eventsRow.Names,
eventsRow.Timestamps,
eventsAllAttrRow.BoolAttrs,
eventsAllAttrRow.DoubleAttrs,
eventsAllAttrRow.IntAttrs,
eventsAllAttrRow.StrAttrs,
eventsAllAttrRow.BytesAttrs,
linksRow.TraceIds,
linksRow.SpanIds,
linksRow.TraceStates,
linksAllAttrRow.BoolAttrs,
linksAllAttrRow.DoubleAttrs,
linksAllAttrRow.IntAttrs,
linksAllAttrRow.StrAttrs,
linksAllAttrRow.BytesAttrs,
)
However, to keep this PR small and simple, adding the batch.Append
logic with all these fields would be too large of a change. Therefore, it's better to add the complete batch.Append
implementation in a subsequent PR.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7141 +/- ##
==========================================
+ Coverage 96.20% 96.22% +0.01%
==========================================
Files 358 359 +1
Lines 21596 21708 +112
==========================================
+ Hits 20777 20889 +112
Misses 613 613
Partials 206 206
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
"github.com/jaegertracing/jaeger/internal/storage/v2/clickhouse/tracestore/dbmodel" | ||
) | ||
|
||
const insertTrace = "INSERT INTO otel_traces" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not complete yet; I am waiting for the schema to be defined.
Signed-off-by: zhengkezhou1 <[email protected]>
ec3635b
to
a76fc5b
Compare
Signed-off-by: zhengkezhou1 <[email protected]>
@zhengkezhou1 thanks for opening a PR! I'll take a look at it soon. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a few questions - great start so far!
"github.com/jaegertracing/jaeger/internal/storage/v2/clickhouse/tracestore/dbmodel" | ||
) | ||
|
||
const insertTrace = "INSERT INTO otel_traces" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a reason we need to call the table otel_traces
? why not just traces
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, use traces
is ok.
err := writer.WriteTraces(context.Background(), ptrace.NewTraces()) | ||
require.ErrorContains(t, err, "connect to server timeout") | ||
}) | ||
t.Run("failed when call Send not works", func(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we either turn these into table driven tests or make them separate unit tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, use the table driven test.
// traces now using the proto.Input to write, it should be replaced once chpool has been dropped. | ||
// see https://github.com/jaegertracing/jaeger/pull/7093 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it better to make this change first?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, i create a new PR: #7149 for it.
Signed-off-by: zhengkezhou1 <[email protected]>
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. You may re-open it if you need more time. |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. You may re-open it if you need more time. |
Which problem is this PR solving?
Description of the changes
tracewriter
should not be concerned with any ClickHouse connection-related details.How was this change tested?
Checklist
jaeger
:make lint test
jaeger-ui
:npm run lint
andnpm run test