Browse Source

More telemetry.

pull/815/head
Sebastian 4 years ago
parent
commit
b1e563517a
  1. 31
      backend/src/Squidex.Infrastructure/Orleans/LoggingFilter.cs
  2. 20
      backend/src/Squidex.Infrastructure/States/Persistence.cs

31
backend/src/Squidex.Infrastructure/Orleans/LoggingFilter.cs

@ -22,23 +22,28 @@ namespace Squidex.Infrastructure.Orleans
public async Task Invoke(IIncomingGrainCallContext context)
{
try
{
await context.Invoke();
}
catch (DomainException ex)
var name = $"Grain/{context.Grain?.GetType().Name}/{context.ImplementationMethod?.Name}";
using (Telemetry.Activities.StartActivity(name))
{
if (ex.InnerException != null)
try
{
Log(context, ex.InnerException);
await context.Invoke();
}
catch (DomainException ex)
{
if (ex.InnerException != null)
{
Log(context, ex.InnerException);
}
throw;
}
catch (Exception ex)
{
Log(context, ex);
throw;
throw;
}
catch (Exception ex)
{
Log(context, ex);
throw;
}
}
}

20
backend/src/Squidex.Infrastructure/States/Persistence.cs

@ -69,12 +69,18 @@ namespace Squidex.Infrastructure.States
{
if (UseSnapshots)
{
await snapshotStore.RemoveAsync(ownerKey);
using (Telemetry.Activities.StartActivity("Persistence/ReadState"))
{
await snapshotStore.RemoveAsync(ownerKey);
}
}
if (UseEventSourcing)
{
await eventStore.DeleteStreamAsync(streamName.Value);
using (Telemetry.Activities.StartActivity("Persistence/ReadEvents"))
{
await eventStore.DeleteStreamAsync(streamName.Value);
}
}
}
@ -171,7 +177,10 @@ namespace Squidex.Infrastructure.States
return;
}
await snapshotStore.WriteAsync(ownerKey, state, oldVersion, newVersion);
using (Telemetry.Activities.StartActivity("Persistence/WriteState"))
{
await snapshotStore.WriteAsync(ownerKey, state, oldVersion, newVersion);
}
versionSnapshot = newVersion;
@ -194,7 +203,10 @@ namespace Squidex.Infrastructure.States
try
{
await eventStore.AppendAsync(eventCommitId, streamName.Value, oldVersion, eventData);
using (Telemetry.Activities.StartActivity("Persistence/WriteEvents"))
{
await eventStore.AppendAsync(eventCommitId, streamName.Value, oldVersion, eventData);
}
}
catch (WrongEventVersionException ex)
{

Loading…
Cancel
Save