# Google.Cloud.Diagnostics.Common - Class RetryOptions (5.3.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [5.3.0 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.RetryOptions)
- [5.2.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/5.2.0/Google.Cloud.Diagnostics.Common.RetryOptions)
- [5.1.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/5.1.0/Google.Cloud.Diagnostics.Common.RetryOptions)
- [5.0.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/5.0.0/Google.Cloud.Diagnostics.Common.RetryOptions)
- [4.4.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/4.4.0/Google.Cloud.Diagnostics.Common.RetryOptions)
- [4.3.1](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/4.3.1/Google.Cloud.Diagnostics.Common.RetryOptions)

    public sealed class RetryOptions

Reference documentation and code samples for the Google.Cloud.Diagnostics.Common class RetryOptions.

Options that define retry logic for requests that failed.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> RetryOptions

## Inherited Members

[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Namespace

[Google.Cloud.Diagnostics.Common](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common)

## Assembly

Google.Cloud.Diagnostics.Common.dll

## Fields

### DefaultBufferSize

    public static readonly int DefaultBufferSize

The default buffer size in bytes. 2\^18 = 262144.

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.int32` |   |

### DefaultRetryAttempts

    public static readonly int DefaultRetryAttempts

The default number of retry attempts.

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.int32` |   |

### DefaultRetryInterval

    public static readonly TimeSpan DefaultRetryInterval

The default wait time between retries.

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.timespan` |   |

## Properties

### BufferOverflow

    public BufferOverflow BufferOverflow { get; }

How to handle a full buffer, only used for [Retry](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.RetryType#Google_Cloud_Diagnostics_Common_RetryType_Retry).

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.BufferOverflow` |   |

### BufferSizeBytes

    public int BufferSizeBytes { get; }

The size of the buffer in bytes, only used for [Retry](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.RetryType#Google_Cloud_Diagnostics_Common_RetryType_Retry).

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.int32` |   |

### ExceptionHandling

    public ExceptionHandling ExceptionHandling { get; }

How exceptions are handled.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.ExceptionHandling` |   |

### RetryAttempts

    public int RetryAttempts { get; }

The number of attempts to retry sending information, only used for [Retry](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.RetryType#Google_Cloud_Diagnostics_Common_RetryType_Retry).

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.int32` |   |

### RetryInterval

    public TimeSpan RetryInterval { get; }

The amount of time to wait between retries, only used for [Retry](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.RetryType#Google_Cloud_Diagnostics_Common_RetryType_Retry).

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.timespan` |   |

### RetryType

    public RetryType RetryType { get; }

The type of retry to make.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.RetryType` |   |

## Methods

### NoRetry(ExceptionHandling)

    public static RetryOptions NoRetry(ExceptionHandling exceptionHandling = ExceptionHandling.Ignore)

Creates a [RetryOptions](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.RetryOptions) for [None](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.RetryType#Google_Cloud_Diagnostics_Common_RetryType_None).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `exceptionHandling` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.ExceptionHandling` Optional, how exceptions should be handled. Defaults to [Ignore](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.ExceptionHandling#Google_Cloud_Diagnostics_Common_ExceptionHandling_Ignore). |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.RetryOptions` |   |

### Retry(ExceptionHandling, BufferOverflow, int?, TimeSpan?, int?)

    public static RetryOptions Retry(ExceptionHandling exceptionHandling = ExceptionHandling.Ignore, BufferOverflow bufferOverflow = BufferOverflow.IgnoreNewEntries, int? bufferSizeBytes = null, TimeSpan? retryInterval = null, int? retryAttempts = null)

Creates a [RetryOptions](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.RetryOptions) for [Retry](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.RetryType#Google_Cloud_Diagnostics_Common_RetryType_Retry).

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `exceptionHandling` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.ExceptionHandling` Optional, how exceptions should be handled. Defaults to [Ignore](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.ExceptionHandling#Google_Cloud_Diagnostics_Common_ExceptionHandling_Ignore). |
| `bufferOverflow` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.BufferOverflow` Optional, how a buffer overflow should be handled. Defaults to [IgnoreNewEntries](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.BufferOverflow#Google_Cloud_Diagnostics_Common_BufferOverflow_IgnoreNewEntries). |
| `bufferSizeBytes` | `https://learn.microsoft.com/dotnet/api/system.int32` Optional, the size of the buffer to be used in bytes. Defaults to [DefaultBufferSize](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.RetryOptions#Google_Cloud_Diagnostics_Common_RetryOptions_DefaultBufferSize). |
| `retryInterval` | `https://learn.microsoft.com/dotnet/api/system.timespan` Optional, the time between retries. Default to [DefaultRetryInterval](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.RetryOptions#Google_Cloud_Diagnostics_Common_RetryOptions_DefaultRetryInterval). |
| `retryAttempts` | `https://learn.microsoft.com/dotnet/api/system.int32` Optional, the number of retry attempts. Defaults to [DefaultRetryAttempts](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.RetryOptions#Google_Cloud_Diagnostics_Common_RetryOptions_DefaultRetryAttempts). |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.RetryOptions` |   |