Skip to content

Telemetry Actions not marked as Errors #429

@dviry

Description

@dviry

Maybe I am missing something - but shouldn't Telemetry Actions be set to Status error when... an error occurs?

In my code (in this case a QueueJob handler based on QueueJobBase<>) I had to wrap as following:

protected async override Task<JobResult> ProcessQueueEntryAsync(QueueEntryContext<IdpWorkItem> context)
{
   try
   {
      ......
   }
  catch (Exception ex)
  {
      Activity.Current?.SetStatus(ActivityStatusCode.Error, ex.Message);
      Activity.Current?.RecordException(ex);
      return JobResult.FromException(ex);
   }
}

Wouldn't be better to have that in here:

if (!queueEntry.IsCompleted && !queueEntry.IsAbandoned)

Or even better here:

_logger.LogJobResult(result, _options.Name);

I can find multiple places where this could be done (IMO the higher the better) - but is there any reason this was not done originally?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions