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) public async Task Invoke(IIncomingGrainCallContext context)
{ {
try var name = $"Grain/{context.Grain?.GetType().Name}/{context.ImplementationMethod?.Name}";
{
await context.Invoke(); using (Telemetry.Activities.StartActivity(name))
}
catch (DomainException ex)
{ {
if (ex.InnerException != null) try
{ {
Log(context, ex.InnerException); await context.Invoke();
} }
catch (DomainException ex)
{
if (ex.InnerException != null)
{
Log(context, ex.InnerException);
}
throw; throw;
} }
catch (Exception ex) catch (Exception ex)
{ {
Log(context, ex); Log(context, ex);
throw; throw;
}
} }
} }

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

@ -69,12 +69,18 @@ namespace Squidex.Infrastructure.States
{ {
if (UseSnapshots) if (UseSnapshots)
{ {
await snapshotStore.RemoveAsync(ownerKey); using (Telemetry.Activities.StartActivity("Persistence/ReadState"))
{
await snapshotStore.RemoveAsync(ownerKey);
}
} }
if (UseEventSourcing) 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; return;
} }
await snapshotStore.WriteAsync(ownerKey, state, oldVersion, newVersion); using (Telemetry.Activities.StartActivity("Persistence/WriteState"))
{
await snapshotStore.WriteAsync(ownerKey, state, oldVersion, newVersion);
}
versionSnapshot = newVersion; versionSnapshot = newVersion;
@ -194,7 +203,10 @@ namespace Squidex.Infrastructure.States
try 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) catch (WrongEventVersionException ex)
{ {

Loading…
Cancel
Save