Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[connector/routing] Add support for standard converter functions in routing conditions #38312

Merged

Conversation

schmikei
Copy link
Contributor

@schmikei schmikei commented Mar 3, 2025

Description

Just adding to the factory of the routing connector to include some useful for routing OTTL functions. Let me know if I'm overlooking anything as this is my first contribution to the routing connector!

Link to tracking issue

Resolves #38282

Testing

Tested with the three signals conditions on Logs, Metrics and Traces

Documentation

Updated the list of OTTLFuncs supported in the README

Comment on lines 19 to 26
func Functions[K any]() map[string]ottl.Factory[K] {
return ottl.CreateFactoryMap(
ottlfuncs.NewIsMatchFactory[K](),
ottlfuncs.NewIsMapFactory[K](),
ottlfuncs.NewIsStringFactory[K](),
ottlfuncs.NewDeleteKeyFactory[K](),
ottlfuncs.NewDeleteMatchingKeysFactory[K](),
// noop function, it is required since the parsing of conditions is not implemented yet,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
func Functions[K any]() map[string]ottl.Factory[K] {
return ottl.CreateFactoryMap(
ottlfuncs.NewIsMatchFactory[K](),
ottlfuncs.NewIsMapFactory[K](),
ottlfuncs.NewIsStringFactory[K](),
ottlfuncs.NewDeleteKeyFactory[K](),
ottlfuncs.NewDeleteMatchingKeysFactory[K](),
// noop function, it is required since the parsing of conditions is not implemented yet,
func Functions[K any]() map[string]ottl.Factory[K] {
return ottlfuncs.StandardConverters[K]()
}

I could also see this being an implementation choice, I'll leave it up to the maintainers here if they think that is too much!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the routing connect should have access to all converters. This is safe since converters never change the underlying telemetry itself. @jpkrohling, @mwear @djaglowski do you agree?

schmikei added 3 commits March 5, 2025 14:22
…tor-contrib into feat/add-routing-ismatch-isStr
…opentelemetry-collector-contrib into feat/add-routing-ismatch-isStr
@schmikei schmikei changed the title [connector/routing] Add support for IsMap and IsString as supported OTTL functions [connector/routing] Add support for converter functions in routing conditions Mar 5, 2025
@schmikei schmikei changed the title [connector/routing] Add support for converter functions in routing conditions [connector/routing] Add support for standard converter functions in routing conditions Mar 5, 2025
Copy link
Member

@djaglowski djaglowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dehaansa dehaansa added the ready to merge Code review completed; ready to merge by maintainers label Mar 6, 2025
@songy23 songy23 merged commit 5467dc3 into open-telemetry:main Mar 6, 2025
167 checks passed
@github-actions github-actions bot added this to the next release milestone Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
connector/routing ready to merge Code review completed; ready to merge by maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[connector/routing]: Add support for IsMap and IsString OTTL funcs
5 participants