fix: trace column attributes (#3000)

This commit is contained in:
Vishal Sharma 2023-06-30 10:55:45 +05:30 committed by GitHub
parent 20687d5184
commit 709bfda0cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4299,6 +4299,8 @@ func (r *ClickHouseReader) GetTraceAggregateAttributes(ctx context.Context, req
if err := rows.Scan(&tagKey, &tagType, &dataType, &isColumn); err != nil { if err := rows.Scan(&tagKey, &tagType, &dataType, &isColumn); err != nil {
return nil, fmt.Errorf("error while scanning rows: %s", err.Error()) return nil, fmt.Errorf("error while scanning rows: %s", err.Error())
} }
// TODO: Remove this once the column name are updated in the table
tagKey = tempHandleFixedColumns(tagKey)
key := v3.AttributeKey{ key := v3.AttributeKey{
Key: tagKey, Key: tagKey,
DataType: v3.AttributeKeyDataType(dataType), DataType: v3.AttributeKeyDataType(dataType),
@ -4338,6 +4340,8 @@ func (r *ClickHouseReader) GetTraceAttributeKeys(ctx context.Context, req *v3.Fi
if err := rows.Scan(&tagKey, &tagType, &dataType, &isColumn); err != nil { if err := rows.Scan(&tagKey, &tagType, &dataType, &isColumn); err != nil {
return nil, fmt.Errorf("error while scanning rows: %s", err.Error()) return nil, fmt.Errorf("error while scanning rows: %s", err.Error())
} }
// TODO: Remove this once the column name are updated in the table
tagKey = tempHandleFixedColumns(tagKey)
key := v3.AttributeKey{ key := v3.AttributeKey{
Key: tagKey, Key: tagKey,
DataType: v3.AttributeKeyDataType(dataType), DataType: v3.AttributeKeyDataType(dataType),
@ -4349,6 +4353,19 @@ func (r *ClickHouseReader) GetTraceAttributeKeys(ctx context.Context, req *v3.Fi
return &response, nil return &response, nil
} }
// tempHandleFixedColumns is a temporary function to handle the fixed columns whose name has been changed in AttributeKeys Table
func tempHandleFixedColumns(tagKey string) string {
switch {
case tagKey == "traceId":
tagKey = "traceID"
case tagKey == "spanId":
tagKey = "spanID"
case tagKey == "parentSpanId":
tagKey = "parentSpanID"
}
return tagKey
}
func (r *ClickHouseReader) GetTraceAttributeValues(ctx context.Context, req *v3.FilterAttributeValueRequest) (*v3.FilterAttributeValueResponse, error) { func (r *ClickHouseReader) GetTraceAttributeValues(ctx context.Context, req *v3.FilterAttributeValueRequest) (*v3.FilterAttributeValueResponse, error) {
var query string var query string