Skip to content

Commit fa5588b

Browse files
authored
Merge pull request #140 from serilog/dev
3.0.0 Release
2 parents 948fa0f + 1cc3859 commit fa5588b

File tree

14 files changed

+46
-54
lines changed

14 files changed

+46
-54
lines changed

appveyor.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ version: '{build}'
22
skip_tags: true
33
image: Visual Studio 2022
44
build_script:
5-
- pwsh: ./Build.ps1
5+
- pwsh: |
6+
Invoke-WebRequest "https://dot.net/v1/dotnet-install.ps1" -OutFile "./dotnet-install.ps1"
7+
./dotnet-install.ps1 -JsonFile global.json -Architecture x64 -InstallDir 'C:\Program Files\dotnet'
8+
./Build.ps1
69
artifacts:
710
- path: artifacts/Serilog.*.nupkg
811
deploy:

example/Example/Example.csproj

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,11 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net6.0</TargetFramework>
5+
<TargetFramework>net8.0</TargetFramework>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
88
</PropertyGroup>
9-
10-
<ItemGroup>
11-
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="8.0.0" />
12-
</ItemGroup>
13-
9+
1410
<ItemGroup>
1511
<ProjectReference Include="..\..\src\Serilog.Sinks.OpenTelemetry\Serilog.Sinks.OpenTelemetry.csproj" />
1612
</ItemGroup>

example/Example/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ static Logger CreateLogger(OtlpProtocol protocol)
8989
["Authorization"] = "Basic dXNlcjphYmMxMjM=", // user:abc123
9090
};
9191
options.BatchingOptions.BatchSizeLimit = 700;
92-
options.BatchingOptions.Period = TimeSpan.FromSeconds(1);
92+
options.BatchingOptions.BufferingTimeLimit = TimeSpan.FromSeconds(1);
9393
options.BatchingOptions.QueueLimit = 10;
9494
})
9595
.CreateLogger();

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "8.0.100",
3+
"version": "8.0.204",
44
"allowPrerelease": false,
55
"rollForward": "latestFeature"
66
}

src/Serilog.Sinks.OpenTelemetry/OpenTelemetryLoggerConfigurationExtensions.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
using Serilog.Configuration;
1717
using Serilog.Sinks.OpenTelemetry;
1818
using Serilog.Sinks.OpenTelemetry.Exporters;
19-
using Serilog.Sinks.PeriodicBatching;
2019
using Serilog.Collections;
2120
using Serilog.Core;
2221
using Serilog.Events;
@@ -63,9 +62,7 @@ public static LoggerConfiguration OpenTelemetry(
6362
resourceAttributes: new Dictionary<string, object>(options.ResourceAttributes),
6463
includedData: options.IncludedData);
6564

66-
var sink = new PeriodicBatchingSink(openTelemetrySink, options.BatchingOptions);
67-
68-
return loggerSinkConfiguration.Sink(sink, options.RestrictedToMinimumLevel, options.LevelSwitch);
65+
return loggerSinkConfiguration.Sink(openTelemetrySink, options.BatchingOptions, options.RestrictedToMinimumLevel, options.LevelSwitch);
6966
}
7067

7168
/// <summary>

src/Serilog.Sinks.OpenTelemetry/Serilog.Sinks.OpenTelemetry.csproj

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@
22
<PropertyGroup>
33
<Description>This Serilog sink transforms Serilog events into OpenTelemetry
44
logs and sends them to an OTLP (gRPC or HTTP) endpoint.</Description>
5-
<VersionPrefix>2.0.0</VersionPrefix>
5+
<VersionPrefix>3.0.0</VersionPrefix>
66
<Authors>Serilog Contributors</Authors>
7-
<TargetFrameworks>net462;netstandard2.0;net6.0</TargetFrameworks>
7+
<!-- .NET Framework version targeting is frozen at these two TFMs. -->
8+
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT'">net471;net462</TargetFrameworks>
9+
<!-- Policy is to trim TFM-specific builds to `netstandard2.0`, `net6.0`,
10+
all active LTS versions, and optionally the latest RTM version, when releasing new
11+
major Serilog versions. -->
12+
<TargetFrameworks>$(TargetFrameworks);net8.0;net6.0;netstandard2.0</TargetFrameworks>
813
<PackageTags>serilog;sink;opentelemetry</PackageTags>
914
<PackageIcon>serilog-sink-nuget.png</PackageIcon>
1015
<PackageProjectUrl>https://github.com/serilog/serilog-sinks-opentelemetry</PackageProjectUrl>
@@ -14,22 +19,23 @@
1419
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1520
<RootNamespace>Serilog</RootNamespace>
1621
<PackageReadmeFile>README.md</PackageReadmeFile>
22+
<LangVersion>12</LangVersion>
23+
<NoWarn>CS8981</NoWarn>
1724
</PropertyGroup>
18-
25+
1926
<PropertyGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
2027
<DefineConstants>$(DefineConstants);FEATURE_CWT_ADDORUPDATE;FEATURE_ACTIVITY;FEATURE_HALF;FEATURE_DATE_AND_TIME_ONLY;FEATURE_SYNC_HTTP_SEND;FEATURE_SOCKETS_HTTP_HANDLER</DefineConstants>
2128
</PropertyGroup>
29+
30+
<PropertyGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
31+
<DefineConstants>$(DefineConstants);FEATURE_CWT_ADDORUPDATE;FEATURE_ACTIVITY;FEATURE_HALF;FEATURE_DATE_AND_TIME_ONLY;FEATURE_SYNC_HTTP_SEND;FEATURE_SOCKETS_HTTP_HANDLER</DefineConstants>
32+
</PropertyGroup>
2233

2334
<ItemGroup>
2435
<None Include="../../assets/serilog-sink-nuget.png" Pack="true" Visible="false" PackagePath="/" />
2536
<None Include="../../README.md" Pack="true" Visible="false" PackagePath="/" />
26-
<PackageReference Include="Google.Protobuf" Version="3.25.1" />
27-
<PackageReference Include="Grpc.Net.Client" Version="2.60.0" />
28-
<PackageReference Include="Serilog" Version="3.1.1" />
29-
<PackageReference Include="Serilog.Sinks.PeriodicBatching" Version="4.0.0-*" />
30-
</ItemGroup>
31-
32-
<ItemGroup Condition=" '$(TargetFramework)' == 'net462' OR '$(TargetFramework)' == 'netstandard2.0' ">
33-
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="8.0.0" />
37+
<PackageReference Include="Google.Protobuf" Version="3.26.1" />
38+
<PackageReference Include="Grpc.Net.Client" Version="2.62.0" />
39+
<PackageReference Include="Serilog" Version="4.0.0" />
3440
</ItemGroup>
3541
</Project>

src/Serilog.Sinks.OpenTelemetry/Sinks/OpenTelemetry/BatchedOpenTelemetrySinkOptions.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
using Serilog.Sinks.PeriodicBatching;
15+
using Serilog.Configuration;
1616

1717
namespace Serilog.Sinks.OpenTelemetry;
1818

@@ -21,16 +21,16 @@ namespace Serilog.Sinks.OpenTelemetry;
2121
/// </summary>
2222
public class BatchedOpenTelemetrySinkOptions : OpenTelemetrySinkOptions
2323
{
24-
const int DefaultBatchSizeLimit = 1000, DefaultPeriodSeconds = 2, DefaultQueueLimit = 100000;
24+
const int DefaultBatchSizeLimit = 1000, DefaultBufferingTimeLimitSeconds = 2, DefaultQueueLimit = 100000;
2525

2626
/// <summary>
2727
/// Options that control the sending of asynchronous log batches. When <c>null</c> a batch size of 1 is used.
2828
/// </summary>
29-
public PeriodicBatchingSinkOptions BatchingOptions { get; } = new()
29+
public BatchingOptions BatchingOptions { get; } = new()
3030
{
3131
EagerlyEmitFirstEvent = true,
3232
BatchSizeLimit = DefaultBatchSizeLimit,
33-
Period = TimeSpan.FromSeconds(DefaultPeriodSeconds),
33+
BufferingTimeLimit = TimeSpan.FromSeconds(DefaultBufferingTimeLimitSeconds),
3434
QueueLimit = DefaultQueueLimit
3535
};
36-
}
36+
}

src/Serilog.Sinks.OpenTelemetry/Sinks/OpenTelemetry/Formatting/CleanMessageTemplateFormatter.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#nullable enable
16-
1715
using Serilog.Events;
1816
using Serilog.Formatting.Json;
1917
using Serilog.Parsing;

src/Serilog.Sinks.OpenTelemetry/Sinks/OpenTelemetry/Formatting/Padding.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#nullable enable
16-
1715
using Serilog.Parsing;
1816

1917
namespace Serilog.Sinks.OpenTelemetry.Formatting

src/Serilog.Sinks.OpenTelemetry/Sinks/OpenTelemetry/OpenTelemetrySink.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 Serilog Contributors
1+
// Copyright © Serilog Contributors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -12,13 +12,11 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
using System.Net.Http;
1615
using OpenTelemetry.Proto.Collector.Logs.V1;
1716
using OpenTelemetry.Proto.Logs.V1;
1817
using Serilog.Core;
1918
using Serilog.Events;
2019
using Serilog.Sinks.OpenTelemetry.ProtocolHelpers;
21-
using Serilog.Sinks.PeriodicBatching;
2220

2321
namespace Serilog.Sinks.OpenTelemetry;
2422

@@ -59,7 +57,7 @@ public void Dispose()
5957
/// Transforms and sends the given batch of LogEvent objects
6058
/// to an OTLP endpoint.
6159
/// </summary>
62-
public Task EmitBatchAsync(IEnumerable<LogEvent> batch)
60+
public Task EmitBatchAsync(IReadOnlyCollection<LogEvent> batch)
6361
{
6462
var resourceLogs = _resourceLogsTemplate.Clone();
6563

0 commit comments

Comments
 (0)