Skip to content

Commit d687d7e

Browse files
authored
Merge pull request #73 from serilog/dev
1.0.0 Release
2 parents 5518f90 + dffd9ad commit d687d7e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+7489
-3
lines changed

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Auto detect text files and perform LF normalization
2+
3+
* text=auto

.gitignore

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## Ignore Visual Studio temporary files, build results, and
22
## files generated by popular Visual Studio add-ons.
33
##
4-
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
4+
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
55

66
# User-specific files
77
*.rsuser
@@ -23,6 +23,7 @@ mono_crash.*
2323
[Rr]eleases/
2424
x64/
2525
x86/
26+
[Ww][Ii][Nn]32/
2627
[Aa][Rr][Mm]/
2728
[Aa][Rr][Mm]64/
2829
bld/
@@ -61,6 +62,9 @@ project.lock.json
6162
project.fragment.lock.json
6263
artifacts/
6364

65+
# ASP.NET Scaffolding
66+
ScaffoldingReadMe.txt
67+
6468
# StyleCop
6569
StyleCopReport.xml
6670

@@ -86,6 +90,7 @@ StyleCopReport.xml
8690
*.tmp_proj
8791
*_wpftmp.csproj
8892
*.log
93+
*.tlog
8994
*.vspscc
9095
*.vssscc
9196
.builds
@@ -137,6 +142,11 @@ _TeamCity*
137142
.axoCover/*
138143
!.axoCover/settings.json
139144

145+
# Coverlet is a free, cross platform Code Coverage Tool
146+
coverage*.json
147+
coverage*.xml
148+
coverage*.info
149+
140150
# Visual Studio code coverage results
141151
*.coverage
142152
*.coveragexml
@@ -284,6 +294,17 @@ node_modules/
284294
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
285295
*.vbw
286296

297+
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
298+
*.vbp
299+
300+
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
301+
*.dsw
302+
*.dsp
303+
304+
# Visual Studio 6 technical files
305+
*.ncb
306+
*.aps
307+
287308
# Visual Studio LightSwitch build output
288309
**/*.HTMLClient/GeneratedArtifacts
289310
**/*.DesktopClient/GeneratedArtifacts
@@ -340,6 +361,9 @@ ASALocalRun/
340361
# Local History for Visual Studio
341362
.localhistory/
342363

364+
# Visual Studio History (VSHistory) files
365+
.vshistory/
366+
343367
# BeatPulse healthcheck temp database
344368
healthchecksdb
345369

@@ -348,3 +372,28 @@ MigrationBackup/
348372

349373
# Ionide (cross platform F# VS Code tools) working folder
350374
.ionide/
375+
376+
# Fody - auto-generated XML schema
377+
FodyWeavers.xsd
378+
379+
# VS Code files for those working on multiple tools
380+
.vscode/*
381+
!.vscode/settings.json
382+
!.vscode/tasks.json
383+
!.vscode/launch.json
384+
!.vscode/extensions.json
385+
*.code-workspace
386+
387+
# Local History for Visual Studio Code
388+
.history/
389+
390+
# Windows Installer files from build outputs
391+
*.cab
392+
*.msi
393+
*.msix
394+
*.msm
395+
*.msp
396+
397+
# JetBrains Rider
398+
*.sln.iml
399+
/test/Serilog.Sinks.OpenTelemetry.Tests/PublicApiVisibilityTests.received.txt

.idea/.idea.serilog-sinks-opentelemetry/.idea/.gitignore

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/.idea.serilog-sinks-opentelemetry/.idea/encodings.xml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/.idea.serilog-sinks-opentelemetry/.idea/indexLayout.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/.idea.serilog-sinks-opentelemetry/.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.vscode/launch.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
// Use IntelliSense to find out which attributes exist for C# debugging
6+
// Use hover for the description of the existing attributes
7+
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
8+
"name": ".NET Core Launch (console)",
9+
"type": "coreclr",
10+
"request": "launch",
11+
"preLaunchTask": "build",
12+
// If you have changed target frameworks, make sure to update the program path.
13+
"program": "${workspaceFolder}/test/Serilog.Sinks.OpenTelemetry.Tests/bin/Debug/net6.0/Serilog.Sinks.OpenTelemetry.Tests.dll",
14+
"args": [],
15+
"cwd": "${workspaceFolder}/test/Serilog.Sinks.OpenTelemetry.Tests",
16+
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
17+
"console": "internalConsole",
18+
"stopAtEntry": false
19+
},
20+
{
21+
"name": ".NET Core Attach",
22+
"type": "coreclr",
23+
"request": "attach"
24+
}
25+
]
26+
}

.vscode/tasks.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "build",
6+
"command": "dotnet",
7+
"type": "process",
8+
"args": [
9+
"build",
10+
"${workspaceFolder}/test/Serilog.Sinks.OpenTelemetry.Tests/Serilog.Sinks.OpenTelemetry.Tests.csproj",
11+
"/property:GenerateFullPaths=true",
12+
"/consoleloggerparameters:NoSummary"
13+
],
14+
"problemMatcher": "$msCompile"
15+
},
16+
{
17+
"label": "publish",
18+
"command": "dotnet",
19+
"type": "process",
20+
"args": [
21+
"publish",
22+
"${workspaceFolder}/test/Serilog.Sinks.OpenTelemetry.Tests/Serilog.Sinks.OpenTelemetry.Tests.csproj",
23+
"/property:GenerateFullPaths=true",
24+
"/consoleloggerparameters:NoSummary"
25+
],
26+
"problemMatcher": "$msCompile"
27+
},
28+
{
29+
"label": "watch",
30+
"command": "dotnet",
31+
"type": "process",
32+
"args": [
33+
"watch",
34+
"run",
35+
"--project",
36+
"${workspaceFolder}/test/Serilog.Sinks.OpenTelemetry.Tests/Serilog.Sinks.OpenTelemetry.Tests.csproj"
37+
],
38+
"problemMatcher": "$msCompile"
39+
}
40+
]
41+
}

Build.ps1

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
Write-Output "build: Build started"
2+
3+
Push-Location $PSScriptRoot
4+
5+
if(Test-Path .\artifacts) {
6+
Write-Output "build: Cleaning ./artifacts"
7+
Remove-Item ./artifacts -Force -Recurse
8+
}
9+
10+
& dotnet restore --no-cache
11+
12+
$branch = @{ $true = $env:APPVEYOR_REPO_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$NULL -ne $env:APPVEYOR_REPO_BRANCH];
13+
$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:APPVEYOR_BUILD_NUMBER, 10); $false = "local" }[$NULL -ne $env:APPVEYOR_BUILD_NUMBER];
14+
$suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)))-$revision"}[$branch -eq "main" -and $revision -ne "local"]
15+
$commitHash = $(git rev-parse --short HEAD)
16+
$buildSuffix = @{ $true = "$($suffix)-$($commitHash)"; $false = "$($branch)-$($commitHash)" }[$suffix -ne ""]
17+
18+
Write-Output "build: Package version suffix is $suffix"
19+
Write-Output "build: Build version suffix is $buildSuffix"
20+
21+
foreach ($src in Get-ChildItem src/*) {
22+
Push-Location $src
23+
24+
Write-Output "build: Packaging project in $src"
25+
26+
& dotnet build -c Release --version-suffix=$buildSuffix
27+
if($LASTEXITCODE -ne 0) { throw "Failed" }
28+
29+
if($suffix) {
30+
& dotnet pack -c Release --include-source --no-build -o ../../artifacts --version-suffix=$suffix
31+
} else {
32+
& dotnet pack -c Release --include-source --no-build -o ../../artifacts
33+
}
34+
if($LASTEXITCODE -ne 0) { throw "Failed" }
35+
36+
Pop-Location
37+
}
38+
39+
foreach ($test in Get-ChildItem test/*.Tests) {
40+
Push-Location $test
41+
42+
Write-Output "build: Testing project in $test"
43+
44+
& dotnet test -c Release
45+
if($LASTEXITCODE -ne 0) { throw "Failed" }
46+
47+
Pop-Location
48+
}
49+
50+
foreach ($test in ls test/*.PerformanceTests) {
51+
Push-Location $test
52+
53+
Write-Output "build: Building performance test project in $test"
54+
55+
& dotnet build -c Release
56+
if($LASTEXITCODE -ne 0) { throw "Failed" }
57+
58+
Pop-Location
59+
}
60+
61+
Pop-Location

DEVELOPER.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Developer Guide
2+
3+
## Design Choices
4+
5+
### Direct Use of Proto Definitions
6+
7+
The OpenTelemetry logging sink will be used in environments that may
8+
have severe limitations on dependency package versions. The
9+
OpenTelemetry .NET SDK has a large number of dependencies (~50) that
10+
would make its use difficult in these environments.
11+
12+
Consequently, this sink imports the C# OpenTelemetry Proto bindings
13+
directly to minimize the dependencies. As the proto definitions
14+
evolve, this may require support for multiple versions of the sink.
15+
16+
### Direct Mapping of Properties
17+
18+
OpenTelemetry attributes allows full support for scalar values,
19+
arrays, and maps. Serilog does as well. Consequently, the sink does a
20+
one-to-one mapping between Serilog properties and OpenTelemetry
21+
attributes. There is no flattening, renaming, or other modifications
22+
done to the properies by default.
23+
24+
The configured formatter (or default) renders the log message. This
25+
message is written to the OpenTelemetry LogRecord body.
26+
27+
## OpenTelemetry Proto
28+
29+
The OpenTelemetry data structures are defined in the language-neutral
30+
protobuf format. To generate the language-specific bindings for C#,
31+
you must have `make` and `docker` installed.
32+
33+
With the necessary prerequisites available, you can then:
34+
35+
- Clone the
36+
[open-telemetry/opentelemetry-proto](https://github.com/open-telemetry/opentelemetry-proto)
37+
repository.
38+
39+
- Checkout the appropriate tag for the version of the OpenTelemetry
40+
Collector that you want to support.
41+
42+
- Run `make gen-csharp` from the root of the cloned repository.
43+
44+
- Copy the files in `gen/csharp` to the `src/Serilog.Sinks.OpenTelemetry/Sinks/OpenTelemetry/Proto`
45+
directory in this repository.
46+
47+
- The files for metrics and traces are not necessary and can be
48+
removed.
49+
50+
- Reduce the access to top-level classes and enums in the binding
51+
files from "public" to "internal" (implicit), to avoid these
52+
becoming part of the sink's public API.
53+
54+
Ensure that all unit tests pass before checking in the new code.
55+
56+
**Current OpenTelemetry proto binding files have been generated from
57+
tag v0.19.0.**
58+
59+
The OpenTelemetry proto version used in the OpenTelemetry Collector
60+
can be found in the [open-telemetry/opentelemetry-collector/Makefile](https://github.com/open-telemetry/opentelemetry-collector/blob/main/Makefile). Look for the `OPENTELEMETRY_PROTO_VERSION` variable
61+
definition.

0 commit comments

Comments
 (0)