Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problemsTo capture cron-job failures and estimate media retry costs, attach a pg-boss error listener before starting the queue, record telemetry for every processing attempt, and keep a stable media-work ID across retries. Then join those attempt records to measured resource usage and your own billing rates. Queue telemetry can show what ran and how long it took; it does not calculate a media-processing bill.
What pg-boss captures—and what it does not
pg-boss is a Node.js job queue backed by PostgreSQL that supports scheduled work, including cron scheduling. Its documented delivery model is at least once: a job can run more than once, and a handler error ordinarily triggers retries that may eventually end in a failed state. A scheduled job record therefore does not necessarily equal one media execution.
As an Amazon Associate I earn from qualifying purchases.
pg-boss documents OpenTelemetry process spans, retry-count and error-type attributes, processing-duration metrics, and optional trace-context propagation from job submission through processing, including retries. These capabilities provide useful execution evidence, but they do not identify your media costs or supply processing prices.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Capture queue errors before starting the worker
Register an error listener immediately after creating the pg-boss instance and before calling start(). The pg-boss Events documentation strongly encourages this because Node.js can throw an unhandled EventEmitter error and exit the process. Queue-level errors may arise during scheduling or maintenance as well as during job handling, so a handler-level catch alone is not sufficient.
#1 Best Overall
const boss = new PgBoss(connectionString);
boss.on("error", (error) => {
logger.error({
event: "pgboss.error",
error: error.message,
// Add only safe, useful metadata available in your application.
}, "pg-boss emitted an error");
alertPipeline.capture(error);
});
await boss.start();
Adapt the constructor and logger names to your application. Send the event to structured logging and your established alert or error pipeline. Do not log credentials, sensitive media payloads, or other secrets; include only safe context that helps identify the affected queue or operation.
Record each processing attempt, not just the final status
Give the logical media operation a stable identifier—such as a media-work ID—and carry it through every retry. For each attempt, retain the identifiers and measurements needed to explain what happened and later join it to resource records.
Rank #2
- Logical media-work ID and, where useful, media asset or pipeline-stage ID.
- pg-boss job ID and queue name.
- Attempt or retry count.
- Attempt start and end time, or processing duration.
- Outcome and a classified error type.
- Trace context, when configured and available.
pg-boss’s OpenTelemetry documentation describes process spans and attributes including pgboss.job.retry_count and error.type, along with a processing-duration metric. It also documents optional trace-context propagation across asynchronous submission and processing. Use these queue-provided signals alongside application-specific identifiers and resource measurements; do not assume a queue span by itself contains all the accounting data your media pipeline needs.
OpenTelemetry defines messaging.process.duration as a histogram measured in seconds. Its messaging metric conventions also recommend predictable, low-cardinality values for error.type. Prefer a stable class such as a timeout or provider error over putting unique exception messages, asset IDs, or other unbounded values into that field. Keep high-cardinality identifiers in appropriate trace or event attributes rather than metric labels.
Rank #3
Make retries safe to repeat
At-least-once delivery means a handler may execute again after an interruption or failure. Design processing to be idempotent where possible—for example, make a repeated request for the same logical work avoid duplicating a completed side effect—or otherwise make duplicate execution safe. Preserve the same logical work ID across attempts so that retry activity can be grouped without confusing separate media operations.
Estimate retry cost from your own usage and rates
The accounting step is application-specific; pg-boss and OpenTelemetry do not publish media-processing prices or provide an off-the-shelf retry-cost calculation. A defensible estimate links every attempt to the relevant resource usage and applies the rates that actually govern your organization’s bill.
Rank #4
- Group attempts by logical work ID. Keep individual attempt records so a retry’s usage is not hidden by the job’s final outcome.
- Join attempts to measured usage. Associate each attempt with the application’s metered compute, transcoding, storage, or other relevant resource records. Duration alone may not precisely predict a provider charge.
- Apply the applicable rates. Use your organization’s billing data, including the relevant service, billing period, and geography when they affect the rate.
- Label the result accurately. Separate estimated cost derived from telemetry from directly metered cost, and do not report an exact monetary amount unless the underlying usage and rate data support it.
This approach makes retry overhead attributable without implying that queue telemetry itself measures cost. The resulting estimate is only as reliable as the usage records, identifiers, and billing rates joined to each attempt.
Free tools Windows power users keep installed
One-click scans. No signup required.
Account for operational constraints
pg-boss stores job state in PostgreSQL, so its scheduling and queue state can live alongside an existing PostgreSQL-backed application. The project’s introduction also notes that each pg-boss instance maintains its own database connection pool and that the database connection limit constrains the number of instances. Include connection capacity and queue retention in the design: observability is useful only if the system can retain the records needed for the billing period and run within the database’s operational limits.
The documented capabilities establish a practical instrumentation pattern, not a universal queue recommendation or a measured cost result. Choose a queue architecture based on your database capacity, retry and duplicate-execution requirements, trace propagation needs, attempt-level telemetry, and ability to join execution records to stable media identifiers and billing data.
Quick Recap
Sources
- pg-boss: Introduction — PostgreSQL-backed queue, scheduling, delivery and retry behavior, and operational considerations.
- pg-boss: Events — error-event listener guidance.
- pg-boss: OpenTelemetry — spans, attributes, metrics, and trace propagation.
- OpenTelemetry: Semantic conventions for messaging client metrics — processing-duration units and error-type guidance.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




