feat: add OpenTelemetry instrumentation

This commit is contained in:
2026-11-01 17:06:32 +03:00
parent cea50c2cd6
commit 934dfefee7
49 changed files with 1113 additions and 286 deletions
+4 -4
View File
@@ -10,7 +10,7 @@ import (
"github.com/google/uuid"
"github.com/jackc/pgx/v5"
"gitea.privcloud.tech/dizi/mtusi2026lab5/internal/model"
"gitea.privcloud.tech/dizi/mtusi2026lab6/internal/model"
)
const attachmentJobTopic = "attachment.jobs"
@@ -447,6 +447,8 @@ func (s *Store) RetryAttachmentJob(
lease model.AttachmentJobLease,
errorCode string,
nextAttemptAt time.Time,
traceparent string,
tracestate string,
) (model.JobMutationResult, error) {
if !validErrorCode(errorCode) || nextAttemptAt.IsZero() {
return "", model.ErrInvalidInput
@@ -483,9 +485,7 @@ func (s *Store) RetryAttachmentJob(
if _, err := tx.Exec(ctx, queueAttachment, attachment.ID, job.PipelineVersion); err != nil {
return "", fmt.Errorf("requeue attachment: %w", err)
}
eventJob := job
eventJob.CreatedAt = time.Now().UTC()
if err := insertAttachmentJobOutbox(ctx, tx, eventJob, "", ""); err != nil {
if err := insertAttachmentJobOutbox(ctx, tx, job, traceparent, tracestate); err != nil {
return "", err
}
if err := tx.Commit(ctx); err != nil {