-
Notifications
You must be signed in to change notification settings - Fork 785
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Logs] Sync up logger provider build-up scenarios with tracer provider #3596
Merged
CodeBlanch
merged 7 commits into
open-telemetry:main
from
CodeBlanch:loggerprovider-dependencyinjection-2
Sep 7, 2022
+458
−165
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
20be765
Since up logger provider build-up scenarios with tracer provider.
CodeBlanch 520c72a
CHANGELOG update.
CodeBlanch 501a820
Merge branch 'main' into loggerprovider-dependencyinjection-2
CodeBlanch e9f67d0
Merge from main.
CodeBlanch c9ca21b
Merge branch 'loggerprovider-dependencyinjection-2' of https://github…
CodeBlanch 00d2096
Merge from main.
CodeBlanch da15761
Code review.
CodeBlanch File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
src/OpenTelemetry/Logs/BatchExportLogRecordProcessorOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// <copyright file="BatchExportLogRecordProcessorOptions.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; | ||
using OpenTelemetry.Internal; | ||
|
||
namespace OpenTelemetry.Logs | ||
{ | ||
/// <summary> | ||
/// Batch log processor options. OTEL_DOTNET_BLP_MAX_QUEUE_SIZE, | ||
/// OTEL_DOTNET_BLP_MAX_EXPORT_BATCH_SIZE, OTEL_DOTNET_BLP_EXPORT_TIMEOUT, | ||
/// OTEL_DOTNET_BLP_SCHEDULE_DELAY environment variables are parsed during | ||
/// object construction. | ||
/// </summary> | ||
/// <remarks> | ||
/// Notes: | ||
/// <list type="bullet"> | ||
/// <item>The constructor throws <see cref="FormatException"/> if it fails | ||
/// to parse any of the supported environment variables.</item> | ||
/// <item>The environment variable keys are currently experimental and | ||
/// subject to change. See: <see | ||
/// href="https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/sdk-environment-variables.md#opentelemetry-environment-variable-specification">OpenTelemetry | ||
/// Environment Variable Specification</see>. | ||
/// </item> | ||
/// </list> | ||
/// </remarks> | ||
public class BatchExportLogRecordProcessorOptions : BatchExportProcessorOptions<LogRecord> | ||
{ | ||
internal const string MaxQueueSizeEnvVarKey = "OTEL_DOTNET_BLP_MAX_QUEUE_SIZE"; | ||
|
||
internal const string MaxExportBatchSizeEnvVarKey = "OTEL_DOTNET_BLP_MAX_EXPORT_BATCH_SIZE"; | ||
|
||
internal const string ExporterTimeoutEnvVarKey = "OTEL_DOTNET_BLP_EXPORT_TIMEOUT"; | ||
|
||
internal const string ScheduledDelayEnvVarKey = "OTEL_DOTNET_BLP_SCHEDULE_DELAY"; | ||
|
||
public BatchExportLogRecordProcessorOptions() | ||
{ | ||
int value; | ||
|
||
if (EnvironmentVariableHelper.LoadNumeric(ExporterTimeoutEnvVarKey, out value)) | ||
{ | ||
this.ExporterTimeoutMilliseconds = value; | ||
} | ||
|
||
if (EnvironmentVariableHelper.LoadNumeric(MaxExportBatchSizeEnvVarKey, out value)) | ||
{ | ||
this.MaxExportBatchSize = value; | ||
} | ||
|
||
if (EnvironmentVariableHelper.LoadNumeric(MaxQueueSizeEnvVarKey, out value)) | ||
{ | ||
this.MaxQueueSize = value; | ||
} | ||
|
||
if (EnvironmentVariableHelper.LoadNumeric(ScheduledDelayEnvVarKey, out value)) | ||
{ | ||
this.ScheduledDelayMilliseconds = value; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// <copyright file="ExportLogRecordProcessorOptions.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> | ||
|
||
#nullable enable | ||
|
||
using OpenTelemetry.Internal; | ||
|
||
namespace OpenTelemetry.Logs; | ||
|
||
public class ExportLogRecordProcessorOptions | ||
{ | ||
private BatchExportLogRecordProcessorOptions? batchExportProcessorOptions; | ||
|
||
/// <summary> | ||
/// Gets or sets the export processor type to be used. The default value is <see cref="ExportProcessorType.Batch"/>. | ||
/// </summary> | ||
public ExportProcessorType ExportProcessorType { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the batch export options. Ignored unless <see cref="ExportProcessorType"/> is <see cref="ExportProcessorType.Batch"/>. | ||
/// </summary> | ||
public BatchExportLogRecordProcessorOptions BatchExportProcessorOptions | ||
{ | ||
get => this.batchExportProcessorOptions ??= new(); | ||
set | ||
{ | ||
Guard.ThrowIfNull(value); | ||
|
||
this.batchExportProcessorOptions = value; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume the spec will declare official environment variable names. You think we can be optimistic and remove
DOTNET
from these environment variable names and just go withOTEL_BLP_MAX_QUEUE_SIZE
for example?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh scratch that i just saw the previous resolved conversation..