{"record":{"id":"26449ca295a5199f","repo":"amir20/dozzle","slug":"cloud-alerts-w","errorCode":null,"errorMessage":"cloud: alerts: %w","messagePattern":"cloud: alerts: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cloud/alerts.go","lineNumber":118,"sourceCode":"\t}\n\n\tmdPairs := []string{\"x-api-key\", apiKey}\n\tif c.instanceID != \"\" {\n\t\tmdPairs = append(mdPairs, \"x-instance-id\", c.instanceID)\n\t}\n\tcallCtx := metadata.NewOutgoingContext(ctx, metadata.Pairs(mdPairs...))\n\n\tresp, err := client.GetAlerts(callCtx, &pb.GetAlertsRequest{\n\t\tContainerIds:     containerIDs,\n\t\tHostId:           hostID,\n\t\tFromTsNs:         fromNs,\n\t\tToTsNs:           toNs,\n\t\tLimit:            limit,\n\t\tIncludeFollowUps: includeFollowUps,\n\t\tIncludeEvents:    includeEvents,\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cloud: alerts: %w\", err)\n\t}\n\n\thits := make([]AlertHit, 0, len(resp.GetHits()))\n\tfor _, h := range resp.GetHits() {\n\t\thits = append(hits, AlertHit{\n\t\t\tAlertID:         h.GetAlertId(),\n\t\t\tContainerID:     h.GetContainerId(),\n\t\t\tHostID:          h.GetHostId(),\n\t\t\tLogID:           h.GetLogId(),\n\t\t\tTs:              h.GetAnchorTsNs(),\n\t\t\tHeadline:        h.GetHeadline(),\n\t\t\tLevel:           h.GetLevel(),\n\t\t\tEventCount:      h.GetEventCount(),\n\t\t\tSuppressedCount: h.GetSuppressedCount(),\n\t\t\tContainerCount:  h.GetContainerCount(),\n\t\t\tSummary:         h.GetSummary(),\n\t\t\tInvestigation:   h.GetInvestigation(),\n\t\t\tTriageAction:    h.GetTriageAction(),","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/amir20/dozzle/blob/d9463cbe21874e44ab79db6fa63e746ca7d22928/internal/cloud/alerts.go#L100-L136","documentation":"GetAlerts calls the cloud gRPC service (ListAlerts-style request with time range, limit, and include flags) and wraps any RPC failure with 'cloud: alerts: %w'. The cloud backend is unreachable, rejected the request, or returned an error. The wrapper preserves the underlying gRPC status for inspection.","triggerScenarios":"Calling GetAlerts while the unary cloud connection fails: network outage, invalid API key returning PermissionDenied, server-side error, or context deadline exceeded during the RPC.","commonSituations":"Dozzle Cloud endpoint down or unreachable, expired/billing-deactivated API key, firewall blocking egress to the cloud service, timeouts on slow responses.","solutions":["Read the wrapped error with errors.Is/errors.As to check the gRPC status code","Verify network connectivity and DNS for the cloud endpoint","Confirm the cloud API key is valid and the account has an active pro plan (PermissionDenied stops retries)","Retry with backoff; the cloud client already reconnects with exponential backoff for transient failures"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"hits, err := client.GetAlerts(ctx, req)\nif err != nil {\n    if status.Code(err) == codes.PermissionDenied {\n        return nil, err // do not retry: invalid API key / no pro plan\n    }\n    return nil, fmt.Errorf(\"fetching alerts, will retry: %w\", err)\n}","preventionTips":["Check cloud endpoint health before heavy usage","Keep the API key valid and the pro plan active","Use context timeouts so failures surface quickly","Distinguish PermissionDenied (permanent) from transient codes before retrying"],"tags":["grpc","cloud","api","network","alerts"],"backgroundTag":"api-request-failed","analyzedSha":"d9463cbe21874e44ab79db6fa63e746ca7d22928","analyzedAt":"2026-09-07T10:08:55.855Z","contentChangedAt":"2026-09-07T10:08:55.855Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}