Fix telemetry x host.name

This commit is contained in:
Samuele Locatelli
2026-03-06 19:07:25 +01:00
parent ffbcde2bf0
commit c989fa4a93
2 changed files with 21 additions and 1 deletions
+4 -1
View File
@@ -181,7 +181,10 @@ namespace EgwCoreLib.Lux.Data.Services
/// <returns></returns>
protected static Activity? StartActivity([CallerMemberName] string? methodName = null)
{
return ActivitySource.StartActivity(methodName);
var activity = ActivitySource.StartActivity(methodName ?? "UNDEF");
activity?.SetTag("host.name", Environment.MachineName);
return activity;
//return ActivitySource.StartActivity(methodName);
}
@@ -2467,6 +2467,7 @@ namespace EgwCoreLib.Lux.Data.Services
{
result = new List<TagsModel>();
}
// aggiunta tags + log
activity?.SetTag("data.source", source);
//activity?.Stop();
LogTrace($"TagsGetAllAsync | {source} | trace: {activity?.TraceId} | {activity?.Duration.TotalMilliseconds}ms");
@@ -2487,6 +2488,7 @@ namespace EgwCoreLib.Lux.Data.Services
// svuoto cache...
await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:Template:*");
await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:TemplateRows:*");
// aggiunta tags + log
activity?.SetTag("data.source", source);
LogTrace($"TemplateCloneAsync | {source} | trace: {activity?.TraceId} | {activity?.Duration.TotalMilliseconds}ms");
return fatto;
@@ -2506,6 +2508,7 @@ namespace EgwCoreLib.Lux.Data.Services
// svuoto cache...
await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:Template:*");
await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:TemplateRows:*");
// aggiunta tags + log
activity?.SetTag("data.source", source);
LogTrace($"TemplateDeleteAsync | {source} | trace: {activity?.TraceId} | {activity?.Duration.TotalMilliseconds}ms");
return fatto;
@@ -2540,6 +2543,7 @@ namespace EgwCoreLib.Lux.Data.Services
{
result = new List<TemplateModel>();
}
// aggiunta tags + log
activity?.SetTag("data.source", source);
LogTrace($"TemplateGetAllAsync | {source} | trace: {activity?.TraceId} | {activity?.Duration.TotalMilliseconds}ms");
return result;
@@ -2575,6 +2579,7 @@ namespace EgwCoreLib.Lux.Data.Services
{
result = new List<TemplateRowModel>();
}
// aggiunta tags + log
activity?.SetTag("data.source", source);
LogTrace($"TemplateRowByParentAsync | {source} | trace: {activity?.TraceId} | {activity?.Duration.TotalMilliseconds}ms");
return result;
@@ -2594,6 +2599,7 @@ namespace EgwCoreLib.Lux.Data.Services
// svuoto cache...
await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:Template:*");
await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:TemplateRow:*");
// aggiunta tags + log
activity?.SetTag("data.source", source);
LogTrace($"TemplateRowCloneAsync | {source} | trace: {activity?.TraceId} | {activity?.Duration.TotalMilliseconds}ms");
return fatto;
@@ -2613,6 +2619,7 @@ namespace EgwCoreLib.Lux.Data.Services
// svuoto cache...
await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:Template:*");
await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:TemplateRow:*");
// aggiunta tags + log
activity?.SetTag("data.source", source);
LogTrace($"TemplateRowDeleteAsync | {source} | trace: {activity?.TraceId} | {activity?.Duration.TotalMilliseconds}ms");
return fatto;
@@ -2633,6 +2640,7 @@ namespace EgwCoreLib.Lux.Data.Services
// svuoto cache...
await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:Template:*");
await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:TemplateRow:*");
// aggiunta tags + log
activity?.SetTag("data.source", source);
LogTrace($"TemplateRowFixUid | {source} | trace: {activity?.TraceId} | {activity?.Duration.TotalMilliseconds}ms");
return answ;
@@ -2667,6 +2675,7 @@ namespace EgwCoreLib.Lux.Data.Services
{
result = new List<TemplateRowModel>();
}
// aggiunta tags + log
activity?.SetTag("data.source", source);
LogTrace($"TemplateRowGetAllAsync | {source} | trace: {activity?.TraceId} | {activity?.Duration.TotalMilliseconds}ms");
return result;
@@ -2691,6 +2700,7 @@ namespace EgwCoreLib.Lux.Data.Services
// svuoto cache...
await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:TemplateRow:*");
}
// aggiunta tags + log
activity?.SetTag("data.source", source);
LogTrace($"TemplateRowUpdateAwaitStateAsync | {source} | trace: {activity?.TraceId} | {activity?.Duration.TotalMilliseconds}ms");
return fatto;
@@ -2710,6 +2720,7 @@ namespace EgwCoreLib.Lux.Data.Services
// svuoto cache...
await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:Template:*");
await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:TemplateRow:*");
// aggiunta tags + log
activity?.SetTag("data.source", source);
LogTrace($"TemplateRowUpdateFileDataAsync | {source} | trace: {activity?.TraceId} | {activity?.Duration.TotalMilliseconds}ms");
return fatto;
@@ -2730,6 +2741,7 @@ namespace EgwCoreLib.Lux.Data.Services
// svuoto cache...
await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:Template:*");
await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:TemplateRow:*");
// aggiunta tags + log
activity?.SetTag("data.source", source);
LogTrace($"TemplateRowUpdateSerStructAsync | {source} | trace: {activity?.TraceId} | {activity?.Duration.TotalMilliseconds}ms");
return fatto;
@@ -2749,6 +2761,7 @@ namespace EgwCoreLib.Lux.Data.Services
// svuoto cache...
await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:Template:*");
await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:TemplateRow:*");
// aggiunta tags + log
activity?.SetTag("data.source", source);
LogTrace($"TemplateRowUpsertAsync | {source} | trace: {activity?.TraceId} | {activity?.Duration.TotalMilliseconds}ms");
return fatto;
@@ -2768,6 +2781,7 @@ namespace EgwCoreLib.Lux.Data.Services
// svuoto cache...
await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:Template:*");
await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:TemplateRow:*");
// aggiunta tags + log
activity?.SetTag("data.source", source);
LogTrace($"TemplateUpdateCostAsync | {source} | trace: {activity?.TraceId} | {activity?.Duration.TotalMilliseconds}ms");
return fatto;
@@ -2787,6 +2801,7 @@ namespace EgwCoreLib.Lux.Data.Services
// svuoto cache...
await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:Template:*");
await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:TemplateRows:*");
// aggiunta tags + log
activity?.SetTag("data.source", source);
activity?.Stop();
LogTrace($"TemplateUpsertAsync | {source} | trace: {activity?.TraceId} | {activity?.Duration.TotalMilliseconds}ms");
@@ -2881,6 +2896,7 @@ namespace EgwCoreLib.Lux.Data.Services
{
LogTrace($"Server REDIS master non trovato", LogLevel.Error);
}
// aggiunta tags + log
activity?.SetTag("data.source", source);
activity?.SetTag("param.pat2Flush", pat2Flush);
LogTrace($"ExecFlushRedisPattern | {pat2Flush} | {source} | trace: {activity?.TraceId} | {activity?.Duration.TotalMilliseconds}ms");
@@ -2959,6 +2975,7 @@ namespace EgwCoreLib.Lux.Data.Services
{
LogTrace($"Server REDIS master non trovato", LogLevel.Error);
}
// aggiunta tags + log
activity?.SetTag("data.source", source);
activity?.SetTag("param.pat2Flush", pat2Flush);
LogTrace($"ExecFlushRedisPatternAsync | {pat2Flush} | {source} | trace: {activity?.TraceId} | {activity?.Duration.TotalMilliseconds}ms");