From 13ca8ec89ad224c38f45f1fc375dd5f078e16cdf Mon Sep 17 00:00:00 2001 From: Reiley Yang Date: Tue, 25 Jan 2022 13:49:52 -0800 Subject: [PATCH] Wording change to the PersistentStorage README (#183) * reyang/wording * update type names --- .../README.md | 48 ++++++++----------- 1 file changed, 21 insertions(+), 27 deletions(-) diff --git a/src/OpenTelemetry.Contrib.PersistentStorage/README.md b/src/OpenTelemetry.Contrib.PersistentStorage/README.md index f1ded0e6c3a..e6484fd8fcc 100644 --- a/src/OpenTelemetry.Contrib.PersistentStorage/README.md +++ b/src/OpenTelemetry.Contrib.PersistentStorage/README.md @@ -1,7 +1,9 @@ -# Persistent Storage for OpenTelemetry Exporters +# Persistent Storage Interface and Implementation -This package enables OpenTelemetry exporters to store telemetry offline in case -of transient failures. The data can be read at later time for retries. +This package provides both the interface and implementation of persistent +storage. It is an experimental component which can be used by OpenTelemetry +Exporters to provide reliable data delivery. Eventually this component should +get splitted into the abstract interface and concrete implementations. ## Installation @@ -12,32 +14,28 @@ TODO ### Setup Storage ```csharp -var testDir = new DirectoryInfo(Path.Combine( - Environment.GetFolderPath( - Environment.SpecialFolder.LocalApplicationData) - , "test")); -using var storage = new LocalFileStorage(testDir.FullName); +using var storage = new FileStorage("test"); ``` Following is the complete list of configurable options that can be used to set up storage: -`path`: Sets file storage folder location where blobs are stored. +* `path`: Sets file storage folder location where blobs are stored. -`maxSizeInBytes` : Maximum allowed storage folder size. Default is 50 MB. +* `maxSizeInBytes`: Maximum allowed storage folder size. Default is 50 MB. -`maintenancePeriodInMilliseconds`: Maintenance event runs at specified interval. -Default is 2 minutes. Maintenance event performs following 3 tasks: +* `maintenancePeriodInMilliseconds`: Maintenance event runs at specified interval. +Default is 2 minutes. Maintenance event performs the following tasks: -1. Removes `*.blob` files for which the retention period has expired. -2. Removes `*.tmp` files for which the write timeout period has expired. -3. Updates `*.lock` files to `*.blob` for which the lease period has expired. -4. Updates `directorySize`. + * Removes `*.blob` files for which the retention period has expired. + * Removes `*.tmp` files for which the write timeout period has expired. + * Updates `*.lock` files to `*.blob` for which the lease period has expired. + * Updates `directorySize`. -`retentionPeriodInMilliseconds` : Retention period in milliseconds for the blob. +* `retentionPeriodInMilliseconds`: Retention period in milliseconds for the blob. Default is 2 days. -`writeTimeoutInMilliseconds`: Controls the timeout when writing a buffer to +* `writeTimeoutInMilliseconds`: Controls the timeout when writing a buffer to blob. Default is 1 minute. ### CreateBlob @@ -66,7 +64,7 @@ IPersistentBlob blob1 = storage.GetBlob(); // List all blobs. foreach (var blobItem in storage.GetBlobs()) { - Console.WriteLine(((LocalFileBlob)blobItem).FullPath); + Console.WriteLine(((FileBlob)blobItem).FullPath); } ``` @@ -98,14 +96,10 @@ byte[] data = blob2.Read(); blob2.Delete(); ``` -## Sample +## Example -```c# -var testDir = new DirectoryInfo(Path.Combine( - Environment.GetFolderPath( - Environment.SpecialFolder.LocalApplicationData) - , "test")); -using var storage = new LocalFileStorage(testDir.FullName); +```csharp +using var storage = new FileStorage("test"); var data = Encoding.UTF8.GetBytes("Hello, World!"); @@ -115,7 +109,7 @@ IPersistentBlob blob1 = storage.CreateBlob(data); // List all blobs. foreach (var blobItem in storage.GetBlobs()) { - Console.WriteLine(((LocalFileBlob)blobItem).FullPath); + Console.WriteLine(((FileBlob)blobItem).FullPath); } // Get blob.