Files
speckle-sharp-connectors/Sdk/Speckle.Connectors.Logging/ActivityScopeLogProcessor.cs
T
Adam Hathcock 4f04e9e1b5 Use Metrics in Connectors (#296)
* add metrics to host apps

* merge fixes and compiles

* Use ME.Console and OTel for logging to correlate

* clean up

* clean up for metrics

* fix self-review comments

* fix seq initialization

* clean up for http traces and rhino 8

* use latest SDK

* formatting
2024-10-14 13:36:07 +00:00

23 lines
510 B
C#

using OpenTelemetry;
using OpenTelemetry.Logs;
namespace Speckle.Connectors.Logging;
internal sealed class ActivityScopeLogProcessor : BaseProcessor<LogRecord>
{
public override void OnEnd(LogRecord data)
{
if (ActivityScope.Tags.Count > 0)
{
if (data.Attributes is null)
{
data.Attributes = ActivityScope.TagsList;
}
else if (data.Attributes.Count > 0)
{
data.Attributes = data.Attributes.Concat(ActivityScope.Tags).ToList();
}
}
}
}