mirror of
https://github.com/SigNoz/signoz.git
synced 2025-12-17 15:36:48 +00:00
chore: add value search for related values request (#8925)
This commit is contained in:
parent
910751713d
commit
1e76046c7c
@ -957,6 +957,40 @@ func (t *telemetryMetaStore) getRelatedValues(ctx context.Context, fieldValueSel
|
|||||||
sb.Where(sb.LE("unix_milli", fieldValueSelector.EndUnixMilli))
|
sb.Where(sb.LE("unix_milli", fieldValueSelector.EndUnixMilli))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if fieldValueSelector.Value != "" {
|
||||||
|
var conds []string
|
||||||
|
if fieldValueSelector.FieldContext != telemetrytypes.FieldContextAttribute &&
|
||||||
|
fieldValueSelector.FieldContext != telemetrytypes.FieldContextResource {
|
||||||
|
origContext := key.FieldContext
|
||||||
|
|
||||||
|
// search on attributes
|
||||||
|
key.FieldContext = telemetrytypes.FieldContextAttribute
|
||||||
|
cond, err := t.conditionBuilder.ConditionFor(ctx, key, qbtypes.FilterOperatorContains, fieldValueSelector.Value, sb)
|
||||||
|
if err == nil {
|
||||||
|
conds = append(conds, cond)
|
||||||
|
}
|
||||||
|
|
||||||
|
// search on resource
|
||||||
|
key.FieldContext = telemetrytypes.FieldContextResource
|
||||||
|
cond, err = t.conditionBuilder.ConditionFor(ctx, key, qbtypes.FilterOperatorContains, fieldValueSelector.Value, sb)
|
||||||
|
if err == nil {
|
||||||
|
conds = append(conds, cond)
|
||||||
|
}
|
||||||
|
key.FieldContext = origContext
|
||||||
|
} else {
|
||||||
|
cond, err := t.conditionBuilder.ConditionFor(ctx, key, qbtypes.FilterOperatorContains, fieldValueSelector.Value, sb)
|
||||||
|
if err == nil {
|
||||||
|
conds = append(conds, cond)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(conds) != 0 {
|
||||||
|
// see `expr` in condition_builder.go, if key doesn't exist we don't check for value
|
||||||
|
// hence, this is join of conditions on resource and attributes
|
||||||
|
sb.Where(sb.And(conds...))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
limit := fieldValueSelector.Limit
|
limit := fieldValueSelector.Limit
|
||||||
if limit == 0 {
|
if limit == 0 {
|
||||||
limit = 50
|
limit = 50
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user