Skip to content

fix(ingest): log the real cause when a DCR upload fails - #7

Merged
danieltruong merged 2 commits into
mainfrom
fix-upload-error-cause
Sep 6, 2026
Merged

danieltruong merged 2 commits into
mainfrom
fix-upload-error-cause

Conversation

@danieltruong

Copy link
Copy Markdown
Collaborator

AggregateLogsUploadError from @azure/monitor-ingestion has the message "undefined\n}"; the real RestError sits in errors[].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() in dcr-writer.js unwraps 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] dropped prefix the alert keys on is unchanged.
  • sendWithRetry stops after one attempt when every cause is 401 or 403.
  • 6 tests, each proven to fail against the old code.
  • docs/MIGRATION.md section 4 gains the role grant the import needs.

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.
@danieltruong
danieltruong merged commit 0cc27a6 into main Sep 6, 2026
3 checks passed
@danieltruong
danieltruong deleted the fix-upload-error-cause branch September 6, 2026 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant