Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
stage
  • Loading branch information
Mpdreamz committed Mar 5, 2024
commit 9a3adb467badc8c1de2e23f8ae87f065566e7297
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,15 @@ internal sealed partial class LoggingEventListener : EventListener, IAsyncDispos
private readonly ILogger _logger;
private readonly EventLevel _eventLevel = EventLevel.Informational;

[GeneratedRegex("^\\d{2}-[a-f0-9]{32}-[a-f0-9]{16}-\\d{2}$")]
private const string TraceParentRe = "^\\d{2}-[a-f0-9]{32}-[a-f0-9]{16}-\\d{2}$";
#if NETSTANDARD2_1_OR_GREATER || NET6_0_OR_GREATER
[GeneratedRegex(TraceParentRe)]
private static partial Regex TraceParentRegex();
#else

private static Regex _traceParentRegex = new Regex(TraceParentRe);
private static Regex TraceParentRegex() => _traceParentRegex;
#endif

public LoggingEventListener(ILogger logger)
{
Expand Down
28 changes: 16 additions & 12 deletions src/Elastic.OpenTelemetry/Elastic.OpenTelemetry.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,30 @@

<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFrameworks>netstandard2.0;net8.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>True</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="OpenTelemetry" Version="1.7.0" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.7.0" />

<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.7.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.7.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.GrpcNetClient" Version="1.6.0-beta.3" />
<PackageReference Include="OpenTelemetry.Instrumentation.EntityFrameworkCore" Version="1.0.0-beta.9" />
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.7.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.Process" Version="0.5.0-beta.4" />
<PackageReference Include="OpenTelemetry" Version="1.7.0"/>
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.7.0"/>

<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.7.0"/>
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.7.0"/>
<PackageReference Include="OpenTelemetry.Instrumentation.GrpcNetClient" Version="1.6.0-beta.3"/>
<PackageReference Include="OpenTelemetry.Instrumentation.EntityFrameworkCore" Version="1.0.0-beta.9"/>
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.7.0"/>
<PackageReference Include="OpenTelemetry.Instrumentation.Process" Version="0.5.0-beta.4"/>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)'=='netstandard2.0'">
<PackageReference Include="System.Threading.Channels" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
<InternalsVisibleTo Include="Elastic.OpenTelemetry.Tests" Key="$(ExposedPublicKey)" />
<InternalsVisibleTo Include="Elastic.OpenTelemetry.Tests" Key="$(ExposedPublicKey)"/>
</ItemGroup>

</Project>
23 changes: 23 additions & 0 deletions src/Elastic.OpenTelemetry/Extensions/IsExternalInit.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information

#if NETSTANDARD2_0
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;

// ReSharper disable once CheckNamespace
namespace System.Runtime.CompilerServices
{
/// <summary>
/// Reserved to be used by the compiler for tracking metadata.
/// This class should not be used by developers in source code.
/// </summary>
/// <remarks>
/// This definition is provided by the <i>IsExternalInit</i> NuGet package (https://www.nuget.org/packages/IsExternalInit).
/// Please see https://github.com/manuelroemer/IsExternalInit for more information.
/// </remarks>
[ExcludeFromCodeCoverage, DebuggerNonUserCode]
internal static class IsExternalInit;
}
#endif