Skip to content

Commit

Permalink
fix(enrich_kv_store_set): default to 0 duration (#151)
Browse files Browse the repository at this point in the history
Documentation states that this is an optional parameter, but the
initializing function will return an error if it's not set.

> transform: enrich_kv_store_set: time: invalid duration ""
  • Loading branch information
shellcromancer committed Mar 23, 2024
1 parent 4f8288b commit 8a1d31c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build/config/substation.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@
settings: std.prune(std.mergePatch(default, $.helpers.abbv(settings))),
},
set(settings={}): {
local default = $.transform.enrich.kv_store.default { ttl_key: null, ttl_offset: null },
local default = $.transform.enrich.kv_store.default { ttl_key: null, ttl_offset: "0s" },

type: 'enrich_kv_store_set',
settings: std.prune(std.mergePatch(default, $.helpers.abbv(settings))),
Expand Down
4 changes: 4 additions & 0 deletions transform/enrich_kv_store_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ func newEnrichKVStoreSet(_ context.Context, cfg config.Config) (*enrichKVStoreSe
return nil, fmt.Errorf("transform: enrich_kv_store_set: %v", err)
}

if conf.TTLOffset == "" {
conf.TTLOffset = "0s"
}

dur, err := time.ParseDuration(conf.TTLOffset)
if err != nil {
return nil, fmt.Errorf("transform: enrich_kv_store_set: %v", err)
Expand Down

0 comments on commit 8a1d31c

Please sign in to comment.