mirror of
https://github.com/SigNoz/signoz.git
synced 2025-12-17 15:36:48 +00:00
fix: don't fetch all attributes during build and run query (#8589)
This commit is contained in:
parent
d712dc1f28
commit
c9e8114b5e
@ -283,7 +283,7 @@ func (r *ThresholdRule) buildAndRunQuery(ctx context.Context, orgID valuer.UUID,
|
|||||||
if hasLogsQuery {
|
if hasLogsQuery {
|
||||||
// check if any enrichment is required for logs if yes then enrich them
|
// check if any enrichment is required for logs if yes then enrich them
|
||||||
if logsv3.EnrichmentRequired(params) {
|
if logsv3.EnrichmentRequired(params) {
|
||||||
logsFields, err := r.reader.GetLogFields(ctx)
|
logsFields, err := r.reader.GetLogFieldsFromNames(ctx, logsv3.GetFieldNames(params.CompositeQuery))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1320,7 +1320,6 @@ func TestThresholdRuleNoData(t *testing.T) {
|
|||||||
for idx, c := range cases {
|
for idx, c := range cases {
|
||||||
rows := cmock.NewRows(cols, c.values)
|
rows := cmock.NewRows(cols, c.values)
|
||||||
|
|
||||||
|
|
||||||
// We are testing the eval logic after the query is run
|
// We are testing the eval logic after the query is run
|
||||||
// so we don't care about the query string here
|
// so we don't care about the query string here
|
||||||
queryString := "SELECT any"
|
queryString := "SELECT any"
|
||||||
@ -1514,11 +1513,11 @@ func TestThresholdRuleLogsLink(t *testing.T) {
|
|||||||
|
|
||||||
attrMetaCols := make([]cmock.ColumnType, 0)
|
attrMetaCols := make([]cmock.ColumnType, 0)
|
||||||
attrMetaCols = append(attrMetaCols, cmock.ColumnType{Name: "name", Type: "String"})
|
attrMetaCols = append(attrMetaCols, cmock.ColumnType{Name: "name", Type: "String"})
|
||||||
attrMetaCols = append(attrMetaCols, cmock.ColumnType{Name: "dataType", Type: "String"})
|
attrMetaCols = append(attrMetaCols, cmock.ColumnType{Name: "datatype", Type: "String"})
|
||||||
|
|
||||||
resourceMetaCols := make([]cmock.ColumnType, 0)
|
resourceMetaCols := make([]cmock.ColumnType, 0)
|
||||||
resourceMetaCols = append(resourceMetaCols, cmock.ColumnType{Name: "name", Type: "String"})
|
resourceMetaCols = append(resourceMetaCols, cmock.ColumnType{Name: "name", Type: "String"})
|
||||||
resourceMetaCols = append(resourceMetaCols, cmock.ColumnType{Name: "dataType", Type: "String"})
|
resourceMetaCols = append(resourceMetaCols, cmock.ColumnType{Name: "datatype", Type: "String"})
|
||||||
|
|
||||||
createTableCols := make([]cmock.ColumnType, 0)
|
createTableCols := make([]cmock.ColumnType, 0)
|
||||||
createTableCols = append(createTableCols, cmock.ColumnType{Name: "statement", Type: "String"})
|
createTableCols = append(createTableCols, cmock.ColumnType{Name: "statement", Type: "String"})
|
||||||
@ -1531,12 +1530,12 @@ func TestThresholdRuleLogsLink(t *testing.T) {
|
|||||||
for idx, c := range testCases {
|
for idx, c := range testCases {
|
||||||
attrMetaRows := cmock.NewRows(attrMetaCols, c.attrMetaValues)
|
attrMetaRows := cmock.NewRows(attrMetaCols, c.attrMetaValues)
|
||||||
telemetryStore.Mock().
|
telemetryStore.Mock().
|
||||||
ExpectSelect("SELECT DISTINCT name, datatype from signoz_logs.distributed_logs_attribute_keys group by name, datatype").
|
ExpectSelect("SELECT DISTINCT name, datatype from signoz_logs.distributed_logs_attribute_keys where name in ('component','k8s.container.name') group by name, datatype").
|
||||||
WillReturnRows(attrMetaRows)
|
WillReturnRows(attrMetaRows)
|
||||||
|
|
||||||
resourceMetaRows := cmock.NewRows(resourceMetaCols, c.resourceMetaValues)
|
resourceMetaRows := cmock.NewRows(resourceMetaCols, c.resourceMetaValues)
|
||||||
telemetryStore.Mock().
|
telemetryStore.Mock().
|
||||||
ExpectSelect("SELECT DISTINCT name, datatype from signoz_logs.distributed_logs_resource_keys group by name, datatype").
|
ExpectSelect("SELECT DISTINCT name, datatype from signoz_logs.distributed_logs_resource_keys where name in ('component','k8s.container.name') group by name, datatype").
|
||||||
WillReturnRows(resourceMetaRows)
|
WillReturnRows(resourceMetaRows)
|
||||||
|
|
||||||
createTableRows := cmock.NewRows(createTableCols, c.createTableValues)
|
createTableRows := cmock.NewRows(createTableCols, c.createTableValues)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user