Allow collecting time events/links by chingor13 · Pull Request #171 · census-instrumentation/opencensus-php · GitHub
Skip to content
This repository was archived by the owner on Oct 3, 2023. It is now read-only.

Allow collecting time events/links#171

Merged
chingor13 merged 6 commits into
census-instrumentation:masterfrom
chingor13:add-annotations
Apr 18, 2018
Merged

Allow collecting time events/links#171
chingor13 merged 6 commits into
census-instrumentation:masterfrom
chingor13:add-annotations

Conversation

@chingor13

@chingor13 chingor13 commented Apr 13, 2018

Copy link
Copy Markdown
Member

Data model supported these types and you could provide them when creating a span. This allows you to add time events and links to any detached span or the span currently in context.

Using global tracer

Tracer::inSpan(['name' => 'some process', function () {
    Tracer::addAnnotation('starting request');
    // do something
    Tracer::addAnnotation('in between');
    Tracer::addLink('traceId', 'spanId');
    // do something else
    Tracer::addAnnotation('finished');
});

Adding to detached spans

$span = Tracer::startSpan(['name' => 'some process']);
$scope = Tracer::withSpan($span);

$span->addAnnotation(new Annotation('starting request');
$span->addAnnotation(new Annotation('in between');
$span->addLink(new Link('traceId', 'spanId'));
$span->addAnnotation(new Annotation('finished');

$scope->close();

Implementation notes

  • Spans now have an event handler that calls callbacks when we add time events/links.
  • Each tracer is responsible for handling the callback. For the extension, it will make calls to the extension to add time events/links to spans if the spans are attached.

@chingor13 chingor13 requested a review from tmatsuo April 14, 2018 00:06
@chingor13 chingor13 merged commit 77e75c8 into census-instrumentation:master Apr 18, 2018
@chingor13 chingor13 deleted the add-annotations branch April 18, 2018 21:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants