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

fix: Add required fields to the signature of experimental/to #4901

Closed
wants to merge 1 commit into from

Conversation

Marwes
Copy link
Contributor

@Marwes Marwes commented Jun 21, 2022

The documentation implies that these fields are mandatory to call this function and looking at the implementation it will indeed error if they are missing. Changing this is still technically a breaking change so maybe we want some caution before merging this? (#4773 could perhaps be used to allow an incremental rollout, or I could run this through the query log analyzer I made for #4776)

@Marwes Marwes requested review from a team as code owners June 21, 2022 13:50
@Marwes Marwes requested review from wolffcm and lwandzura and removed request for a team June 21, 2022 13:50
Copy link

@wolffcm wolffcm left a comment

Choose a reason for hiding this comment

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

Incidentally, I wrote the experimental.to code. It just seems like the user would get a different error if _measurement or _time was missing? This seems totally fine to me.

If you are still cautious, you might try out this change in remocal and verify that the new behavior isn't any worse.

@Marwes
Copy link
Contributor Author

Marwes commented Jun 21, 2022

Yeah, in theory it would just be a compiletime error instead of a runtime one. But there may be some weirdness due to type inference changing or perhaps the current runtime error doesn't fire for a script as the execution never reaches that point

@Marwes Marwes force-pushed the to_requires_fields branch from 570e0f3 to 7630059 Compare June 21, 2022 16:30
@wolffcm
Copy link

wolffcm commented Jun 21, 2022

@Marwes

But there may be some weirdness due to type inference changing or perhaps the current runtime error doesn't fire for a script as the execution never reaches that point

I'm not sure what you mean here. Are you thinking of a particular case?

It does seem that a query that sends no data to experimental.to would succeed today. It could be that users use to as a way to log infrequent error conditions in their application. However, this mechanism would have never succeeded for them, if _measurement and _time were missing, as both fields are truly required to write data to InfluxDB.

We developed experimental.to as a way to enable the alerting framework, which uses Flux code generated by the UI. My sense is that almost all uses of experimental.to are for this. I think if you were to run some of these generated queries through type inference and they continue to succeed, then we are probably pretty safe here.

@Marwes
Copy link
Contributor Author

Marwes commented Jun 21, 2022

I'm not sure what you mean here. Are you thinking of a particular case?

The case of no data is one, another could be just a random statement that never gets executued.

if false then
    array.from(rows: [{}]) |> experimental.to()

which would now fail at compile time.

We developed experimental.to as a way to enable the alerting framework, which uses Flux code generated by the UI. My sense is that almost all uses of experimental.to are for this. I think if you were to run some of these generated queries through type inference and they continue to succeed, then we are probably pretty safe here.

Where do I find these?

The documentation implies that these fields are mandatory to call this function and looking at the implementation it will indeed error if they are missing. Changing this is still technically a breaking change so maybe we want some caution before merging this? (#4773 could perhaps be used to allow an incremental rollout, or I could run this through the query log analyzer I made for #4776)
@Marwes Marwes force-pushed the to_requires_fields branch from 7630059 to fd4922a Compare June 21, 2022 16:53
@github-actions
Copy link

This PR has had no recent activity and will be closed soon.

@github-actions github-actions bot closed this Apr 25, 2023
@jacobmarble jacobmarble deleted the to_requires_fields branch January 4, 2024 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants