Skip to content

Commit

Permalink
Enable self diagnostics module (#1573)
Browse files Browse the repository at this point in the history
* Enable self diagnostics module

* remove duplicate space

Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
  • Loading branch information
xiang17 and cijothomas authored Nov 18, 2020
1 parent 502f751 commit 9e90fce
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
28 changes: 19 additions & 9 deletions src/OpenTelemetry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,16 @@ content:
}
```

`LogDirectory` is the directory of the output file. It can be an absolute path
or a relative path to the current directory. `FileSize` is a positive integer,
#### Configuration Parameters

1. `LogDirectory` is the directory of the output file. It can be an absolute
path or a relative path to the current directory.

2. `FileSize` is a positive integer,
which specifies the log file size in
[KiB](https://en.wikipedia.org/wiki/Kibibyte).
`LogLevel` is the lowest level of the events to be captured.

3. `LogLevel` is the lowest level of the events to be captured.
It has to be one of the
[values](https://docs.microsoft.com/dotnet/api/system.diagnostics.tracing.eventlevel#fields)
of the [`EventLevel`
Expand All @@ -115,18 +120,23 @@ higher severity levels. For example, `Warning` includes the `Error` and
[here](https://docs.microsoft.com/dotnet/api/system.diagnostics.tracing.eventlevel)
for more.)

#### Remarks

A `FileSize`-KiB log file named as `ExecutableName.ProcessId.log` (e.g.
`foobar.exe.12345.log`) will be generated at the specific directory
`LogDirectory`.

The SDK will attempt to open the configuration file in non-exclusive read-only
mode, read the file and parse it as the configuration file every 3 seconds. If
mode, read the file and parse it as the configuration file every 10 seconds. If
the SDK fails to parse the `LogDirectory`, `FileSize` or `LogLevel` fields as
the specified format, the configuration file will be treated as invalid and no
log file would be generated. Otherwise, it will create or overwrite a
`FileSize`-KiB file at the specific directory `LogDirectory` with the log file
named as `ExecutableName.ProcessId.log` (e.g. `foobar.exe.12345.log`).
log file would be generated. Otherwise, it will create or overwrite the log
file as described above.

Note that the `FileSize` has to be between 1 MiB and 128 MiB (inclusive), or it
will be rounded to the closest upper or lower limit. When the `LogDirectory` or
will be rounded to the closest upper or lower limit. When the `LogDirectory` or
`FileSize` is found to be changed, the SDK will create or overwrite a file with
new logs according to the new configuration. The configuration file has to be
new logs according to the new configuration. The configuration file has to be
no more than 4 KiB. In case the file is larger than 4 KiB, only the first 4 KiB
of content will be read.

Expand Down
2 changes: 2 additions & 0 deletions src/OpenTelemetry/Sdk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

using System.Diagnostics;
using OpenTelemetry.Context.Propagation;
using OpenTelemetry.Internal;
using OpenTelemetry.Metrics;
using OpenTelemetry.Trace;

Expand All @@ -36,6 +37,7 @@ static Sdk()

Activity.DefaultIdFormat = ActivityIdFormat.W3C;
Activity.ForceDefaultIdFormat = true;
SelfDiagnostics.EnsureInitialized();
}

/// <summary>
Expand Down

0 comments on commit 9e90fce

Please sign in to comment.