Skip to content

Commit

Permalink
log more info on autoops 503 errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ashokaditya committed Nov 29, 2024
1 parent a882b2c commit f8d303a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions x-pack/plugins/data_usage/server/services/autoops_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export class AutoOpsAPIService {
`${AUTO_OPS_AGENT_CREATION_PREFIX} with an error ${error} ${requestConfigDebugStatus}`,
errorMetadataWithRequestConfig
);
throw new Error(withRequestIdMessage(error.message));
throw new AutoOpsError(withRequestIdMessage(error.message));
}

const errorLogCodeCause = `${error.code} ${this.convertCauseErrorsToString(error)}`;
Expand Down Expand Up @@ -152,14 +152,16 @@ export class AutoOpsAPIService {
`${AUTO_OPS_AGENT_CREATION_PREFIX} while sending the request to the AutoOps API: ${errorLogCodeCause} ${requestConfigDebugStatus}`,
errorMetadataWithRequestConfig
);
throw new Error(withRequestIdMessage(`no response received from the AutoOps API`));
throw new AutoOpsError(withRequestIdMessage(`no response received from the AutoOps API`));
} else {
// Something happened in setting up the request that triggered an Error
this.logger.error(
`${AUTO_OPS_AGENT_CREATION_PREFIX} to be created ${errorLogCodeCause} ${requestConfigDebugStatus}`,
errorMetadataWithRequestConfig
);
throw new AutoOpsError(withRequestIdMessage(AGENT_CREATION_FAILED_ERROR));
throw new AutoOpsError(
withRequestIdMessage(`${AGENT_CREATION_FAILED_ERROR}, ${error.message}`)
);
}
}
);
Expand Down

0 comments on commit f8d303a

Please sign in to comment.