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

feat: added interpolation to the prefix property of gcp_cloud_storage. #203

Conversation

paulosimao-ardanlabs
Copy link
Contributor

@paulosimao-ardanlabs paulosimao-ardanlabs commented Jan 2, 2025

This PR adds interpolation to the prefix property of gcp_cloud_storage. Although there are no messages in context at this stage (so we have only bloblang expressions), it seems to be more ergonomic to deal with dynamic file filtering as input.

service.NewStringField(csiFieldPrefix).
Description("An optional path prefix, if set only objects with the prefix are consumed.").
service.NewInterpolatedStringField(csiFieldPrefix).
Description("An optional path prefix, if set only objects with the prefix are consumed - supports interpolation.").
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Description("An optional path prefix, if set only objects with the prefix are consumed - supports interpolation.").
Description("An optional path prefix, if set only objects with the prefix are consumed.").

NewInterpolatedStringField will append a sentence to the Description - you can see it in website/docs/components/inputs/gcp_cloud_storage.md

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks - fixed.

Copy link
Collaborator

@jem-davies jem-davies left a comment

Choose a reason for hiding this comment

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

Think will need to have a think about allowing a bloblang interpolation on an input component, because of the issue about not having a message to execute it against.

@jem-davies
Copy link
Collaborator

jem-davies commented Jan 2, 2025

I think we might need wider thinking about how we can enable the flexibility of bloblang interpolations to input components, more generally. imo.

Perhaps we should just add a section about it, to the page

@jem-davies
Copy link
Collaborator

Thanks for the PR - question: Are you able to give an example config where you are using this / what use-case does this change solve?

@paulosimao-ardanlabs
Copy link
Contributor Author

Thanks for the PR - question: Are you able to give an example config where you are using this / what use-case does this change solve?

Most of the time is used for dealing with dates in the path, like this: /path/date=${!(timestamp_unix()-(26060)).format_timestamp_strftime("%Y-%m-%d-%H")}

Or setting prefix based on other conditions - this could have been addressed with env vars - but the team finds it way more ergonomic, and we already have a good amount of pipelines like this.

@jem-davies jem-davies merged commit d7558cb into warpstreamlabs:main Jan 4, 2025
3 checks passed
@paulosimao-ardanlabs paulosimao-ardanlabs deleted the psimao/add-gcp-prefix-interpolation branch January 6, 2025 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants