Skip to content

Add transmission state manager with exponential back off#34926

Merged
vishweshbankwar merged 13 commits intomainfrom
vibankwa/update-transmit-from-storage-mechanism
Mar 16, 2023
Merged

Add transmission state manager with exponential back off#34926
vishweshbankwar merged 13 commits intomainfrom
vibankwa/update-transmit-from-storage-mechanism

Conversation

@vishweshbankwar
Copy link
Copy Markdown
Contributor

@vishweshbankwar vishweshbankwar commented Mar 14, 2023

This is the first PR towards refactoring the current mechanism for saving telemetry to storage and transmitting it back. The current implementation does not consider backing off exponentially in case of consecutive errors.

The current PR is adding TransmissionStateManager which will be used by the transmitter to decide whether it is ok to transmit to ingestion or directly save telemetry to storage. The usage will look like below.

if (_transmissionStateManager.State == TransmissionState.Closed)
{
    // Transmit telemetry to ingestion
    //  if the response code from ingestion falls under one of the retryable errors
    //  then save telemetry offline and call EnableBackOff to set the back off time for all transmissions
      _transmissionStateManager.EnableBackOff(response);
   
   // else for success code
       _transmissionStateManager.ResetConsecutiveErrors();
        _transmissionStateManager.CloseTransmission();
 

}
else
{
    // Save telemetry offline
}

The implementation is based on CircuitBreaker pattern with some modifications

@azure-sdk
Copy link
Copy Markdown
Collaborator

API change check

API changes are not detected in this pull request.

@vishweshbankwar vishweshbankwar marked this pull request as ready for review March 14, 2023 22:29
@vishweshbankwar vishweshbankwar changed the title Add Transmission state manager with exponential back off Add transmission state manager with exponential back off Mar 14, 2023
@TimothyMothra
Copy link
Copy Markdown

I would have more confidence if we had some unit tests for this.

@vishweshbankwar vishweshbankwar marked this pull request as draft March 15, 2023 00:06
@vishweshbankwar
Copy link
Copy Markdown
Contributor Author

Need to look in to an issue with consecutive errors. Will re-open after fixing that.

@vishweshbankwar vishweshbankwar marked this pull request as ready for review March 15, 2023 21:03
@vishweshbankwar vishweshbankwar added the Monitor - Exporter Monitor OpenTelemetry Exporter label Mar 16, 2023
Copy link
Copy Markdown
Member

@rajkumar-rangaraj rajkumar-rangaraj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Monitor - Exporter Monitor OpenTelemetry Exporter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants