[otlp log exporter] Move logs extension methods to main otlp package (#4556)
This commit is contained in:
parent
9431d05c2f
commit
5ca8e98f1f
|
|
@ -212,8 +212,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "customizing-the-sdk", "docs
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Tests.Stress", "test\OpenTelemetry.Tests.Stress\OpenTelemetry.Tests.Stress.csproj", "{2770158A-D220-414B-ABC6-179371323579}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Tests.Stress", "test\OpenTelemetry.Tests.Stress\OpenTelemetry.Tests.Stress.csproj", "{2770158A-D220-414B-ABC6-179371323579}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Exporter.OpenTelemetryProtocol.Logs", "src\OpenTelemetry.Exporter.OpenTelemetryProtocol.Logs\OpenTelemetry.Exporter.OpenTelemetryProtocol.Logs.csproj", "{6E1A5FA3-E024-4972-9EDC-11E36C5A0D6F}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "source-generation", "docs\logs\source-generation\source-generation.csproj", "{1F6CC903-04C9-4E7C-B388-C215C467BFB9}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "source-generation", "docs\logs\source-generation\source-generation.csproj", "{1F6CC903-04C9-4E7C-B388-C215C467BFB9}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "getting-started-prometheus-grafana", "docs\metrics\getting-started-prometheus-grafana\getting-started-prometheus-grafana.csproj", "{41B784AA-3301-4126-AF9F-1D59BD04B0BF}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "getting-started-prometheus-grafana", "docs\metrics\getting-started-prometheus-grafana\getting-started-prometheus-grafana.csproj", "{41B784AA-3301-4126-AF9F-1D59BD04B0BF}"
|
||||||
|
|
@ -456,10 +454,6 @@ Global
|
||||||
{2770158A-D220-414B-ABC6-179371323579}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{2770158A-D220-414B-ABC6-179371323579}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{2770158A-D220-414B-ABC6-179371323579}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{2770158A-D220-414B-ABC6-179371323579}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{2770158A-D220-414B-ABC6-179371323579}.Release|Any CPU.Build.0 = Release|Any CPU
|
{2770158A-D220-414B-ABC6-179371323579}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{6E1A5FA3-E024-4972-9EDC-11E36C5A0D6F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{6E1A5FA3-E024-4972-9EDC-11E36C5A0D6F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{6E1A5FA3-E024-4972-9EDC-11E36C5A0D6F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{6E1A5FA3-E024-4972-9EDC-11E36C5A0D6F}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{1F6CC903-04C9-4E7C-B388-C215C467BFB9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{1F6CC903-04C9-4E7C-B388-C215C467BFB9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{1F6CC903-04C9-4E7C-B388-C215C467BFB9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{1F6CC903-04C9-4E7C-B388-C215C467BFB9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{1F6CC903-04C9-4E7C-B388-C215C467BFB9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{1F6CC903-04C9-4E7C-B388-C215C467BFB9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@
|
||||||
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Extensions.Hosting\OpenTelemetry.Extensions.Hosting.csproj" />
|
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Extensions.Hosting\OpenTelemetry.Extensions.Hosting.csproj" />
|
||||||
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.Console\OpenTelemetry.Exporter.Console.csproj" />
|
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.Console\OpenTelemetry.Exporter.Console.csproj" />
|
||||||
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.OpenTelemetryProtocol\OpenTelemetry.Exporter.OpenTelemetryProtocol.csproj" />
|
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.OpenTelemetryProtocol\OpenTelemetry.Exporter.OpenTelemetryProtocol.csproj" />
|
||||||
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.OpenTelemetryProtocol.Logs\OpenTelemetry.Exporter.OpenTelemetryProtocol.Logs.csproj" />
|
|
||||||
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Instrumentation.AspNetCore\OpenTelemetry.Instrumentation.AspNetCore.csproj" />
|
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Instrumentation.AspNetCore\OpenTelemetry.Instrumentation.AspNetCore.csproj" />
|
||||||
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Instrumentation.Http\OpenTelemetry.Instrumentation.Http.csproj" />
|
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Instrumentation.Http\OpenTelemetry.Instrumentation.Http.csproj" />
|
||||||
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.Jaeger\OpenTelemetry.Exporter.Jaeger.csproj" />
|
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.Jaeger\OpenTelemetry.Exporter.Jaeger.csproj" />
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,5 @@
|
||||||
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.Jaeger\OpenTelemetry.Exporter.Jaeger.csproj" />
|
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.Jaeger\OpenTelemetry.Exporter.Jaeger.csproj" />
|
||||||
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.InMemory\OpenTelemetry.Exporter.InMemory.csproj" />
|
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.InMemory\OpenTelemetry.Exporter.InMemory.csproj" />
|
||||||
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.Prometheus.HttpListener\OpenTelemetry.Exporter.Prometheus.HttpListener.csproj" />
|
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.Prometheus.HttpListener\OpenTelemetry.Exporter.Prometheus.HttpListener.csproj" />
|
||||||
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.OpenTelemetryProtocol.Logs\OpenTelemetry.Exporter.OpenTelemetryProtocol.Logs.csproj" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
OpenTelemetry.Logs.OtlpLogExporterHelperExtensions
|
|
||||||
static OpenTelemetry.Logs.OtlpLogExporterHelperExtensions.AddOtlpExporter(this OpenTelemetry.Logs.OpenTelemetryLoggerOptions loggerOptions) -> OpenTelemetry.Logs.OpenTelemetryLoggerOptions
|
|
||||||
static OpenTelemetry.Logs.OtlpLogExporterHelperExtensions.AddOtlpExporter(this OpenTelemetry.Logs.OpenTelemetryLoggerOptions loggerOptions, System.Action<OpenTelemetry.Exporter.OtlpExporterOptions> configure) -> OpenTelemetry.Logs.OpenTelemetryLoggerOptions
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
OpenTelemetry.Logs.OtlpLogExporterHelperExtensions
|
|
||||||
static OpenTelemetry.Logs.OtlpLogExporterHelperExtensions.AddOtlpExporter(this OpenTelemetry.Logs.OpenTelemetryLoggerOptions loggerOptions) -> OpenTelemetry.Logs.OpenTelemetryLoggerOptions
|
|
||||||
static OpenTelemetry.Logs.OtlpLogExporterHelperExtensions.AddOtlpExporter(this OpenTelemetry.Logs.OpenTelemetryLoggerOptions loggerOptions, System.Action<OpenTelemetry.Exporter.OtlpExporterOptions> configure) -> OpenTelemetry.Logs.OpenTelemetryLoggerOptions
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
OpenTelemetry.Logs.OtlpLogExporterHelperExtensions
|
|
||||||
static OpenTelemetry.Logs.OtlpLogExporterHelperExtensions.AddOtlpExporter(this OpenTelemetry.Logs.OpenTelemetryLoggerOptions loggerOptions) -> OpenTelemetry.Logs.OpenTelemetryLoggerOptions
|
|
||||||
static OpenTelemetry.Logs.OtlpLogExporterHelperExtensions.AddOtlpExporter(this OpenTelemetry.Logs.OpenTelemetryLoggerOptions loggerOptions, System.Action<OpenTelemetry.Exporter.OtlpExporterOptions> configure) -> OpenTelemetry.Logs.OpenTelemetryLoggerOptions
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
// <copyright file="AssemblyInfo.cs" company="OpenTelemetry Authors">
|
|
||||||
// Copyright The OpenTelemetry Authors
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
// </copyright>
|
|
||||||
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
|
|
||||||
#if SIGNED
|
|
||||||
[assembly: InternalsVisibleTo("OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010051c1562a090fb0c9f391012a32198b5e5d9a60e9b80fa2d7b434c9e5ccb7259bd606e66f9660676afc6692b8cdc6793d190904551d2103b7b22fa636dcbb8208839785ba402ea08fc00c8f1500ccef28bbf599aa64ffb1e1d5dc1bf3420a3777badfe697856e9d52070a50c3ea5821c80bef17ca3acffa28f89dd413f096f898")]
|
|
||||||
[assembly: InternalsVisibleTo("Benchmarks, PublicKey=002400000480000094000000060200000024000052534131000400000100010051c1562a090fb0c9f391012a32198b5e5d9a60e9b80fa2d7b434c9e5ccb7259bd606e66f9660676afc6692b8cdc6793d190904551d2103b7b22fa636dcbb8208839785ba402ea08fc00c8f1500ccef28bbf599aa64ffb1e1d5dc1bf3420a3777badfe697856e9d52070a50c3ea5821c80bef17ca3acffa28f89dd413f096f898")]
|
|
||||||
|
|
||||||
// Used by Moq.
|
|
||||||
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")]
|
|
||||||
#else
|
|
||||||
[assembly: InternalsVisibleTo("OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests")]
|
|
||||||
[assembly: InternalsVisibleTo("Benchmarks")]
|
|
||||||
|
|
||||||
// Used by Moq.
|
|
||||||
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,109 +0,0 @@
|
||||||
# Changelog
|
|
||||||
|
|
||||||
## Unreleased
|
|
||||||
|
|
||||||
## 1.5.0-rc.1
|
|
||||||
|
|
||||||
Released 2023-May-25
|
|
||||||
|
|
||||||
* The `OpenTelemetryLoggerOptions.AddOtlpExporter` extension no longer
|
|
||||||
automatically sets `OpenTelemetryLoggerOptions.ParseStateValues` to `true`.
|
|
||||||
The OpenTelemetry SDK now automatically sets `Attributes` (aka `StateValues`)
|
|
||||||
for the common cases where `ParseStateValues` was previously required.
|
|
||||||
`ParseStateValues` can be set to `true` manually by users to enable parsing of
|
|
||||||
custom states which do not implement `IReadOnlyList` / `IEnumerable`
|
|
||||||
interfaces.
|
|
||||||
([#4334](https://github.com/open-telemetry/opentelemetry-dotnet/pull/4334))
|
|
||||||
|
|
||||||
* Updated to use the new `LogRecord.Attributes` field as `LogRecord.StateValues`
|
|
||||||
is now marked obsolete. There is no impact to transmitted data (`StateValues`
|
|
||||||
and `Attributes` are equivalent).
|
|
||||||
([#4334](https://github.com/open-telemetry/opentelemetry-dotnet/pull/4334))
|
|
||||||
|
|
||||||
* Fixed issue where the
|
|
||||||
[observed time](https://github.com/open-telemetry/opentelemetry-proto/blob/395c8422fe90080314c7d9b4114d701a0c049e1f/opentelemetry/proto/logs/v1/logs.proto#L138)
|
|
||||||
field of the OTLP log record was not set. It is now correctly set to equal
|
|
||||||
the
|
|
||||||
[time](https://github.com/open-telemetry/opentelemetry-proto/blob/395c8422fe90080314c7d9b4114d701a0c049e1f/opentelemetry/proto/logs/v1/logs.proto#L121)
|
|
||||||
field.
|
|
||||||
([#4444](https://github.com/open-telemetry/opentelemetry-dotnet/pull/4444))
|
|
||||||
|
|
||||||
## 1.5.0-alpha.2
|
|
||||||
|
|
||||||
Released 2023-Mar-31
|
|
||||||
|
|
||||||
## 1.5.0-alpha.1
|
|
||||||
|
|
||||||
Released 2023-Mar-07
|
|
||||||
|
|
||||||
## 1.4.0-rc.4
|
|
||||||
|
|
||||||
Released 2023-Feb-10
|
|
||||||
|
|
||||||
## 1.4.0-rc.3
|
|
||||||
|
|
||||||
Released 2023-Feb-01
|
|
||||||
|
|
||||||
## 1.4.0-rc.2
|
|
||||||
|
|
||||||
Released 2023-Jan-09
|
|
||||||
|
|
||||||
## 1.4.0-rc.1
|
|
||||||
|
|
||||||
Released 2022-Dec-12
|
|
||||||
|
|
||||||
## 1.4.0-beta.3
|
|
||||||
|
|
||||||
Released 2022-Nov-07
|
|
||||||
|
|
||||||
## 1.4.0-beta.2
|
|
||||||
|
|
||||||
Released 2022-Oct-17
|
|
||||||
|
|
||||||
## 1.4.0-beta.1
|
|
||||||
|
|
||||||
Released 2022-Sep-29
|
|
||||||
|
|
||||||
* `OtlpExporterOptions` can now be bound to `IConfiguation` and
|
|
||||||
`HttpClientFactory` may be used to manage the `HttpClient` instance used when
|
|
||||||
`HttpProtobuf` is configured
|
|
||||||
([#3640](https://github.com/open-telemetry/opentelemetry-dotnet/pull/3640))
|
|
||||||
|
|
||||||
## 1.4.0-alpha.2
|
|
||||||
|
|
||||||
Released 2022-Aug-18
|
|
||||||
|
|
||||||
## 1.4.0-alpha.1
|
|
||||||
|
|
||||||
Released 2022-Aug-02
|
|
||||||
|
|
||||||
## 1.3.0-rc.2
|
|
||||||
|
|
||||||
Released 2022-June-1
|
|
||||||
|
|
||||||
## 1.0.0-rc9.3
|
|
||||||
|
|
||||||
Released 2022-Apr-15
|
|
||||||
|
|
||||||
* Removes .NET Framework 4.6.1. The minimum .NET Framework
|
|
||||||
version supported is .NET 4.6.2. ([#3190](https://github.com/open-telemetry/opentelemetry-dotnet/issues/3190))
|
|
||||||
|
|
||||||
## 1.0.0-rc9.2
|
|
||||||
|
|
||||||
Released 2022-Apr-12
|
|
||||||
|
|
||||||
## 1.0.0-rc9.1
|
|
||||||
|
|
||||||
Released 2022-Mar-30
|
|
||||||
|
|
||||||
## 1.0.0-rc10 (broken. use 1.0.0-rc9.1 and newer)
|
|
||||||
|
|
||||||
Released 2022-Mar-04
|
|
||||||
|
|
||||||
## 1.0.0-rc9
|
|
||||||
|
|
||||||
Released 2022-Feb-02
|
|
||||||
|
|
||||||
## 1.0.0-rc8
|
|
||||||
|
|
||||||
Released 2021-Oct-08
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
<PropertyGroup>
|
|
||||||
<!-- OmniSharp/VS Code requires TargetFrameworks to be in descending order for IntelliSense and analysis. -->
|
|
||||||
<TargetFrameworks>netstandard2.1;netstandard2.0;net462</TargetFrameworks>
|
|
||||||
<Description>OpenTelemetry protocol exporter for OpenTelemetry .NET</Description>
|
|
||||||
<PackageTags>$(PackageTags);OTLP</PackageTags>
|
|
||||||
<MinVerTagPrefix>core-</MinVerTagPrefix>
|
|
||||||
|
|
||||||
<!-- this is temporary. will remove in future PR. -->
|
|
||||||
<Nullable>disable</Nullable>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<!--Do not run ApiCompat as this package has never released a stable version.
|
|
||||||
Remove this property once we have released a stable version.-->
|
|
||||||
<PropertyGroup>
|
|
||||||
<RunApiCompat>false</RunApiCompat>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry\OpenTelemetry.csproj" />
|
|
||||||
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.OpenTelemetryProtocol\OpenTelemetry.Exporter.OpenTelemetryProtocol.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
||||||
|
|
@ -1,82 +0,0 @@
|
||||||
// <copyright file="OtlpLogExporterHelperExtensions.cs" company="OpenTelemetry Authors">
|
|
||||||
// Copyright The OpenTelemetry Authors
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
// </copyright>
|
|
||||||
|
|
||||||
using System.Diagnostics;
|
|
||||||
using OpenTelemetry.Exporter;
|
|
||||||
|
|
||||||
namespace OpenTelemetry.Logs
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Extension methods to simplify registering of the OpenTelemetry Protocol (OTLP) exporter.
|
|
||||||
/// </summary>
|
|
||||||
public static class OtlpLogExporterHelperExtensions
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Adds OTLP Exporter as a configuration to the OpenTelemetry ILoggingBuilder.
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks><inheritdoc cref="AddOtlpExporter(OpenTelemetryLoggerOptions, Action{OtlpExporterOptions})" path="/remarks"/></remarks>
|
|
||||||
/// <param name="loggerOptions"><see cref="OpenTelemetryLoggerOptions"/> options to use.</param>
|
|
||||||
/// <returns>The instance of <see cref="OpenTelemetryLoggerOptions"/> to chain the calls.</returns>
|
|
||||||
public static OpenTelemetryLoggerOptions AddOtlpExporter(this OpenTelemetryLoggerOptions loggerOptions)
|
|
||||||
=> AddOtlpExporterInternal(loggerOptions, configure: null);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Adds OTLP Exporter as a configuration to the OpenTelemetry ILoggingBuilder.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="loggerOptions"><see cref="OpenTelemetryLoggerOptions"/> options to use.</param>
|
|
||||||
/// <param name="configure">Callback action for configuring <see cref="OtlpExporterOptions"/>.</param>
|
|
||||||
/// <returns>The instance of <see cref="OpenTelemetryLoggerOptions"/> to chain the calls.</returns>
|
|
||||||
public static OpenTelemetryLoggerOptions AddOtlpExporter(
|
|
||||||
this OpenTelemetryLoggerOptions loggerOptions,
|
|
||||||
Action<OtlpExporterOptions> configure)
|
|
||||||
=> AddOtlpExporterInternal(loggerOptions, configure);
|
|
||||||
|
|
||||||
private static OpenTelemetryLoggerOptions AddOtlpExporterInternal(
|
|
||||||
OpenTelemetryLoggerOptions loggerOptions,
|
|
||||||
Action<OtlpExporterOptions> configure)
|
|
||||||
{
|
|
||||||
var exporterOptions = new OtlpExporterOptions();
|
|
||||||
|
|
||||||
// TODO: We are using span/activity batch environment variable keys
|
|
||||||
// here when we should be using the ones for logs.
|
|
||||||
var defaultBatchOptions = exporterOptions.BatchExportProcessorOptions;
|
|
||||||
|
|
||||||
Debug.Assert(defaultBatchOptions != null, "defaultBatchOptions was null");
|
|
||||||
|
|
||||||
configure?.Invoke(exporterOptions);
|
|
||||||
|
|
||||||
var otlpExporter = new OtlpLogExporter(exporterOptions);
|
|
||||||
|
|
||||||
if (exporterOptions.ExportProcessorType == ExportProcessorType.Simple)
|
|
||||||
{
|
|
||||||
loggerOptions.AddProcessor(new SimpleLogRecordExportProcessor(otlpExporter));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var batchOptions = exporterOptions.BatchExportProcessorOptions ?? defaultBatchOptions;
|
|
||||||
|
|
||||||
loggerOptions.AddProcessor(new BatchLogRecordExportProcessor(
|
|
||||||
otlpExporter,
|
|
||||||
batchOptions.MaxQueueSize,
|
|
||||||
batchOptions.ScheduledDelayMilliseconds,
|
|
||||||
batchOptions.ExporterTimeoutMilliseconds,
|
|
||||||
batchOptions.MaxExportBatchSize));
|
|
||||||
}
|
|
||||||
|
|
||||||
return loggerOptions;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
# OTLP Logs Exporter for OpenTelemetry .NET
|
|
||||||
|
|
||||||
[](https://www.nuget.org/packages/OpenTelemetry.Exporter.OpenTelemetryProtocol.Logs)
|
|
||||||
[](https://www.nuget.org/packages/OpenTelemetry.Exporter.OpenTelemetryProtocol.Logs)
|
|
||||||
|
|
||||||
[The OTLP (OpenTelemetry Protocol) exporter](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md)
|
|
||||||
implementation for logs.
|
|
||||||
|
|
||||||
## Prerequisite
|
|
||||||
|
|
||||||
* [Get OpenTelemetry Collector](https://opentelemetry.io/docs/collector/)
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
OpenTelemetry.Logs.OtlpLogExporterHelperExtensions
|
||||||
|
static OpenTelemetry.Logs.OtlpLogExporterHelperExtensions.AddOtlpExporter(this OpenTelemetry.Logs.OpenTelemetryLoggerOptions loggerOptions) -> OpenTelemetry.Logs.OpenTelemetryLoggerOptions
|
||||||
|
static OpenTelemetry.Logs.OtlpLogExporterHelperExtensions.AddOtlpExporter(this OpenTelemetry.Logs.OpenTelemetryLoggerOptions loggerOptions, System.Action<OpenTelemetry.Exporter.OtlpExporterOptions> configure) -> OpenTelemetry.Logs.OpenTelemetryLoggerOptions
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
OpenTelemetry.Logs.OtlpLogExporterHelperExtensions
|
||||||
|
static OpenTelemetry.Logs.OtlpLogExporterHelperExtensions.AddOtlpExporter(this OpenTelemetry.Logs.OpenTelemetryLoggerOptions loggerOptions) -> OpenTelemetry.Logs.OpenTelemetryLoggerOptions
|
||||||
|
static OpenTelemetry.Logs.OtlpLogExporterHelperExtensions.AddOtlpExporter(this OpenTelemetry.Logs.OpenTelemetryLoggerOptions loggerOptions, System.Action<OpenTelemetry.Exporter.OtlpExporterOptions> configure) -> OpenTelemetry.Logs.OpenTelemetryLoggerOptions
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
OpenTelemetry.Logs.OtlpLogExporterHelperExtensions
|
||||||
|
static OpenTelemetry.Logs.OtlpLogExporterHelperExtensions.AddOtlpExporter(this OpenTelemetry.Logs.OpenTelemetryLoggerOptions loggerOptions) -> OpenTelemetry.Logs.OpenTelemetryLoggerOptions
|
||||||
|
static OpenTelemetry.Logs.OtlpLogExporterHelperExtensions.AddOtlpExporter(this OpenTelemetry.Logs.OpenTelemetryLoggerOptions loggerOptions, System.Action<OpenTelemetry.Exporter.OtlpExporterOptions> configure) -> OpenTelemetry.Logs.OpenTelemetryLoggerOptions
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
OpenTelemetry.Logs.OtlpLogExporterHelperExtensions
|
||||||
|
static OpenTelemetry.Logs.OtlpLogExporterHelperExtensions.AddOtlpExporter(this OpenTelemetry.Logs.OpenTelemetryLoggerOptions loggerOptions) -> OpenTelemetry.Logs.OpenTelemetryLoggerOptions
|
||||||
|
static OpenTelemetry.Logs.OtlpLogExporterHelperExtensions.AddOtlpExporter(this OpenTelemetry.Logs.OpenTelemetryLoggerOptions loggerOptions, System.Action<OpenTelemetry.Exporter.OtlpExporterOptions> configure) -> OpenTelemetry.Logs.OpenTelemetryLoggerOptions
|
||||||
|
|
@ -20,7 +20,6 @@ using System.Runtime.CompilerServices;
|
||||||
[assembly: InternalsVisibleTo("OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010051c1562a090fb0c9f391012a32198b5e5d9a60e9b80fa2d7b434c9e5ccb7259bd606e66f9660676afc6692b8cdc6793d190904551d2103b7b22fa636dcbb8208839785ba402ea08fc00c8f1500ccef28bbf599aa64ffb1e1d5dc1bf3420a3777badfe697856e9d52070a50c3ea5821c80bef17ca3acffa28f89dd413f096f898")]
|
[assembly: InternalsVisibleTo("OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010051c1562a090fb0c9f391012a32198b5e5d9a60e9b80fa2d7b434c9e5ccb7259bd606e66f9660676afc6692b8cdc6793d190904551d2103b7b22fa636dcbb8208839785ba402ea08fc00c8f1500ccef28bbf599aa64ffb1e1d5dc1bf3420a3777badfe697856e9d52070a50c3ea5821c80bef17ca3acffa28f89dd413f096f898")]
|
||||||
[assembly: InternalsVisibleTo("Benchmarks, PublicKey=002400000480000094000000060200000024000052534131000400000100010051c1562a090fb0c9f391012a32198b5e5d9a60e9b80fa2d7b434c9e5ccb7259bd606e66f9660676afc6692b8cdc6793d190904551d2103b7b22fa636dcbb8208839785ba402ea08fc00c8f1500ccef28bbf599aa64ffb1e1d5dc1bf3420a3777badfe697856e9d52070a50c3ea5821c80bef17ca3acffa28f89dd413f096f898")]
|
[assembly: InternalsVisibleTo("Benchmarks, PublicKey=002400000480000094000000060200000024000052534131000400000100010051c1562a090fb0c9f391012a32198b5e5d9a60e9b80fa2d7b434c9e5ccb7259bd606e66f9660676afc6692b8cdc6793d190904551d2103b7b22fa636dcbb8208839785ba402ea08fc00c8f1500ccef28bbf599aa64ffb1e1d5dc1bf3420a3777badfe697856e9d52070a50c3ea5821c80bef17ca3acffa28f89dd413f096f898")]
|
||||||
[assembly: InternalsVisibleTo("MockOpenTelemetryCollector, PublicKey=002400000480000094000000060200000024000052534131000400000100010051c1562a090fb0c9f391012a32198b5e5d9a60e9b80fa2d7b434c9e5ccb7259bd606e66f9660676afc6692b8cdc6793d190904551d2103b7b22fa636dcbb8208839785ba402ea08fc00c8f1500ccef28bbf599aa64ffb1e1d5dc1bf3420a3777badfe697856e9d52070a50c3ea5821c80bef17ca3acffa28f89dd413f096f898")]
|
[assembly: InternalsVisibleTo("MockOpenTelemetryCollector, PublicKey=002400000480000094000000060200000024000052534131000400000100010051c1562a090fb0c9f391012a32198b5e5d9a60e9b80fa2d7b434c9e5ccb7259bd606e66f9660676afc6692b8cdc6793d190904551d2103b7b22fa636dcbb8208839785ba402ea08fc00c8f1500ccef28bbf599aa64ffb1e1d5dc1bf3420a3777badfe697856e9d52070a50c3ea5821c80bef17ca3acffa28f89dd413f096f898")]
|
||||||
[assembly: InternalsVisibleTo("OpenTelemetry.Exporter.OpenTelemetryProtocol.Logs, PublicKey=002400000480000094000000060200000024000052534131000400000100010051c1562a090fb0c9f391012a32198b5e5d9a60e9b80fa2d7b434c9e5ccb7259bd606e66f9660676afc6692b8cdc6793d190904551d2103b7b22fa636dcbb8208839785ba402ea08fc00c8f1500ccef28bbf599aa64ffb1e1d5dc1bf3420a3777badfe697856e9d52070a50c3ea5821c80bef17ca3acffa28f89dd413f096f898")]
|
|
||||||
|
|
||||||
// Used by Moq.
|
// Used by Moq.
|
||||||
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")]
|
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")]
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,14 @@
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
* Merged `OpenTelemetry.Exporter.OpenTelemetryProtocol.Logs` package in to
|
||||||
|
`OpenTelemetry.Exporter.OpenTelemetryProtocol`. Going Forward,
|
||||||
|
`OpenTelemetry.Exporter.OpenTelemetryProtocol` will be the only package needed
|
||||||
|
for all 3 signals (Logs, Metrics and Traces). All the changes made in
|
||||||
|
[`OpenTelemetry.Exporter.OpenTelemetryProtocol.Logs`](https://github.com/open-telemetry/opentelemetry-dotnet/blob/core-1.5.0/src/OpenTelemetry.Exporter.OpenTelemetryProtocol.Logs/CHANGELOG.md#changelog)
|
||||||
|
are now included in this package.
|
||||||
|
([#4556](https://github.com/open-telemetry/opentelemetry-dotnet/pull/4556))
|
||||||
|
|
||||||
* Add back support for Exemplars. See [exemplars](../../docs/metrics/customizing-the-sdk/README.md#exemplars)
|
* Add back support for Exemplars. See [exemplars](../../docs/metrics/customizing-the-sdk/README.md#exemplars)
|
||||||
for instructions to enable exemplars.
|
for instructions to enable exemplars.
|
||||||
([#4553](https://github.com/open-telemetry/opentelemetry-dotnet/pull/4553))
|
([#4553](https://github.com/open-telemetry/opentelemetry-dotnet/pull/4553))
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,81 @@
|
||||||
|
// <copyright file="OtlpLogExporterHelperExtensions.cs" company="OpenTelemetry Authors">
|
||||||
|
// Copyright The OpenTelemetry Authors
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
// </copyright>
|
||||||
|
|
||||||
|
using System.Diagnostics;
|
||||||
|
using OpenTelemetry.Exporter;
|
||||||
|
|
||||||
|
namespace OpenTelemetry.Logs;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Extension methods to simplify registering of the OpenTelemetry Protocol (OTLP) exporter.
|
||||||
|
/// </summary>
|
||||||
|
public static class OtlpLogExporterHelperExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Adds OTLP Exporter as a configuration to the OpenTelemetry ILoggingBuilder.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks><inheritdoc cref="AddOtlpExporter(OpenTelemetryLoggerOptions, Action{OtlpExporterOptions})" path="/remarks"/></remarks>
|
||||||
|
/// <param name="loggerOptions"><see cref="OpenTelemetryLoggerOptions"/> options to use.</param>
|
||||||
|
/// <returns>The instance of <see cref="OpenTelemetryLoggerOptions"/> to chain the calls.</returns>
|
||||||
|
public static OpenTelemetryLoggerOptions AddOtlpExporter(this OpenTelemetryLoggerOptions loggerOptions)
|
||||||
|
=> AddOtlpExporterInternal(loggerOptions, configure: null);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds OTLP Exporter as a configuration to the OpenTelemetry ILoggingBuilder.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="loggerOptions"><see cref="OpenTelemetryLoggerOptions"/> options to use.</param>
|
||||||
|
/// <param name="configure">Callback action for configuring <see cref="OtlpExporterOptions"/>.</param>
|
||||||
|
/// <returns>The instance of <see cref="OpenTelemetryLoggerOptions"/> to chain the calls.</returns>
|
||||||
|
public static OpenTelemetryLoggerOptions AddOtlpExporter(
|
||||||
|
this OpenTelemetryLoggerOptions loggerOptions,
|
||||||
|
Action<OtlpExporterOptions> configure)
|
||||||
|
=> AddOtlpExporterInternal(loggerOptions, configure);
|
||||||
|
|
||||||
|
private static OpenTelemetryLoggerOptions AddOtlpExporterInternal(
|
||||||
|
OpenTelemetryLoggerOptions loggerOptions,
|
||||||
|
Action<OtlpExporterOptions> configure)
|
||||||
|
{
|
||||||
|
var exporterOptions = new OtlpExporterOptions();
|
||||||
|
|
||||||
|
// TODO: We are using span/activity batch environment variable keys
|
||||||
|
// here when we should be using the ones for logs.
|
||||||
|
var defaultBatchOptions = exporterOptions.BatchExportProcessorOptions;
|
||||||
|
|
||||||
|
Debug.Assert(defaultBatchOptions != null, "defaultBatchOptions was null");
|
||||||
|
|
||||||
|
configure?.Invoke(exporterOptions);
|
||||||
|
|
||||||
|
var otlpExporter = new OtlpLogExporter(exporterOptions);
|
||||||
|
|
||||||
|
if (exporterOptions.ExportProcessorType == ExportProcessorType.Simple)
|
||||||
|
{
|
||||||
|
loggerOptions.AddProcessor(new SimpleLogRecordExportProcessor(otlpExporter));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var batchOptions = exporterOptions.BatchExportProcessorOptions ?? defaultBatchOptions;
|
||||||
|
|
||||||
|
loggerOptions.AddProcessor(new BatchLogRecordExportProcessor(
|
||||||
|
otlpExporter,
|
||||||
|
batchOptions.MaxQueueSize,
|
||||||
|
batchOptions.ScheduledDelayMilliseconds,
|
||||||
|
batchOptions.ExporterTimeoutMilliseconds,
|
||||||
|
batchOptions.MaxExportBatchSize));
|
||||||
|
}
|
||||||
|
|
||||||
|
return loggerOptions;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -51,14 +51,7 @@ runnable example.
|
||||||
|
|
||||||
## Enable Log Exporter
|
## Enable Log Exporter
|
||||||
|
|
||||||
This package currently only supports exporting traces and metrics. Support for
|
// TODO
|
||||||
exporting logs is provided by installing the
|
|
||||||
[`OpenTelemetry.Exporter.OpenTelemetryProtocol.Logs`](../OpenTelemetry.Exporter.OpenTelemetryProtocol.Logs/README.md)
|
|
||||||
package.
|
|
||||||
|
|
||||||
Once the OTLP log exporter is stable, it'll be folded into this package. Check
|
|
||||||
[this](https://github.com/open-telemetry/opentelemetry-dotnet/milestone/35)
|
|
||||||
milestone for tracking.
|
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,6 @@
|
||||||
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.OpenTelemetryProtocol\OpenTelemetry.Exporter.OpenTelemetryProtocol.csproj" />
|
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.OpenTelemetryProtocol\OpenTelemetry.Exporter.OpenTelemetryProtocol.csproj" />
|
||||||
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Extensions.Hosting\OpenTelemetry.Extensions.Hosting.csproj" />
|
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Extensions.Hosting\OpenTelemetry.Extensions.Hosting.csproj" />
|
||||||
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.InMemory\OpenTelemetry.Exporter.InMemory.csproj" />
|
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.InMemory\OpenTelemetry.Exporter.InMemory.csproj" />
|
||||||
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.OpenTelemetryProtocol.Logs\OpenTelemetry.Exporter.OpenTelemetryProtocol.Logs.csproj" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue