-
Notifications
You must be signed in to change notification settings - Fork 44
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
add new columns to support Third Party Apis feat #542
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Shivanshu Raj Shrivastava <[email protected]>
Signed-off-by: Shivanshu Raj Shrivastava <[email protected]>
Signed-off-by: Shivanshu Raj Shrivastava <[email protected]>
4a2ef55
to
842633e
Compare
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.
I have a feeling that this was not tested locally.
Please run the migrations locally first by using this command
- go run cmd/signozschemamigrator/main.go --dsn http://localhost:9000 --dev=true --replication=true sync
- go run cmd/signozschemamigrator/main.go --dsn http://localhost:9000 --dev=true --replication=true async
You might need to drop the db as well for testing the migrations.
Also updating the old struct which writes to signoz_index_v2 is not required and we can direcly add this feature just to new table signoz_index_v3.
@@ -202,6 +204,8 @@ var TracesMigrations = []SchemaMigrationRecord{ | |||
{Name: "responseStatusCode", Type: LowCardinalityColumnType{ColumnTypeString}, Alias: "response_status_code"}, | |||
{Name: "externalHttpUrl", Type: LowCardinalityColumnType{ColumnTypeString}, Alias: "external_http_url"}, | |||
{Name: "httpUrl", Type: LowCardinalityColumnType{ColumnTypeString}, Alias: "http_url"}, | |||
{Name: "serverAddress", Type: LowCardinalityColumnType{ColumnTypeString}, Alias: "server_address"}, | |||
{Name: "urlPath", Type: LowCardinalityColumnType{ColumnTypeString}, Alias: "url_path"}, |
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.
existing migrations cannot be edited, also the migration should be create column migration for server_address
and url_path
. serverAddress
and urlPath
is not required since these are not old attributes.
@@ -189,6 +189,10 @@ func populateOtherDimensions(attributes pcommon.Map, span *Span) { | |||
} | |||
span.ExternalHttpUrl = value | |||
span.HttpUrl = v.Str() | |||
} else if k == "http.target" || k == "url.path" { |
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.
let's not update this code as we are not creating these columns in the old table.
@@ -38,11 +38,19 @@ func populateCustomAttrsAndAttrs(attributes pcommon.Map, span *SpanV3) { | |||
} | |||
span.ExternalHttpUrl = value | |||
span.HttpUrl = v.Str() | |||
} else if k == "http.target" || k == "url.path" { | |||
span.UrlPath = v.Str() | |||
} else if k == "net.peer.name" || k == "server.address" { |
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.
logic is duplicate and server.address
is conflicting in span.ServerAddress
and span.HttpHost
@@ -130,6 +130,8 @@ type Span struct { | |||
ResponseStatusCode string `json:"responseStatusCode,omitempty"` | |||
Tenant *string `json:"-"` | |||
SpanAttributes []SpanAttribute `json:"spanAttributes,omitempty"` | |||
ServerAddress string `json:"serverAddress,omitempty"` |
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 needed for old span struct
@@ -238,6 +242,8 @@ func (s *Span) MarshalLogObject(enc zapcore.ObjectEncoder) error { | |||
enc.AddString("errorGroupID", s.ErrorGroupID) | |||
enc.AddObject("errorEvent", &s.ErrorEvent) | |||
enc.AddObject("traceModel", &s.TraceModel) | |||
enc.AddString("serverAddress", s.ServerAddress) | |||
enc.AddString("urlPath", s.UrlPath) |
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 needed
@@ -62,6 +62,8 @@ func (w *SpanWriter) writeIndexBatchV3(ctx context.Context, batchSpans []*SpanV3 | |||
span.ResponseStatusCode, | |||
span.ExternalHttpUrl, | |||
span.HttpUrl, | |||
span.ServerAddress, | |||
span.UrlPath, |
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.
please update insertTraceSQLTemplateV2
fixes: #541
related to: SigNoz/signoz#6815