Skip to content

Commit

Permalink
feat: add span.Warnings to cassandra schema
Browse files Browse the repository at this point in the history
Signed-off-by: Rohan Kumar <rohankmr414@gmail.com>
  • Loading branch information
rohankmr414 committed Feb 6, 2023
1 parent 3fc45f5 commit e6f6953
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion examples/hotrod/pkg/tracing/rpcmetrics/observer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ import (
"time"

opentracing "github.com/opentracing/opentracing-go"
"github.com/opentracing/opentracing-go/ext"
"github.com/stretchr/testify/assert"
otbridge "go.opentelemetry.io/otel/bridge/opentracing"
"go.opentelemetry.io/otel/sdk/resource"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
semconv "go.opentelemetry.io/otel/semconv/v1.7.0"
"github.com/opentracing/opentracing-go/ext"

u "github.com/jaegertracing/jaeger/internal/metricstest"
)
Expand Down
2 changes: 2 additions & 0 deletions plugin/storage/cassandra/spanstore/dbmodel/converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ func (c converter) fromDomain(span *model.Span) *Span {
Logs: logs,
Refs: refs,
Process: udtProcess,
Warnings: span.Warnings,
ServiceName: span.Process.ServiceName,
SpanHash: int64(spanHash),
}
Expand Down Expand Up @@ -107,6 +108,7 @@ func (c converter) toDomain(dbSpan *Span) (*model.Span, error) {
Tags: tags,
Logs: logs,
Process: process,
Warnings: dbSpan.Warnings,
}
return span, nil
}
Expand Down
1 change: 1 addition & 0 deletions plugin/storage/cassandra/spanstore/dbmodel/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ type Span struct {
Logs []Log
Refs []SpanRef
Process Process
Warnings []string
ServiceName string
SpanHash int64
}
Expand Down
4 changes: 3 additions & 1 deletion plugin/storage/cassandra/spanstore/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,9 @@ func (s *SpanReader) readTraceInSpan(ctx context.Context, traceID dbmodel.TraceI
var refs []dbmodel.SpanRef
var tags []dbmodel.KeyValue
var logs []dbmodel.Log
var warnings []string
retMe := &model.Trace{}
for i.Scan(&traceIDFromSpan, &spanID, &parentID, &operationName, &flags, &startTime, &duration, &tags, &logs, &refs, &dbProcess) {
for i.Scan(&traceIDFromSpan, &spanID, &parentID, &operationName, &flags, &startTime, &duration, &tags, &logs, &refs, &dbProcess, &warnings) {
dbSpan := dbmodel.Span{
TraceID: traceIDFromSpan,
SpanID: spanID,
Expand All @@ -186,6 +187,7 @@ func (s *SpanReader) readTraceInSpan(ctx context.Context, traceID dbmodel.TraceI
Logs: logs,
Refs: refs,
Process: dbProcess,
Warnings: warnings,
ServiceName: dbProcess.ServiceName,
}
span, err := dbmodel.ToDomain(&dbSpan)
Expand Down
5 changes: 3 additions & 2 deletions plugin/storage/cassandra/spanstore/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ const (
insertSpan = `
INSERT
INTO traces(trace_id, span_id, span_hash, parent_id, operation_name, flags,
start_time, duration, tags, logs, refs, process)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`
start_time, duration, tags, logs, refs, process, warnings)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`

serviceNameIndex = `
INSERT
Expand Down Expand Up @@ -168,6 +168,7 @@ func (s *SpanWriter) writeSpan(span *model.Span, ds *dbmodel.Span) error {
ds.Logs,
ds.Refs,
ds.Process,
ds.Warnings,
)
if err := s.writerMetrics.traces.Exec(mainQuery, s.logger); err != nil {
return s.logError(ds, err, "Failed to insert span", s.logger)
Expand Down

0 comments on commit e6f6953

Please sign in to comment.