Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
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
6 changes: 6 additions & 0 deletions src/OpenTelemetry.Api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## Unreleased

* Added internal `InstrumentationScope`, `LoggerProvider`, `Logger`,
`LoggerProviderBuilder`, `LogRecordSeverity`, and
`IDeferredLoggerProviderBuilder` types and moved `LogRecordData` and
`LogRecordAttributeList` types from SDK.
([#4422](https://github.com/open-telemetry/opentelemetry-dotnet/pull/4422))

## 1.5.0-alpha.2

Released 2023-Mar-31
Expand Down
65 changes: 65 additions & 0 deletions src/OpenTelemetry.Api/InstrumentationScope.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// <copyright file="InstrumentationScope.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

namespace OpenTelemetry;

/// <summary>
/// Contains details about the library emitting telemetry.
/// </summary>
internal sealed class InstrumentationScope
{
/// <summary>
/// Initializes a new instance of the <see cref="InstrumentationScope"/> class.
/// </summary>
public InstrumentationScope()
: this(name: null)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="InstrumentationScope"/> class.
/// </summary>
/// <param name="name">Optional name identifying the instrumentation library.</param>
public InstrumentationScope(string? name)
{
this.Name = string.IsNullOrWhiteSpace(name)
? string.Empty
: name!;
}

/// <summary>
/// Gets the name identifying the instrumentation library.
/// </summary>
public string Name { get; }

/// <summary>
/// Gets the version of the instrumentation library.
/// </summary>
public string? Version { get; init; }

/// <summary>
/// Gets the schema url of the instrumentation library.
/// </summary>
public string? SchemaUrl { get; init; }

/// <summary>
/// Gets the attributes which should be associated with log records created
/// by the instrumentation library.
/// </summary>
public IReadOnlyDictionary<string, object>? Attributes { get; init; }
}
36 changes: 36 additions & 0 deletions src/OpenTelemetry.Api/Logs/IDeferredLoggerProviderBuilder.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// <copyright file="IDeferredLoggerProviderBuilder.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

namespace OpenTelemetry.Logs;

/// <summary>
/// Describes a logger provider builder that supports deferred
/// initialization using an <see cref="IServiceProvider"/> to perform
/// dependency injection.
/// </summary>
internal interface IDeferredLoggerProviderBuilder
{
/// <summary>
/// Register a callback action to configure the <see
/// cref="LoggerProviderBuilder"/> once the application <see
/// cref="IServiceProvider"/> is available.
/// </summary>
/// <param name="configure">Configuration callback.</param>
/// <returns>The supplied <see cref="LoggerProviderBuilder"/> for chaining.</returns>
LoggerProviderBuilder Configure(Action<IServiceProvider, LoggerProviderBuilder> configure);
}
Loading