Skip to content

Commit

Permalink
Wording change to the PersistentStorage README (open-telemetry#183)
Browse files Browse the repository at this point in the history
* reyang/wording

* update type names
  • Loading branch information
reyang authored Jan 25, 2022
1 parent 9b65689 commit 13ca8ec
Showing 1 changed file with 21 additions and 27 deletions.
48 changes: 21 additions & 27 deletions src/OpenTelemetry.Contrib.PersistentStorage/README.md
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit 13ca8ec

Please sign in to comment.