Repository navigation
Fix timezone issue for ingestion - #668
Open
Aasav Badera (aasavbadera) wants to merge 4 commits into
Open
Aasav Badera (aasavbadera) wants to merge 4 commits into
Aasav Badera (aasavbadera) wants to merge 4 commits into
Conversation
Keep resource cache writes and comparisons in aware UTC. Cover successive resource lookups and cache-expiry boundaries, verify UTC ingestion message serialization, and format the PR changes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6f4a536a-7f7a-4d39-b60e-96db0cb49c1c
Verify authorization-context reuse and refresh before, at, and after the one-hour boundary, including reuse of the refreshed context and service-fetch counts. Check timezone-aware UTC arguments for every authorization and resource-cache clock call. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6f4a536a-7f7a-4d39-b60e-96db0cb49c1c
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
Authenticated Kusto end-to-end validation is still pending in the Azure pipeline, leaving service acceptance of the queued-ingestion timestamp’s new UTC-offset format unverified.
No open issues 🎉
What changed in this PR
Fixes UTC handling in the Python SDK’s queued-ingestion path, replacing deprecated clock calls and keeping cache timestamps and expiry comparisons timezone-aware. This same-repository replacement for #647 makes authenticated Kusto end-to-end tests eligible for the trusted Azure pipeline.
Changes:
- Use timezone-aware UTC timestamps for ingestion messages and cache refresh logic.
- Add deterministic tests for cache reuse and expiry before, at, and after the one-hour boundary.
- Verify serialized ingestion timestamps have a zero UTC offset.
| File | Description |
|---|---|
azure-kusto-ingest/tests/test_kusto_ingest_client.py |
Tests resource and authorization-cache refresh boundaries, fetch counts, and UTC clock arguments. |
azure-kusto-ingest/tests/test_ingestion_blob_info.py |
Checks that serialized message timestamps use UTC. |
azure-kusto-ingest/azure/kusto/ingest/ingestion_blob_info.py |
Generates timezone-aware UTC message timestamps. |
azure-kusto-ingest/azure/kusto/ingest/_resource_manager.py |
Uses timezone-aware UTC for both caches’ update timestamps and expiry comparisons. |
Review effort: Max
Generate timestamps in explicit UTC while retaining the timezone-less ingestion-message representation. Add frozen-clock regressions for optional fractional seconds and UTC generation; leave cache timestamps aware. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6f4a536a-7f7a-4d39-b60e-96db0cb49c1c
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added
Deterministic mocked-clock tests for resource and authorization-context cache reuse before, at, and after the one-hour refresh boundary, including UTC clock arguments, service-fetch counts, and reuse of refreshed values. Ingestion-message regression tests cover exact legacy UTC timestamp strings with and without fractional seconds and verify explicit UTC clock arguments.
Changed
Same-repository replacement for #647, using
aasavbadera/timezone-issueintomaster, so authenticated Kusto E2E tests are eligible to run in the trusted Azure pipeline instead of being excluded for a fork. Preserves FlorianBracq's original commit and the subsequent resource-cache fix.Fixed
Replace deprecated
datetime.utcnow()calls withdatetime.now(tz=timezone.utc). Cache assignments and comparisons are consistently timezone-aware, avoiding theTypeErroron repeated resource lookups. Addresses the remaining authorization-cache reuse and expiry review feedback in #647.Preserve the existing
SourceMessageCreationTimewire format: a timezone-less UTC ISO timestamp, without an added+00:00suffix. Timezone metadata is omitted only at serialization; internal resource and authorization caches remain UTC-aware.Compatibility: Public SDK signatures, result types, Python support, dependencies, and customer-row formatting are unchanged. Integrations depending on private cache timestamp fields or patching only
utcnow()may still need adjustments.Validation: 25 targeted tests passed on Python 3.12 with deprecation warnings treated as errors; repository-wide Ruff formatting/lint and basedpyright passed; both SDK source distributions and wheels built successfully.
Authenticated Azure build 192713292 passed for exact head
11c99171ee579603e5e29e114dbadb4ed399c781. Each Python 3.9-3.13 job passed 297 unit tests (26 unit tests skipped) and 31 E2E tests with no E2E skips. The authenticated test tasks executed successfully; fork-only credential-free tasks were skipped.