-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
[Connectors API] Unify timestamp field parsing #104416
[Connectors API] Unify timestamp field parsing #104416
Conversation
Hi @jedrazb, I've created a changelog YAML for you. |
bc72114
to
f91f0e2
Compare
Pinging @elastic/ent-search-eng (Team:Enterprise Search) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From a functional perspective it looks correct, but after rethinking about the solution I'm not 100% sure, if the fix should happen inside the API, but rather in the client (connectors framework). Explained my rationale in the comment.
Still, feel free to merge it, if you think this solution is the right path forward 👍
builder.field(LAST_INCREMENTAL_SYNC_SCHEDULED_AT_FIELD.getPreferredName(), lastIncrementalSyncScheduledAt); | ||
builder.field( | ||
LAST_INCREMENTAL_SYNC_SCHEDULED_AT_FIELD.getPreferredName(), | ||
ConnectorUtils.formatInstantToFrameworkString(lastIncrementalSyncScheduledAt) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I'm seeing now formatInstantToFrameworkString
I'm wondering, if we should fix it the other way around. As the Connectors API guards everything around the protocol it feels cleaner, if the clients (like the framework) adapt to the API and not the other way around. In theory the connectors API should also be useable for other clients/schedulers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that the issue should be fixed at the framework level, and I already filed an enhancement request elastic/connectors#2067 to unify handling (parsing, representing) datetimes in connectors framework.
While this PR doesn't solve the underlying root cause it mitigates the symptoms and allows us move forward with integration. Also, think about the connectors created in older releases, we need to be backward compatible with their representation with timestamps (or prepare a migration). Once the issue is solved in framework we can change the API formatting of timestamps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanation, makes sense!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, nice one!
@timgrein @navarone-feekery After discussing this in the team sync, I'm adapting this PR to just address the issue of datetime parsing. Since it's not a bugfix I'm removing the label and not backporting this. Can you review again? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you for addressing the changes. Looks way cleaner to remove the framework specific logic out of the API 👍
This change fixes fixing a unit test bug present in initial release (
This PR is not adding a feature, it's unifying the logic we use to handle timestamps for connectors, therefore I'm backporting this to 8.12 to address the build failures. |
💚 All backports created successfully
Questions ?Please refer to the Backport tool documentation |
(cherry picked from commit a1d05d5) # Conflicts: # x-pack/plugin/ent-search/src/main/java/org/elasticsearch/xpack/application/connector/syncjob/ConnectorSyncJob.java # x-pack/plugin/ent-search/src/main/java/org/elasticsearch/xpack/application/connector/syncjob/action/UpdateConnectorSyncJobIngestionStatsAction.java
Changes
datetime
parsing logic withparseInstant
function applied to all datetime fields from user in connectors APIs - user can provide datetime in any ES-compatible format, the API will take care of making it compatible with connectors protocol