Skip to content
This repository was archived by the owner on Oct 3, 2023. It is now read-only.

Commit df3e55e

Browse files
authored
Add Annotations, links, time events (#81)
* Tracer is delegated the work of adding attributes, annotations, links, and message events * Add annotation, link, message event, time event models * Add AttributeTrait and flesh out the documentation for the new models * Span can maintain time events and links * Fix tests * Can set attributes on a specific span * Fix extension tracer to add attribute to specified span * Add addAttributes to static Tracer * Add tests for adding annotations, links, message events * Add tests for adding annotations, links, message events in the extension * Tests for extension * Spans return links and timeEvents * Create c types for annotations, links, message events * return links, annotations, message events as arrays * Move new data types into their own files * Create classes for annoations, links, message events * return model types for links and time events * Fix extension tests * Integrate with updates to the extension * cs fix * Documentation fixes * Fix 2 documentation errors
1 parent f4f9fbe commit df3e55e

43 files changed

Lines changed: 2239 additions & 331 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

ext/README.md

Lines changed: 46 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -248,20 +248,60 @@ function opencensus_trace_set_context($traceId, $parentSpanId = null);
248248

249249
```php
250250
/**
251-
* Add a attribute to the current span
251+
* Add an attribute to a span.
252252
*
253253
* @param string $key
254254
* @param string $value
255+
* @param array $options
256+
*
257+
* @type int $spanId The id of the span to which to add the attribute.
258+
* Defaults to the current span.
255259
*/
256-
function opencensus_trace_add_attribute($key, $value);
260+
function opencensus_trace_add_attribute($key, $value, $options = []);
261+
```
262+
263+
### Add an annotation to a span.
257264

265+
```php
258266
/**
259-
* Add a attribute to the root current span
267+
* Add an annotation to a span
268+
* @param string $description
269+
* @param array $options
260270
*
261-
* @param string $key
262-
* @param string $value
271+
* @type int $spanId The id of the span to which to add the attribute.
272+
* Defaults to the current span.
273+
*/
274+
function opencensus_trace_add_annotation($description, $options = []);
275+
```
276+
277+
### Add a link to a span.
278+
279+
```php
280+
/**
281+
* Add a link to a span
282+
* @param string $traceId
283+
* @param string $spanId
284+
* @param array $options
285+
*
286+
* @type int $spanId The id of the span to which to add the link.
287+
* Defaults to the current span.
288+
*/
289+
function opencensus_trace_add_link($traceId, $spanId, $options = []);
290+
```
291+
292+
### Add a message event to a span.
293+
294+
```php
295+
/**
296+
* Add a message to a span
297+
* @param string $type
298+
* @param string $id
299+
* @param array $options
300+
*
301+
* @type int $spanId The id of the span to which to add the attribute.
302+
* Defaults to the current span.
263303
*/
264-
function opencensus_trace_add_root_attribute($key, $value);
304+
function opencensus_trace_add_message_event($type, $id, $options = []);
265305
```
266306

267307
## Versioning

ext/config.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ PHP_ARG_ENABLE(opencensus, whether to enable my extension,
33

44
if test "$PHP_OPENCENSUS" = "yes"; then
55
AC_DEFINE(HAVE_OPENCENSUS, 1, [Whether you have OpenCensus])
6-
PHP_NEW_EXTENSION(opencensus, opencensus_trace.c opencensus_trace_span.c opencensus_trace_context.c, $ext_shared)
6+
PHP_NEW_EXTENSION(opencensus, opencensus_trace.c opencensus_trace_span.c opencensus_trace_context.c opencensus_trace_annotation.c opencensus_trace_link.c opencensus_trace_message_event.c, $ext_shared)
77
fi

ext/config.w32

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
ARG_ENABLE("opencensus", "opencensus support", "no");
55

66
if (PHP_OPENCENSUS != "no") {
7-
EXTENSION('opencensus', 'opencensus_trace.c opencensus_trace_context.c opencensus_trace_span.c');
7+
EXTENSION('opencensus', 'opencensus_trace.c opencensus_trace_context.c opencensus_trace_span.c opencensus_trace_annotation.c opencensus_trace_link.c opencensus_trace_message_event.c');
88
AC_DEFINE('HAVE_OPENCENSUS', 1);
99
}

0 commit comments

Comments
 (0)