Skip to content

Commit

Permalink
Log number of failed records and update logging documentation (awslab…
Browse files Browse the repository at this point in the history
…s#56)

* Log failed number of written records

* Fix typo in NewMissingHeaderError

* Document logged errors and add new errors

* Removing note for all errors are being logged as this functionality is planned to be deprecated.

Signed-off-by: forestmvey <[email protected]>

---------

Signed-off-by: forestmvey <[email protected]>
Co-authored-by: Trevor Bonas <[email protected]>
  • Loading branch information
forestmvey and trevorbonas committed May 7, 2024
1 parent 655cf47 commit f547341
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,8 @@ openssl x509 -req -sha256 -days 365 -in serverCertificateSigningRequest.csr -out
# Troubleshooting
## Prometheus Connector Specific Errors

All connector-specific errors can be found in [`errors/errors.go`](./errors/errors.go).

1. **Error**: `LongLabelNameError`

**Description**: The metric name exceeds the maximum supported length and the `fail-on-long-label` is set to `true`.
Expand Down Expand Up @@ -994,6 +996,22 @@ openssl x509 -req -sha256 -days 365 -in serverCertificateSigningRequest.csr -out

Check the request headers and add `x-prometheus-remote-read-version` or `x-prometheus-remote-write-version` to the request headers. This error returns a 400 Bad Request status code to the caller.

12. **Error**: `ParseRetriesError`

**Description**: This error will occur when the `max-retries` option has an invalid value.

**Solution**

See the [Retry Configuration Options](#retry-configuration-options) section for acceptable formats for the `max-retries` option.

13. **Error**: `UnknownMatcherError`

**Description**: This error will occur when an unknown matcher is within a PromQL query. Prometheus only supports four types of matchers within a filter: `=`, `!=`, `=~`, and `!~`.

**Solution**

Re-evaluate your PromQL query and ensure you are using only the above matchers.

## Write API Errors

| Errors | Status Code | Description | Solution |
Expand Down
2 changes: 1 addition & 1 deletion errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func NewMissingHeaderError(readHeader, writeHeader string) error {
return &MissingHeaderError{baseConnectorError: baseConnectorError{
statusCode: http.StatusBadRequest,
errorMsg: fmt.Sprintf("No appropriate header found in the request. Please ensure the request header contains either %s or %s.", readHeader, writeHeader),
message: fmt.Sprintf("The request must contains either %s or %s in the header.", readHeader, writeHeader),
message: fmt.Sprintf("The request must contain either %s or %s in the header.", readHeader, writeHeader),
}}
}

Expand Down
2 changes: 1 addition & 1 deletion timestream/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ func (qc *QueryClient) Read(req *prompb.ReadRequest, credentials *credentials.Cr
func (wc *WriteClient) handleSDKErr(req *prompb.WriteRequest, currErr error, errToReturn error) error {
requestError, ok := currErr.(awserr.RequestFailure)
if !ok {
LogError(wc.logger, "Error occurred while ingesting Timestream Records.", currErr)
LogError(wc.logger, fmt.Sprintf("Error occurred while ingesting Timestream Records. %d records failed to be written", len(req.Timeseries)), currErr)
return errors.NewSDKNonRequestError(currErr)
}

Expand Down

0 comments on commit f547341

Please sign in to comment.