Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 43 additions & 10 deletions internal/storage/v2/clickhouse/tracestore/dbmodel/dbmodel.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,51 +3,84 @@

package dbmodel

import "time"
import (
"time"
)

// Trace Domain model in Clickhouse.
// This struct represents the schema for storing OTel pipeline Traces in Clickhouse.
// This struct represents the schema for storing ptrace.Traces in Clickhouse.
type Trace struct {
Resource Resource
Scope Scope
Span Span
Links []Link
Events []Event
Links []Link
}

// Resource Domain model in Clickhouse.
// This struct represents the schema for storing pcommon.Resource in Clickhouse.
type Resource struct {
Attributes AttributesGroup
}

// Scope Domain model in Clickhouse.
// This struct represents the schema for storing pcommon.InstrumentationScope in Clickhouse.
type Scope struct {
Name string
Version string
Attributes AttributesGroup
}

// Span Domain model in Clickhouse.
// This struct represents the schema for storing ptrace.Span in Clickhouse.
type Span struct {
Timestamp time.Time
TraceId string
SpanId string
ParentSpanId string
StartTime time.Time
TraceId []byte
SpanId []byte
ParentSpanId []byte
TraceState string
ServiceName string
Name string
Kind string
Duration time.Time
Duration int64
StatusCode string
StatusMessage string
Attributes AttributesGroup
}

// Link Domain model in Clickhouse.
// This struct represents the schema for storing ptrace.SpanLink in Clickhouse.
type Link struct {
TraceId string
SpanId string
TraceId []byte
SpanId []byte
TraceState string
Attributes AttributesGroup
}

// Event Domain model in Clickhouse.
// This struct represents the schema for storing ptrace.SpanLink in Clickhouse.
type Event struct {
Name string
Timestamp time.Time
Attributes AttributesGroup
}

// AttributesGroup captures all data from a single pcommon.Map, except
// complex attributes (like slice or map) which are currently not supported.
// AttributesGroup consists of pairs of vectors for each of the supported primitive
// types, e.g. (BoolKeys, BoolValues). Every attribute in the pcommon.Map is mapped
// to one of the pairs depending on its type. The slices in each pair have identical
// length, which may be different from length in another pair. For example, if the
// pcommon.Map has no Boolean attributes then (BoolKeys=[], BoolValues=[]).
type AttributesGroup struct {
BoolKeys []string
BoolValues []bool
DoubleKeys []string
DoubleValues []float64
IntKeys []string
IntValues []int64
StrKeys []string
StrValues []string
BytesKeys []string
BytesValues [][]byte
}
Loading
Loading