chore: add value search for related values request (#8925)

This commit is contained in:
Srikanth Chekuri 2025-08-26 19:37:25 +05:30 committed by GitHub
parent 910751713d
commit 1e76046c7c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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