简体   繁体   English

Trace.CorrelationManager.ActivityId 的 ECS 字段引用中的等价物是什么?

[英]What is the equivalent in ECS fields reference of Trace.CorrelationManager.ActivityId?

I'm working with a .NET framework application and for the logs i use NLog logging them on a ElasticSearch target using an ECS(Elastic Common Schema) layout.我正在使用 .NET 框架应用程序,对于日志,我使用 NLog 使用 ECS(弹性通用模式)布局将它们记录在 ElasticSearch 目标上。 example:例子: 在此处输入图像描述

One of the parameters i'm logging is the activityId:我正在记录的参数之一是activityId: 在此处输入图像描述

It is well explained on this article. 这篇文章解释得很好。

Since i'm using an Nlog log layout, that tries to implement ECS 1.5 i'm wondering if anyone knows to which property activityId corresponds to?由于我使用的是 Nlog 日志布局,它试图实现ECS 1.5我想知道是否有人知道 activityId 对应于哪个属性? I think that event.id may make sense.我认为event.id可能有意义。

I think event.id is more like a Windows EventLog-EventId, that remains static independent of context.我认为event.id更像是 Windows EventLog-EventId,它保持 static 独立于上下文。 Where ActivityId is unique for each request.其中 ActivityId 对于每个请求都是唯一的。

Not sure where you have found NLog Layout of xsi:type="ElasticSearch" .不确定您在哪里找到xsi:type="ElasticSearch"的 NLog 布局。 But when looking at EcsLayout here:但是在这里查看 EcsLayout 时:

https://github.com/elastic/ecs-dotnet/tree/master/src/Elastic.CommonSchema.NLog https://github.com/elastic/ecs-dotnet/tree/master/src/Elastic.CommonSchema.NLog

Then the these values are mapped:然后映射这些值:

  • Transaction.Id = Identifier for the entire transaction. Transaction.Id = 整个交易的标识符。 Ex.前任。 ${ElasticApmTransactionId}
  • Trace.Id = CorrelationId for the current request. Trace.Id = 当前请求的 CorrelationId。 Ex.前任。 ${ElasticApmTraceId}
  • Span.Id = ActivityId for an operation within a request. Span.Id = 请求中操作的 ActivityId。

See also: https://www.elastic.co/guide/en/ecs/current/ecs-tracing.html另请参阅: https://www.elastic.co/guide/en/ecs/current/ecs-tracing.html

I guess the field to choose depends on what value you have decided to store in Trace.CorrelationManager.ActivityId .我猜要选择的字段取决于您决定在Trace.CorrelationManager.ActivityId中存储的值。

In the "new" world, then Microsoft is now selling System.Diagnostics.Activity.Current .在“新”世界中,微软现在正在销售System.Diagnostics.Activity.Current See also: https://github.com/NLog/NLog.DiagnosticSource另见: https://github.com/NLog/NLog.DiagnosticSource

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM