Skip to content

Commit a359709

Browse files
Document foreach id collection types
Co-authored-by: piotr.gwizdala <piotr.gwizdala@grafana.com>
1 parent 1a32e5e commit a359709

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

internal/runtime/internal/controller/node_config_foreach.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,20 +444,23 @@ func objectFingerprint(id any, hashId bool) string {
444444
func collectionItemID(item any, key string, logger log.Logger) (any, bool) {
445445
switch value := item.(type) {
446446
case map[string]any:
447+
// Inline object literals in Alloy decode into map[string]any.
447448
val, ok := value[key]
448449
if !ok {
449450
logMissingCollectionID(logger, key)
450451
return nil, false
451452
}
452453
return val, true
453454
case map[string]string:
455+
// Object values sourced from Go (e.g., vars) often use map[string]string.
454456
val, ok := value[key]
455457
if !ok {
456458
logMissingCollectionID(logger, key)
457459
return nil, false
458460
}
459461
return val, true
460462
case map[string]syntax.Value:
463+
// Capsules converted to objects use map[string]syntax.Value (VM canonical form).
461464
val, ok := value[key]
462465
if !ok {
463466
logMissingCollectionID(logger, key)

0 commit comments

Comments
 (0)