Skip to content

Commit

Permalink
updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
cappuc committed Feb 13, 2024
1 parent 923d113 commit ff61d66
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,21 +166,9 @@ You can disable it by setting `OT_INSTRUMENTATION_REDIS` to `false` or removing
### Queue jobs

Queue jobs are automatically traced.
It will automatically create a parent span with kind `PRODUCER` when a job is dispatched and a child span with kind `CONSUMER` when the job is executed.
You can disable it by setting `OT_INSTRUMENTATION_QUEUE` to `false` or removing the `QueueInstrumentation::class` from the config file.

To correctly trace queue jobs, you should wrap the job dispatch call in a parent span with kind `PRODUCER`:

```php
use Keepsuit\LaravelOpenTelemetry\Facades\Tracer;
use OpenTelemetry\API\Trace\SpanKind;

Tracer::newSpan('dispatch job')->setSpanKind(SpanKind::KIND_PRODUCER)->measure(function () {
dispatch(new MyJob());
});
```
The instrumentation will automatically create a child span of kind `CONSUMER` for the job when it's executed.


### Logs context

When starting a trace with provided instrumentation, the trace id is automatically injected in the log context.
Expand Down

0 comments on commit ff61d66

Please sign in to comment.