Skip to content

Commit 9e90fce

Browse files
xiang17cijothomas
andauthored
Enable self diagnostics module (#1573)
* Enable self diagnostics module * remove duplicate space Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
1 parent 502f751 commit 9e90fce

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

src/OpenTelemetry/README.md

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,16 @@ content:
100100
}
101101
```
102102

103-
`LogDirectory` is the directory of the output file. It can be an absolute path
104-
or a relative path to the current directory. `FileSize` is a positive integer,
103+
#### Configuration Parameters
104+
105+
1. `LogDirectory` is the directory of the output file. It can be an absolute
106+
path or a relative path to the current directory.
107+
108+
2. `FileSize` is a positive integer,
105109
which specifies the log file size in
106110
[KiB](https://en.wikipedia.org/wiki/Kibibyte).
107-
`LogLevel` is the lowest level of the events to be captured.
111+
112+
3. `LogLevel` is the lowest level of the events to be captured.
108113
It has to be one of the
109114
[values](https://docs.microsoft.com/dotnet/api/system.diagnostics.tracing.eventlevel#fields)
110115
of the [`EventLevel`
@@ -115,18 +120,23 @@ higher severity levels. For example, `Warning` includes the `Error` and
115120
[here](https://docs.microsoft.com/dotnet/api/system.diagnostics.tracing.eventlevel)
116121
for more.)
117122

123+
#### Remarks
124+
125+
A `FileSize`-KiB log file named as `ExecutableName.ProcessId.log` (e.g.
126+
`foobar.exe.12345.log`) will be generated at the specific directory
127+
`LogDirectory`.
128+
118129
The SDK will attempt to open the configuration file in non-exclusive read-only
119-
mode, read the file and parse it as the configuration file every 3 seconds. If
130+
mode, read the file and parse it as the configuration file every 10 seconds. If
120131
the SDK fails to parse the `LogDirectory`, `FileSize` or `LogLevel` fields as
121132
the specified format, the configuration file will be treated as invalid and no
122-
log file would be generated. Otherwise, it will create or overwrite a
123-
`FileSize`-KiB file at the specific directory `LogDirectory` with the log file
124-
named as `ExecutableName.ProcessId.log` (e.g. `foobar.exe.12345.log`).
133+
log file would be generated. Otherwise, it will create or overwrite the log
134+
file as described above.
125135

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

src/OpenTelemetry/Sdk.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
using System.Diagnostics;
1818
using OpenTelemetry.Context.Propagation;
19+
using OpenTelemetry.Internal;
1920
using OpenTelemetry.Metrics;
2021
using OpenTelemetry.Trace;
2122

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

3738
Activity.DefaultIdFormat = ActivityIdFormat.W3C;
3839
Activity.ForceDefaultIdFormat = true;
40+
SelfDiagnostics.EnsureInitialized();
3941
}
4042

4143
/// <summary>

0 commit comments

Comments
 (0)