Builds and configures OpenTelemetry resource instances with detectors and semantic attributes. Reuse when setting up telemetry and observability pipelines in .NET.
// Source: https://github.com/open-telemetry/opentelemetry-dotnet | License: Apache-2.0
// Provided via justclaw.it.com; keep this notice with the code.
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
using System.Diagnostics;
using OpenTelemetry.Internal;
namespace OpenTelemetry.Resources;
/// <summary>
/// Contains methods for building <see cref="Resource"/> instances.
/// </summary>
public class ResourceBuilder
{
internal readonly List<IResourceDetector> ResourceDetectors = [];
private static readonly Resource DefaultResource = PrepareDefaultResource();
private ResourceBuilder()
{
}
internal IServiceProvider? ServiceProvider { get; set; }
/// <summary>
/// Creates a <see cref="ResourceBuilder"/> instance with default at
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key