Files
T
kjh2064 3f293d8aa8
deploy / deploy (push) Successful in 1m52s
deploy / notify (push) Successful in 1s
V13-FE-006: consolidate approved UI and contract hardening
2026-08-13 02:41:00 +09:00

38 lines
1.2 KiB
C#

using System.Diagnostics;
using Microsoft.Extensions.Logging;
namespace Kbx.Shared.Runtime;
public static class KbxTelemetry
{
public static readonly ActivitySource ActivitySource = new("KBX.BusinessRuntime");
public static Activity? StartOperation(
string operationName,
KbxRequestContext context,
string? entityType = null,
string? entityId = null)
{
var activity = ActivitySource.StartActivity(operationName, ActivityKind.Internal);
if (activity is null) return null;
activity.SetTag("kbx.screen.id", context.ScreenId);
activity.SetTag("kbx.correlation.id", context.CorrelationId);
activity.SetTag("kbx.tenant.id", context.TenantId?.ToString());
activity.SetTag("kbx.entity.type", entityType);
activity.SetTag("kbx.entity.id", entityId);
return activity;
}
public static void LogFailure(
ILogger logger,
Exception exception,
KbxRequestContext context,
string operation)
{
logger.LogError(exception,
"KBX operation failed. Operation={Operation} ScreenId={ScreenId} CorrelationId={CorrelationId}",
operation, context.ScreenId, context.CorrelationId);
}
}