vectordotdev / vector

A high-performance observability data pipeline.
https://vector.dev
Mozilla Public License 2.0
17.5k stars 1.53k forks source link

Rename all condition fields to `condition` #9303

Open lucperkins opened 3 years ago

lucperkins commented 3 years ago

I've notified that in our unit testing suite, you specify an ends_when condition using a source field, e.g.:

[transforms.my_transform.ends_when]
type = "vrl"
source = "exists(.some_field)

I think it'd be more intuitive to use condition and thereby bring unit testing in line with the route and filter transforms. This is the only place I've seen this but there may be others, and I'd recommend updating all of them.

leebenson commented 2 years ago

Per https://github.com/vectordotdev/vector/pull/9091, along with a name change, it'd be ideal if we could represent the expanded object form of condition in docs, and note the shorthand variant as an alternative.

This would allow us to use datadog_search as the condition type.

I'm not sure how to do that in cue without breakage.

JeanMertz commented 2 years ago

I'm pretty certain this is already possible?

That is, the condition field can be a VRL source, or an object with a type and whatever other fields are required by that type.

So these are identical:

[transforms.my_transform.ends_when]
type = "vrl"
source = "exists(.some_field)
transforms.my_transform.ends_when = "exists(.some_field)"
JeanMertz commented 2 years ago

I'll close this, as I don't believe there's any more work left to do here.

jszwedko commented 2 years ago

It looks like we still use source for conditions in reduce at least.

https://vector.dev/docs/reference/configuration/transforms/reduce/#starts_when.source

jszwedko commented 2 years ago

Just noting that the request was to rename the source field to condition. Maybe we don't want to do that though? In which case we could close this as wont-fix.

JeanMertz commented 2 years ago

Aha, interesting. Also, should we more prominently promote starts_when = '.foo == true' syntax, which forgoes any of the type and source/condition requirements.