Repository navigation
feat(odin): Upload fetch_logs files to a data set as a new copy each run (EDG-1037) - #592
vikramlc-cognite wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the built-in fetch_logs action to upload a new copy of log files on every invocation instead of overwriting them, utilizing unique, deterministic external IDs. It also introduces the Extractor.get_log_upload_data_set_id() hook to resolve the target data set for log uploads and adds a new completed_with_errors action status when no files are uploaded. The review feedback correctly identifies a potential bug in the external ID generation where a negative room value would slice the integration ID from the end rather than truncating it, and provides a robust fix using max(0, room).
| room = MAX_EXTERNAL_ID_LENGTH - len("extractor-logs--") - len(suffix) | ||
| return f"extractor-logs-{integration_external_id[:room]}-{suffix}" |
There was a problem hiding this comment.
If room is negative (for example, if MAX_EXTERNAL_ID_LENGTH is configured to be smaller or if suffix is longer in future modifications), integration_external_id[:room] will slice from the end of the string instead of truncating it. This would keep almost the entire string and could cause the external ID to exceed the limit, leading to upload failures. Ensure room is non-negative by using max(0, room).
| room = MAX_EXTERNAL_ID_LENGTH - len("extractor-logs--") - len(suffix) | |
| return f"extractor-logs-{integration_external_id[:room]}-{suffix}" | |
| room = max(0, MAX_EXTERNAL_ID_LENGTH - len("extractor-logs--") - len(suffix)) | |
| return f"extractor-logs-{integration_external_id[:room]}-{suffix}" |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## EDG-1035-action-outcome-status #592 +/- ##
==================================================================
+ Coverage 85.25% 85.33% +0.08%
==================================================================
Files 46 46
Lines 4882 4910 +28
==================================================================
+ Hits 4162 4190 +28
Misses 720 720
🚀 New features to boost your workflow:
|
fetch_logs asks the extractor for a data set (Extractor.get_log_upload_data_set_id), no longer overwrites earlier uploads, and ends as completed_with_errors when no file was uploaded. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
509f746 to
6087f48
Compare
Summary
fetch_logsuploads log files into the extractor's data set (when one is set), keeps a new copy on every run, and endscompleted_with_errorswhen nothing was uploaded.Type of change
What changed
Extractor.get_log_upload_data_set_id(); the default uses the config data set when the config derives fromWithDataSetId, otherwise none. A markedTODO(data-domains)placeholder for the future integration data domains field (not implemented)._log_upload_action.py: passesdata_set_idtoupload_bytesonly when set; removesoverwrite=True; external ID is nowextractor-logs-<integration>-<date>-<action external id>(hashed if over 255 characters).completed_with_errorswith "No log files were uploaded (0 of N ...)"; partial uploads staysucceeded; invalid parameters stayfailed.missing(wasskipped), to match themissing_filescounter. Counter keys are unchanged.ActionContext.set_result(..., completed_with_errors=...); tests (about 12 existing ones updated); CHANGELOG.Why it changed
succeeded.completed_with_errors(cognitedata/odin#324).What to focus on during review
data_sets.retrievefor a configured data set; an exception fails the action.skippedtomissing.Test evidence
tests/test_unstable/test_log_upload_action.py: 9 net new tests (data set passed/omitted, default hook, two runs -> different IDs withoutoverwrite, ID length, partialsucceeded, none uploadedcompleted_with_errors, invalid rangefailed, cancel wins)uv run pytest tests/test_unstable: 309 passed; the same 1 failed + 48 environment errors asmasterruff,ruff format,mypy,pre-commit run --all-filespassRisks and unknowns
succeeded.Rollout and rollback
Checklist
skipped->missingstatus string