你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

添加、修改和筛选 OpenTelemetry

本文提供有关如何使用 Azure Monitor Application Insights 为应用程序添加、修改和筛选 OpenTelemetry 的指导。

若要详细了解 OpenTelemetry 概念,请参阅 OpenTelemetry 概述OpenTelemetry 常见问题解答

自动数据收集

发行版通过捆绑 OpenTelemetry 检测库来自动收集数据。

包含的检测库

请求

依赖项

Logging

  • ILogger

有关 ILogger 的详细信息,请参阅 C# 和 .NET 中的日志记录代码示例

脚注

  • ¹:支持未经处理的/未捕获的异常的自动报告
  • ²:支持 OpenTelemetry 指标
  • ³:默认情况下,日志记录仅在 INFO 级别或更高级别收集。 若要更改此设置,请参阅配置选项
  • ⁴:默认情况下,仅当在 WARNING 级别或更高级别执行日志记录时,才会收集日志记录。

注意

Azure Monitor OpenTelemetry 发行版包括自定义映射和逻辑,用于自动发出 Application Insights 标准指标

提示

无论是从检测库自动收集还是从自定义编码中手动收集,所有 OpenTelemetry 指标当前都被视为 Application Insights“自定义指标”,以便计费。 了解详细信息

添加社区检测库

从 OpenTelemetry 社区包含检测库时,可以自动收集更多数据。

注意

我们不支持也不保证社区检测库的质量。 要为我们的分发版推荐一个检测库,请在反馈社区中发帖或投票。 请注意,某些检测库基于实验性 OpenTelemetry 规范,可能会在将来引入中断性变更。

若要添加社区库,请在为库添加 nuget 包后使用 ConfigureOpenTelemetryMeterProviderConfigureOpenTelemetryTracerProvider 方法。

以下示例演示如何添加运行时检测以收集额外指标。

dotnet add package OpenTelemetry.Instrumentation.Runtime 
// Create a new ASP.NET Core web application builder.
var builder = WebApplication.CreateBuilder(args);

// Configure the OpenTelemetry meter provider to add runtime instrumentation.
builder.Services.ConfigureOpenTelemetryMeterProvider((sp, builder) => builder.AddRuntimeInstrumentation());

// Add the Azure Monitor telemetry service to the application.
// This service will collect and send telemetry data to Azure Monitor.
builder.Services.AddOpenTelemetry().UseAzureMonitor();

// Build the ASP.NET Core web application.
var app = builder.Build();

// Start the ASP.NET Core web application.
app.Run();

收集自定义遥测数据

本部分介绍如何从应用程序收集自定义遥测数据。

根据语言和信号类型,可以通过不同的方式收集自定义遥测数据,包括:

  • OpenTelemetry API
  • 特定于语言的日志记录/指标库
  • Application Insights Classic API

下表显示了目前支持的自定义遥测类型:

语言 自定义事件 自定义指标 依赖项 异常 页面视图 请求 跟踪
ASP.NET Core
   OpenTelemetry API
   ILogger API
   AI Classic API
Java
   OpenTelemetry API
   Logback,Log4j,JUL
   Micrometer 指标
   AI Classic API
Node.js
   OpenTelemetry API
Python
   OpenTelemetry API
   Python 日志记录模块
   事件扩展

注意

Application Insights Java 3.x 会侦听发送到 Application Insights Classic API 的遥测数据。 类似地,Application Insights Node.js 3.x 会收集使用 Application Insights Classic API 创建的事件。 在所有自定义遥测类型都通过 OpenTelemetry API 得到支持之前,这可以简化升级,并填补自定义遥测支持中的空白。

添加自定义指标

在此上下文中,自定义指标是指在 OpenTelemetry Instrumentation 库自动收集的指标以外,手动检测代码以收集额外指标。

OpenTelemetry API 提供六种指标“检测”来涵盖各种指标方案,在指标资源管理器中可视化指标时,需要选取正确的“聚合类型”。 使用 OpenTelemetry 指标 API 发送指标和使用检测库时,此要求是正确的。

下表显示了每个 OpenTelemetry 指标检测的建议聚合类型

OpenTelemetry 检测 Azure Monitor 聚合类型
计数器 Sum
异步计数器 Sum
直方图 Min、Max、Average、Sum 和 Count
异步仪表 平均值
UpDownCounter Sum
异步 UpDownCounter Sum

注意

表中显示类型以外的聚合类型通常没有意义。

OpenTelemetry 规范介绍了这些检测,并提供了何时可以使用每种检测的示例。

提示

直方图是最通用的,也与 Application Insights GetMetric Classic API 最接近。 Azure Monitor 目前将直方图检测合并到五种受支持的聚合类型中,并且正在研发对百分位数的支持。 其他 OpenTelemetry 检测虽然通用性较差,但是对应用程序性能的影响较小。

直方图示例

应用程序启动必须按名称订阅计量。

// Create a new ASP.NET Core web application builder.
var builder = WebApplication.CreateBuilder(args);

// Configure the OpenTelemetry meter provider to add a meter named "OTel.AzureMonitor.Demo".
builder.Services.ConfigureOpenTelemetryMeterProvider((sp, builder) => builder.AddMeter("OTel.AzureMonitor.Demo"));

// Add the Azure Monitor telemetry service to the application.
// This service will collect and send telemetry data to Azure Monitor.
builder.Services.AddOpenTelemetry().UseAzureMonitor();

// Build the ASP.NET Core web application.
var app = builder.Build();

// Start the ASP.NET Core web application.
app.Run();

Meter 必须使用同一名称初始化。

// Create a new meter named "OTel.AzureMonitor.Demo".
var meter = new Meter("OTel.AzureMonitor.Demo");

// Create a new histogram metric named "FruitSalePrice".
Histogram<long> myFruitSalePrice = meter.CreateHistogram<long>("FruitSalePrice");

// Create a new Random object.
var rand = new Random();

// Record a few random sale prices for apples and lemons, with different colors.
myFruitSalePrice.Record(rand.Next(1, 1000), new("name", "apple"), new("color", "red"));
myFruitSalePrice.Record(rand.Next(1, 1000), new("name", "lemon"), new("color", "yellow"));
myFruitSalePrice.Record(rand.Next(1, 1000), new("name", "lemon"), new("color", "yellow"));
myFruitSalePrice.Record(rand.Next(1, 1000), new("name", "apple"), new("color", "green"));
myFruitSalePrice.Record(rand.Next(1, 1000), new("name", "apple"), new("color", "red"));
myFruitSalePrice.Record(rand.Next(1, 1000), new("name", "lemon"), new("color", "yellow"));

计数器示例

应用程序启动必须按名称订阅计量。

// Create a new ASP.NET Core web application builder.
var builder = WebApplication.CreateBuilder(args);

// Configure the OpenTelemetry meter provider to add a meter named "OTel.AzureMonitor.Demo".
builder.Services.ConfigureOpenTelemetryMeterProvider((sp, builder) => builder.AddMeter("OTel.AzureMonitor.Demo"));

// Add the Azure Monitor telemetry service to the application.
// This service will collect and send telemetry data to Azure Monitor.
builder.Services.AddOpenTelemetry().UseAzureMonitor();

// Build the ASP.NET Core web application.
var app = builder.Build();

// Start the ASP.NET Core web application.
app.Run();

Meter 必须使用同一名称初始化。

// Create a new meter named "OTel.AzureMonitor.Demo".
var meter = new Meter("OTel.AzureMonitor.Demo");

// Create a new counter metric named "MyFruitCounter".
Counter<long> myFruitCounter = meter.CreateCounter<long>("MyFruitCounter");

// Record the number of fruits sold, grouped by name and color.
myFruitCounter.Add(1, new("name", "apple"), new("color", "red"));
myFruitCounter.Add(2, new("name", "lemon"), new("color", "yellow"));
myFruitCounter.Add(1, new("name", "lemon"), new("color", "yellow"));
myFruitCounter.Add(2, new("name", "apple"), new("color", "green"));
myFruitCounter.Add(5, new("name", "apple"), new("color", "red"));
myFruitCounter.Add(4, new("name", "lemon"), new("color", "yellow"));

仪表示例

应用程序启动必须按名称订阅计量。

// Create a new ASP.NET Core web application builder.
var builder = WebApplication.CreateBuilder(args);

// Configure the OpenTelemetry meter provider to add a meter named "OTel.AzureMonitor.Demo".
builder.Services.ConfigureOpenTelemetryMeterProvider((sp, builder) => builder.AddMeter("OTel.AzureMonitor.Demo"));

// Add the Azure Monitor telemetry service to the application.
// This service will collect and send telemetry data to Azure Monitor.
builder.Services.AddOpenTelemetry().UseAzureMonitor();

// Build the ASP.NET Core web application.
var app = builder.Build();

// Start the ASP.NET Core web application.
app.Run();

Meter 必须使用同一名称初始化。

// Get the current process.
var process = Process.GetCurrentProcess();

// Create a new meter named "OTel.AzureMonitor.Demo".
var meter = new Meter("OTel.AzureMonitor.Demo");

// Create a new observable gauge metric named "Thread.State".
// This metric will track the state of each thread in the current process.
ObservableGauge<int> myObservableGauge = meter.CreateObservableGauge("Thread.State", () => GetThreadState(process));

private static IEnumerable<Measurement<int>> GetThreadState(Process process)
{
    // Iterate over all threads in the current process.
    foreach (ProcessThread thread in process.Threads)
    {
        // Create a measurement for each thread, including the thread state, process ID, and thread ID.
        yield return new((int)thread.ThreadState, new("ProcessId", process.Id), new("ThreadId", thread.Id));
    }
}

添加自定义异常

选择检测库会自动报告 Application Insights 的异常。 但是,你可能想要手动报告检测库报告的异常之外的异常。 例如,通常不会报告代码捕获的异常。 你可能希望报告这些异常,以便在相关体验中引起注意,包括故障部分和端到端事务视图。

  • 若要使用活动记录异常:
    // Start a new activity named "ExceptionExample".
    using (var activity = activitySource.StartActivity("ExceptionExample"))
    {
        // Try to execute some code.
        try
        {
            throw new Exception("Test exception");
        }
        // If an exception is thrown, catch it and set the activity status to "Error".
        catch (Exception ex)
        {
            activity?.SetStatus(ActivityStatusCode.Error);
            activity?.RecordException(ex);
        }
    }
    
  • 要使用 ILogger 记录异常:
    // Create a logger using the logger factory. The logger category name is used to filter and route log messages.
    var logger = loggerFactory.CreateLogger(logCategoryName);
    
    // Try to execute some code.
    try
    {
        throw new Exception("Test Exception");
    }
    catch (Exception ex)
    {
        // Log an error message with the exception. The log level is set to "Error" and the event ID is set to 0.
        // The log message includes a template and a parameter. The template will be replaced with the value of the parameter when the log message is written.
        logger.Log(
            logLevel: LogLevel.Error,
            eventId: 0,
            exception: ex,
            message: "Hello {name}.",
            args: new object[] { "World" });
    }
    

添加自定义范围

你可能想要在两种情况下添加自定义跨度。 首先,当存在检测库尚未收集的依赖项请求时。 其次,当你希望在端到端事务视图上将应用程序进程建模为跨度时。

注意

System.Diagnostics 命名空间中的 ActivityActivitySource 类分别代表 SpanTracer 的 OpenTelemetry 概念。 可以通过使用其构造函数而不是使用 TracerProvider 来直接创建 ActivitySource。 每个 ActivitySource 类都必须使用 AddSource() 显式连接到 TracerProvider。 这是因为 OpenTelemetry 跟踪 API 的某些部分会直接合并到 .NET 运行时中。 若要了解详细信息,请参阅 OpenTelemetry .NET 跟踪 API 简介

// Define an activity source named "ActivitySourceName". This activity source will be used to create activities for all requests to the application.
internal static readonly ActivitySource activitySource = new("ActivitySourceName");

// Create an ASP.NET Core application builder.
var builder = WebApplication.CreateBuilder(args);

// Configure the OpenTelemetry tracer provider to add a source named "ActivitySourceName". This will ensure that all activities created by the activity source are traced.
builder.Services.ConfigureOpenTelemetryTracerProvider((sp, builder) => builder.AddSource("ActivitySourceName"));

// Add the Azure Monitor telemetry service to the application. This service will collect and send telemetry data to Azure Monitor.
builder.Services.AddOpenTelemetry().UseAzureMonitor();

// Build the ASP.NET Core application.
var app = builder.Build();

// Map a GET request to the root path ("/") to the specified action.
app.MapGet("/", () =>
{
    // Start a new activity named "CustomActivity". This activity will be traced and the trace data will be sent to Azure Monitor.
    using (var activity = activitySource.StartActivity("CustomActivity"))
    {
        // your code here
    }

    // Return a response message.
    return $"Hello World!";
});

// Start the ASP.NET Core application.
app.Run();

StartActivity 默认为 ActivityKind.Internal,但你可以提供任何其他 ActivityKindActivityKind.ClientActivityKind.ProducerActivityKind.Internal 映射到 Application Insights dependenciesActivityKind.ServerActivityKind.Consumer 映射到 Application Insights requests

使用 Application Insights Classic API 发送自定义遥测数据

建议尽可能使用 OpenTelemetry API,但在某些情况下,可能必须使用 Application Insights Classic API

事件
  1. 向应用程序添加 Microsoft.ApplicationInsights

  2. 创建一个 TelemetryClient 实例。

注意

务必仅为每个应用程序创建一次 TelemetryClient 实例。

var telemetryConfiguration = new TelemetryConfiguration { ConnectionString = "" };
var telemetryClient = new TelemetryClient(telemetryConfiguration);
  1. 使用客户端发送自定义遥测数据。
telemetryClient.TrackEvent("testEvent");

修改遥测

本部分介绍如何修改遥测。

添加范围属性

这些属性可能包括向遥测添加自定义属性。 还可以使用属性来设置 Application Insights 架构中的可选字段,如客户端 IP。

将自定义属性添加到范围

你添加到范围的任何属性都将导出为自定义属性。 它们将填充请求、依赖项、跟踪或异常表中的 customDimensions 字段。

若要添加范围属性,请使用以下两种方法之一:

  • 使用检测库提供的选项。
  • 添加自定义范围处理器。

提示

使用检测库提供的选项(当它们可用时)的优点是整个上下文都可用。 因此,用户可以选择添加或筛选更多属性。 例如,HttpClient 检测库中的扩充选项让用户可以访问 HttpRequestMessageHttpResponseMessage 本身。 他们可以从中选择任何内容并将其存储为属性。

  1. 许多检测库都提供扩充选项。 有关指南,请参阅各个检测库的自述文件:

  2. 使用自定义处理器:

提示

添加 Azure Monitor 之前,请添加此处显示的处理器。

// Create an ASP.NET Core application builder.
var builder = WebApplication.CreateBuilder(args);

// Configure the OpenTelemetry tracer provider to add a new processor named ActivityEnrichingProcessor.
builder.Services.ConfigureOpenTelemetryTracerProvider((sp, builder) => builder.AddProcessor(new ActivityEnrichingProcessor()));

// Add the Azure Monitor telemetry service to the application. This service will collect and send telemetry data to Azure Monitor.
builder.Services.AddOpenTelemetry().UseAzureMonitor();

// Build the ASP.NET Core application.
var app = builder.Build();

// Start the ASP.NET Core application.
app.Run();

使用以下代码将 ActivityEnrichingProcessor.cs 添加到你的项目:

public class ActivityEnrichingProcessor : BaseProcessor<Activity>
{
    public override void OnEnd(Activity activity)
    {
        // The updated activity will be available to all processors which are called after this processor.
        activity.DisplayName = "Updated-" + activity.DisplayName;
        activity.SetTag("CustomDimension1", "Value1");
        activity.SetTag("CustomDimension2", "Value2");
    }
}

设置用户 IP

可以通过设置范围的属性来填充请求的 client_IP 字段。 Application Insights 使用 IP 地址生成用户位置属性,然后默认放弃它

使用添加自定义属性示例,但替换 ActivityEnrichingProcessor.cs 中的以下代码行:

// Add the client IP address to the activity as a tag.
// only applicable in case of activity.Kind == Server
activity.SetTag("client.address", "<IP Address>");

设置用户 ID 或经过身份验证的用户 ID

可以使用以下指导填充请求的 user_Iduser_AuthenticatedId 字段。 用户 ID 是匿名用户标识符。 经过身份验证的用户 ID 是已知的用户标识符。

重要

在设置经过身份验证的用户 ID 之前,请参考适用的隐私法律。

使用添加自定义属性示例

// Add the user ID to the activity as a tag, but only if the activity is not null.
activity?.SetTag("enduser.id", "<User Id>");

添加日志属性

OpenTelemetry 使用 .NET 的 ILogger。 可以使用消息模板将自定义维度附加到日志。

筛选遥测数据

可以使用以下方法,在遥测数据离开你的应用程序之前筛选掉它。

  1. 许多检测库都提供筛选选项。 有关指南,请参阅各个检测库的自述文件:

  2. 使用自定义处理器:

    提示

    添加 Azure Monitor 之前,请添加此处显示的处理器。

    // Create an ASP.NET Core application builder.
    var builder = WebApplication.CreateBuilder(args);
    
    // Configure the OpenTelemetry tracer provider to add a new processor named ActivityFilteringProcessor.
    builder.Services.ConfigureOpenTelemetryTracerProvider((sp, builder) => builder.AddProcessor(new ActivityFilteringProcessor()));
    // Configure the OpenTelemetry tracer provider to add a new source named "ActivitySourceName".
    builder.Services.ConfigureOpenTelemetryTracerProvider((sp, builder) => builder.AddSource("ActivitySourceName"));
    // Add the Azure Monitor telemetry service to the application. This service will collect and send telemetry data to Azure Monitor.
    builder.Services.AddOpenTelemetry().UseAzureMonitor();
    
    // Build the ASP.NET Core application.
    var app = builder.Build();
    
    // Start the ASP.NET Core application.
    app.Run();
    

    使用以下代码将 ActivityFilteringProcessor.cs 添加到你的项目:

    public class ActivityFilteringProcessor : BaseProcessor<Activity>
    {
        // The OnStart method is called when an activity is started. This is the ideal place to filter activities.
        public override void OnStart(Activity activity)
        {
            // prevents all exporters from exporting internal activities
            if (activity.Kind == ActivityKind.Internal)
            {
                activity.IsAllDataRequested = false;
            }
        }
    }
    
  3. 如果没有使用 AddSource("ActivitySourceName") 显式添加特定源,则不会导出使用该源创建的任何活动。

获取跟踪 ID 或范围 ID

你可能想要获取跟踪 ID 或范围 ID。 如果你的日志发送到了 Application Insights 以外的目标,请考虑添加跟踪 ID 或跨度 ID。 这样做可以在调试和诊断问题时实现更好的关联。

注意

System.Diagnostics 命名空间中的 ActivityActivitySource 类分别代表 SpanTracer 的 OpenTelemetry 概念。 这是因为 OpenTelemetry 跟踪 API 的某些部分会直接合并到 .NET 运行时中。 若要了解详细信息,请参阅 OpenTelemetry .NET 跟踪 API 简介

// Get the current activity.
Activity activity = Activity.Current;
// Get the trace ID of the activity.
string traceId = activity?.TraceId.ToHexString();
// Get the span ID of the activity.
string spanId = activity?.SpanId.ToHexString();

后续步骤

常见问题解答

本部分提供常见问题的解答。

什么是 OpenTelemetry?

它是一种新的可观测性开源标准。 有关详细信息,请参阅 OpenTelemetry

Microsoft Azure Monitor 为什么要对 OpenTelemetry 进行投资?

Microsoft 是 OpenTelemetry 的最大贡献者之一。

OpenTelemetry 的关键价值主张是,它与供应商无关,可以跨语言提供一致的 API/SDK。

随着时间的推移,我们相信 OpenTelemetry 将使 Azure Monitor 客户能够观察用我们支持的语言之外的语言编写的应用程序。 它还通过丰富的检测库扩展了你可以收集的数据类型。 此外,OpenTelemetry SDK 在大规模使用时往往比其前身 Application Insights SDK 的性能更高。

最后,OpenTelemetry 符合 Microsoft 的拥抱开源策略。

OpenTelemetry 的状态是什么?

请参阅 OpenTelemetry 状态

什么是“Azure Monitor OpenTelemetry 发行版”?

你可以将其视为一个精简包装器,它将所有 OpenTelemetry 组件捆绑在一起,以便在 Azure 上获得一流的体验。 此包装器也称为 OpenTelemetry 中的分发

我为什么应该使用“Azure Monitor OpenTelemetry 发行版”?

使用 Azure Monitor OpenTelemetry 发行版相比于社区原生的 OpenTelemetry 有几个优势:

本着 OpenTelemetry 的精神,我们设计的发行版具有开放性和可扩展性。 例如,你可以添加:

  • OpenTelemetry 协议(OTLP) 导出程序,同时发送到第二个目标
  • 发行版中未包含的其他检测库

由于 Distro 提供 OpenTelemetry 分发,因此 Distro 支持 OpenTelemetry 所支持的任何功能。 例如,你可以添加更多遥测处理器、导出程序或检测库(如果受 OpenTelemetry 支持)。

注意

Distro 将采样器设置为 Application Insights 的自定义固定比率采样器。 你可以将其更改为不同的采样器,但这样做可能会禁用 Distro 包含的某些功能。 有关支持的采样器的详细信息,请参阅配置 Azure Monitor OpenTelemetry启用采样部分。

对于没有受支持独立 OpenTelemetry 导出程序的语言,目前仅支持通过 Azure Monitor OpenTelemetry Distro 方式将 OpenTelemetry 与 Azure Monitor 配合使用。 对于具有受支持独立 OpenTelemetry 导出程序的语言,可以根据遥测方案选择使用 Azure Monitor OpenTelemetry Distro 或相应的独立 OpenTelemetry 导出程序。 有关详细信息,请参阅何时应使用 Azure Monitor OpenTelemetry 导出程序?

如何测试 Azure Monitor OpenTelemetry 发行版?

请查看我们的 .NET、Java、JavaScript (Node.js) 和 Python 启用文档。

我应该使用 OpenTelemetry 还是 Application Insights SDK?

除非所需功能仅通过 Application Insights SDK 的正式支持提供,否则建议使用 OpenTelemetry 发行版。

立即采用 OpenTelemetry,可避免以后再迁移。

何时使用 Azure Monitor OpenTelemetry 导出程序?

对于 ASP.NET Core、Java、Node.js 和 Python,建议使用 Azure Monitor OpenTelemetry Distro。 只需一行代码即可开始。

对于所有其他 .NET 方案(包括经典 ASP.NET、控制台应用等),建议使用 .NET Azure Monitor OpenTelemetry 导出程序:Azure.Monitor.OpenTelemetry.Exporter

对于需要高级配置的更复杂的 Python 遥测方案,我们建议使用 Python Azure Monitor OpenTelemetry 导出程序

Azure Monitor OpenTelemetry 发行版中功能的当前发布状态是什么?

以下图表划分了每种语言的 OpenTelemetry 功能支持。

Feature .NET Node.js Python Java
分布式跟踪
自定义指标
标准指标(准确性当前受采样影响)
固定速率采样
脱机存储和自动重试
异常报告
日志收集 ⚠️
自定义事件 ⚠️ ⚠️ ⚠️
Microsoft Entra 身份验证
实时指标
检测 VM/VMSS 和应用程序服务的资源上下文
检测 AKS 和 Functions 的资源上下文
可用性测试范围筛选
自动填充用户 ID、经过身份验证的用户 ID 和用户 IP
手动覆盖/设置操作名称、用户 ID 或经过身份验证的用户 ID
自适应采样
探查器 ⚠️
快照调试程序

OpenTelemetry 能否用于 Web 浏览器?

可以,但我们不建议使用它,Azure 不支持它。 OpenTelemetry JavaScript 针对 Node.js 进行了深度优化。 相反,我们建议使用 Application Insights JavaScript SDK。

何时可以在 Web 浏览器中使用 OpenTelemetry SDK?

OpenTelemetry Web SDK 没有确定的可用性时间线。 我们可能还需要几年的时间,才能开发出可以替代 Application Insights JavaScript SDK 的浏览器 SDK。

今天能否在 Web 浏览器中测试 OpenTelemetry?

OpenTelemetry Web 沙盒 是一个分支,旨在使 OpenTelemetry 在浏览器中运行。 目前无法将遥测数据发送到 Application Insights。 SDK 不定义常规客户端事件。

是否支持将 Application Insights 与 AppDynamics、DataDog 和 NewRelic 等竞争对手代理一起运行?

不是。 我们不打算为此类问题提供测试或支持,不过,我们的发行版允许同时导出到 OTLP 终结点和 Azure Monitor。

是否可以在生产环境中使用预览功能?

但我们不建议这样做。 请参阅 Microsoft Azure 预览版补充使用条款

手动和自动检测之间有何区别?

请参阅 OpenTelemetry 概述

是否可以使用 OpenTelemetry 收集器?

某些客户使用 OpenTelemetry-Collector 作为代理替代方案,尽管 Microsoft 尚不正式支持使用基于代理的方法进行应用程序监视。 与此同时,开源社区贡献了一个 OpenTelemetry-Collector Azure Monitor 导出器,某些客户正在使用它向 Azure Monitor Application Insights 发送数据。 Microsoft 对此不支持。

OpenCensus 和 OpenTelemetry 之间有何区别?

OpenCensusOpenTelemetry 的前身。 Microsoft 帮助整合 OpenTracing 和 OpenCensus 用于创建 OpenTelemetry,OpenTelemetry 是全球唯一的可观测性标准。 Azure Monitor 当前生产推荐的 Python SDK 基于 OpenCensus。 Microsoft 致力于基于 OpenTelemetry 创建 Azure Monitor。

疑难解答

不起作用? 查看 ASP.NET Core 的故障排除页面。

支持

选择所选语言的选项卡,以发现支持选项。

OpenTelemetry 反馈

若要提供反馈,请查看以下内容: