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

add new columns to support Third Party Apis feat #542

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

shivanshuraj1333
Copy link
Member

@shivanshuraj1333 shivanshuraj1333 commented Feb 7, 2025

fixes: #541
related to: SigNoz/signoz#6815

Copy link
Member

@nityanandagohain nityanandagohain left a 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

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"},
Copy link
Member

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" {
Copy link
Member

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" {
Copy link
Member

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"`
Copy link
Member

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)
Copy link
Member

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,
Copy link
Member

Choose a reason for hiding this comment

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

please update insertTraceSQLTemplateV2

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

Successfully merging this pull request may close these issues.

feat: add columns used in Third Party Api Monitoring features
2 participants