fix(ingest): log the real cause when a DCR upload fails - #7
Merged
Merged
Conversation
AggregateLogsUploadError from @azure/monitor-ingestion carries the message "undefined\n}"; the RestError sits in errors[].cause. Every drop and flush log line printed the placeholder, so a 403 on the rule looked like a blank failure. Unwrap the causes (status code and service message, no row payloads) and stop retrying when every cause is 401 or 403. MIGRATION.md gains the Monitoring Metrics Publisher grant the history import needs: Owner does not cover data actions on the rule.
Mixed 403/503 batches keep three attempts, 401 drops on the first, and the drop line's attempt count is asserted in full. The aggregate error check is Array.isArray(err.errors) alone: the SDK predicate also matches name-only objects with no errors array.
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.
AggregateLogsUploadErrorfrom@azure/monitor-ingestionhas the message"undefined\n}"; the realRestErrorsits inerrors[].cause. Every drop and flush log line printed the placeholder, so the first history import attempt on test showed a blank failure that was in fact a 403 (the operator login had no Monitoring Metrics Publisher on the rule).describeUploadError()indcr-writer.jsunwraps status code and service message (deduped, capped at 3, no row payloads); used by the drop log, both flush catches and the import script. The[analytics] droppedprefix the alert keys on is unchanged.sendWithRetrystops after one attempt when every cause is 401 or 403.docs/MIGRATION.mdsection 4 gains the role grant the import needs.