Adding more logging for import job. (#3702)

This commit is contained in:
v-iyamauchi 2024-02-08 08:05:07 -08:00 коммит произвёл GitHub
Родитель 353657c320
Коммит f2d7fedee4
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
2 изменённых файлов: 20 добавлений и 3 удалений

Просмотреть файл

@ -56,7 +56,7 @@ namespace Microsoft.Health.Fhir.Core.Features.Operations.Import
try
{
_logger.LogInformation("Start to load resource from store.");
_logger.LogInformation("Start to load resource from store: {ResourceLocation}.", resourceLocation);
// Try to acquire lease to block change on the blob.
leaseId = await _integrationDataStoreClient.TryAcquireLeaseAsync(new Uri(resourceLocation), Guid.NewGuid().ToString("N"), cancellationToken);

Просмотреть файл

@ -17,6 +17,7 @@ namespace Microsoft.Health.JobManagement
{
public class JobHosting
{
private static readonly ActivitySource JobHostingActivitySource = new ActivitySource(nameof(JobHosting));
private readonly IQueueClient _queueClient;
private readonly IJobFactory _jobFactory;
private readonly ILogger<JobHosting> _logger;
@ -85,8 +86,24 @@ namespace Microsoft.Health.JobManagement
if (nextJob != null)
{
_logger.LogJobInformation(nextJob, "Job dequeued.");
await ExecuteJobAsync(nextJob);
using (Activity activity = JobHostingActivitySource.StartActivity(
JobHostingActivitySource.Name,
ActivityKind.Server))
{
if (activity == null)
{
_logger.LogWarning("Failed to start an activity.");
}
activity?.SetTag("CreateDate", nextJob.CreateDate);
activity?.SetTag("HeartbeatDateTime", nextJob.HeartbeatDateTime);
activity?.SetTag("Id", nextJob.Id);
activity?.SetTag("QueueType", nextJob.QueueType);
activity?.SetTag("Version", nextJob.Version);
_logger.LogJobInformation(nextJob, "Job dequeued.");
await ExecuteJobAsync(nextJob);
}
}
else
{