Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OT Exporter retry when there are network issues #16087

Merged
merged 2 commits into from
Jan 12, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@

## 1.0.0b2 (Unreleased)

- Fix to only retry upon request error
([#15344](https://github.com/Azure/azure-sdk-for-python/pull/15344))

**Breaking Changes**
- Rename Azure Trace exporter class, only allow connection string configuration
([#15349](https://github.com/Azure/azure-sdk-for-python/pull/15349))

- OpenTelemetry Exporter use Resources API to retrieve cloud role props
([#15816](https://github.com/Azure/azure-sdk-for-python/pull/15816))
- OpenTelemetry Exporter use Resources API to retrieve cloud role props
([#15816](https://github.com/Azure/azure-sdk-for-python/pull/15816))

- Change span to envelope conversion to adhere to common schema and other languages
([#15344](https://github.com/Azure/azure-sdk-for-python/pull/15344))
- Change span to envelope conversion to adhere to common schema and other languages
([#15344](https://github.com/Azure/azure-sdk-for-python/pull/15344))

- This library is renamed to `azure-opentelemetry-exporter-azuremonitor`.
([#15344](https://github.com/Azure/azure-sdk-for-python/pull/15344))
- This library is renamed to `azure-opentelemetry-exporter-azuremonitor`.
([#16030](https://github.com/Azure/azure-sdk-for-python/pull/16030))

## 1.0.0b1 (2020-11-13)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from opentelemetry.sdk.trace.export import SpanExportResult

from azure.core.exceptions import HttpResponseError
from azure.core.exceptions import HttpResponseError, ServiceRequestError
from azure.core.pipeline.policies import ContentDecodePolicy, HttpLoggingPolicy, RequestIdPolicy
from azure.opentelemetry.exporter.azuremonitor._generated import AzureMonitorClient
from azure.opentelemetry.exporter.azuremonitor._generated._configuration import AzureMonitorClientConfiguration
Expand Down Expand Up @@ -132,12 +132,18 @@ def _transmit(self, envelopes: typing.List[TelemetryItem]) -> ExportResult:
if is_retryable_code(response_error.status_code):
return ExportResult.FAILED_RETRYABLE
return ExportResult.FAILED_NOT_RETRYABLE
except Exception as ex:
except ServiceRequestError as request_error:
# Errors when we're fairly sure that the server did not receive the
# request, so it should be safe to retry.
logger.warning(
"Retrying due to transient client side error %s.", ex
"Retrying due to server request error: %s.", request_error
)
# client side error (retryable)
return ExportResult.FAILED_RETRYABLE
except Exception as ex:
logger.error(
"Envelopes could not be exported and are not retriable: %s.", ex
)
return ExportResult.FAILED_NOT_RETRYABLE
return ExportResult.FAILED_NOT_RETRYABLE
# No spans to export
return ExportResult.SUCCESS
Expand All @@ -148,12 +154,13 @@ def is_retryable_code(response_code: int) -> bool:
Determine if response is retryable
"""
return bool(response_code in (
206, # Retriable
206, # Partial success
408, # Timeout
429, # Throttle, too Many Requests
439, # Quota, too Many Requests over extended time
500, # Internal Server Error
503, # Service Unavailable
504, # Gateway timeout
lzchen marked this conversation as resolved.
Show resolved Hide resolved
))


Expand Down