Skip to content

Commit c01cb37

Browse files
committed
change example from using tid to using pid
1 parent ff5b7c3 commit c01cb37

File tree

1 file changed

+52
-54
lines changed

1 file changed

+52
-54
lines changed

specification/metrics/supplementary-guidelines.md

+52-54
Original file line numberDiff line numberDiff line change
@@ -431,30 +431,30 @@ Instrument](./api.md#histogram). What if we collect measurements from an
431431
[Asynchronous Counter](./api.md#asynchronous-counter)?
432432

433433
The following example shows the number of [page
434-
faults](https://en.wikipedia.org/wiki/Page_fault) of each thread since the
435-
thread ever started:
434+
faults](https://en.wikipedia.org/wiki/Page_fault) of each process since
435+
it started:
436436

437437
* During the time range (T<sub>0</sub>, T<sub>1</sub>]:
438-
* pid = `1001`, tid = `1`, #PF = `50`
439-
* pid = `1001`, tid = `2`, #PF = `30`
438+
* pid = `1001`, #PF = `50`
439+
* pid = `1002`, #PF = `30`
440440
* During the time range (T<sub>1</sub>, T<sub>2</sub>]:
441-
* pid = `1001`, tid = `1`, #PF = `53`
442-
* pid = `1001`, tid = `2`, #PF = `38`
441+
* pid = `1001`, #PF = `53`
442+
* pid = `1002`, #PF = `38`
443443
* During the time range (T<sub>2</sub>, T<sub>3</sub>]
444-
* pid = `1001`, tid = `1`, #PF = `56`
445-
* pid = `1001`, tid = `2`, #PF = `42`
444+
* pid = `1001`, #PF = `56`
445+
* pid = `1002`, #PF = `42`
446446
* During the time range (T<sub>3</sub>, T<sub>4</sub>]:
447-
* pid = `1001`, tid = `1`, #PF = `60`
448-
* pid = `1001`, tid = `2`, #PF = `47`
447+
* pid = `1001`, #PF = `60`
448+
* pid = `1002`, #PF = `47`
449449
* During the time range (T<sub>4</sub>, T<sub>5</sub>]:
450-
* thread 1 died, thread 3 started
451-
* pid = `1001`, tid = `2`, #PF = `53`
452-
* pid = `1001`, tid = `3`, #PF = `5`
450+
* process 1 died, process 3 started
451+
* pid = `1002`, #PF = `53`
452+
* pid = `1003`, #PF = `5`
453453
* During the time range (T<sub>5</sub>, T<sub>6</sub>]:
454-
* thread 1 restarts
455-
* pid = `1001`, tid = `1`, #PF = `10`
456-
* pid = `1001`, tid = `2`, #PF = `57`
457-
* pid = `1001`, tid = `3`, #PF = `8`
454+
* A new process 1001 started
455+
* pid = `1001`, #PF = `10`
456+
* pid = `1002`, #PF = `57`
457+
* pid = `1003`, #PF = `8`
458458

459459
Note that in the following examples, Cumulative aggregation
460460
temporality is discussed before Delta aggregation temporality because
@@ -466,27 +466,27 @@ API with specified Cumulative aggregation temporality.
466466
If we export the metrics using **Cumulative Temporality**:
467467

468468
* (T<sub>0</sub>, T<sub>1</sub>]
469-
* attributes: {pid = `1001`, tid = `1`}, sum: `50`
470-
* attributes: {pid = `1001`, tid = `2`}, sum: `30`
469+
* attributes: {pid = `1001`}, sum: `50`
470+
* attributes: {pid = `1002`}, sum: `30`
471471
* (T<sub>0</sub>, T<sub>2</sub>]
472-
* attributes: {pid = `1001`, tid = `1`}, sum: `53`
473-
* attributes: {pid = `1001`, tid = `2`}, sum: `38`
472+
* attributes: {pid = `1001`}, sum: `53`
473+
* attributes: {pid = `1002`}, sum: `38`
474474
* (T<sub>0</sub>, T<sub>3</sub>]
475-
* attributes: {pid = `1001`, tid = `1`}, sum: `56`
476-
* attributes: {pid = `1001`, tid = `2`}, sum: `42`
475+
* attributes: {pid = `1001`}, sum: `56`
476+
* attributes: {pid = `1002`}, sum: `42`
477477
* (T<sub>0</sub>, T<sub>4</sub>]
478-
* attributes: {pid = `1001`, tid = `1`}, sum: `60`
479-
* attributes: {pid = `1001`, tid = `2`}, sum: `47`
478+
* attributes: {pid = `1001`}, sum: `60`
479+
* attributes: {pid = `1002`}, sum: `47`
480480
* (T<sub>0</sub>, T<sub>5</sub>]
481-
* attributes: {pid = `1001`, tid = `2`}, sum: `53`
481+
* attributes: {pid = `1002`}, sum: `53`
482482
* (T<sub>4</sub>, T<sub>5</sub>]
483-
* attributes: {pid = `1001`, tid = `3`}, sum: `5`
483+
* attributes: {pid = `1003`}, sum: `5`
484484
* (T<sub>5</sub>, T<sub>6</sub>]
485-
* attributes: {pid = `1001`, tid = `1`}, sum: `10`
485+
* attributes: {pid = `1001`}, sum: `10`
486486
* (T<sub>0</sub>, T<sub>6</sub>]
487-
* attributes: {pid = `1001`, tid = `2`}, sum: `57`
487+
* attributes: {pid = `1002`}, sum: `57`
488488
* (T<sub>4</sub>, T<sub>6</sub>]
489-
* attributes: {pid = `1001`, tid = `3`}, sum: `8`
489+
* attributes: {pid = `1003`}, sum: `8`
490490

491491
The behavior in the first four periods is quite straightforward - we
492492
just take the data being reported from the asynchronous instruments
@@ -532,24 +532,23 @@ data model.
532532
If we export the metrics using **Delta Temporality**:
533533

534534
* (T<sub>0</sub>, T<sub>1</sub>]
535-
* attributes: {pid = `1001`, tid = `1`}, delta: `50`
536-
* attributes: {pid = `1001`, tid = `2`}, delta: `30`
535+
* attributes: {pid = `1002`}, delta: `30`
537536
* (T<sub>1</sub>, T<sub>2</sub>]
538-
* attributes: {pid = `1001`, tid = `1`}, delta: `3`
539-
* attributes: {pid = `1001`, tid = `2`}, delta: `8`
537+
* attributes: {pid = `1001`}, delta: `3`
538+
* attributes: {pid = `1002`}, delta: `8`
540539
* (T<sub>2</sub>, T<sub>3</sub>]
541-
* attributes: {pid = `1001`, tid = `1`}, delta: `3`
542-
* attributes: {pid = `1001`, tid = `2`}, delta: `4`
540+
* attributes: {pid = `1001`}, delta: `3`
541+
* attributes: {pid = `1002`}, delta: `4`
543542
* (T<sub>3</sub>, T<sub>4</sub>]
544-
* attributes: {pid = `1001`, tid = `1`}, delta: `4`
545-
* attributes: {pid = `1001`, tid = `2`}, delta: `5`
543+
* attributes: {pid = `1001`}, delta: `4`
544+
* attributes: {pid = `1002`}, delta: `5`
546545
* (T<sub>4</sub>, T<sub>5</sub>]
547-
* attributes: {pid = `1001`, tid = `2`}, delta: `6`
548-
* attributes: {pid = `1001`, tid = `3`}, delta: `5`
546+
* attributes: {pid = `1002`}, delta: `6`
547+
* attributes: {pid = `1003`}, delta: `5`
549548
* (T<sub>5</sub>, T<sub>6</sub>]
550-
* attributes: {pid = `1001`, tid = `1`}, delta: `10`
551-
* attributes: {pid = `1001`, tid = `2`}, delta: `4`
552-
* attributes: {pid = `1001`, tid = `3`}, delta: `3`
549+
* attributes: {pid = `1001`}, delta: `10`
550+
* attributes: {pid = `1002`}, delta: `4`
551+
* attributes: {pid = `1003`}, delta: `3`
553552

554553
You can see that we are performing Cumulative->Delta conversion, and it requires
555554
us to remember the last value of **every single permutation we've encountered so
@@ -577,29 +576,28 @@ So here are some suggestions that we encourage SDK implementers to consider:
577576
##### Asynchronous example: attribute removal in a view
578577

579578
Suppose the metrics in the asynchronous example above are exported
580-
through a view configured to remove the `tid` attribute, leaving a
581-
single-dimensional count of page faults by `pid`. For each metric
582-
stream, two measurements are produced covering the same interval of
583-
time, which the SDK is expected to aggregate before producing the
584-
output.
579+
through a view configured to remove the `pid` attribute, leaving a
580+
count of page faults. For each metric stream, two measurements are produced
581+
covering the same interval of time, which the SDK is expected to aggregate
582+
before producing the output.
585583

586584
The data model specifies to use the "natural merge" function, in this
587585
case meaning to add the current point values together because they
588586
are `Sum` data points. The expected output is, still in **Cumulative
589587
Temporality**:
590588

591589
* (T<sub>0</sub>, T<sub>1</sub>]
592-
* dimensions: {pid = `1001`}, sum: `80`
590+
* dimensions: {}, sum: `80`
593591
* (T<sub>0</sub>, T<sub>2</sub>]
594-
* dimensions: {pid = `1001`}, sum: `91`
592+
* dimensions: {}, sum: `91`
595593
* (T<sub>0</sub>, T<sub>3</sub>]
596-
* dimensions: {pid = `1001`}, sum: `98`
594+
* dimensions: {}, sum: `98`
597595
* (T<sub>0</sub>, T<sub>4</sub>]
598-
* dimensions: {pid = `1001`}, sum: `107`
596+
* dimensions: {}, sum: `107`
599597
* (T<sub>0</sub>, T<sub>5</sub>]
600-
* dimensions: {pid = `1001`}, sum: `58`
598+
* dimensions: {}, sum: `58`
601599
* (T<sub>0</sub>, T<sub>6</sub>]
602-
* dimensions: {pid = `1001`}, sum: `75`
600+
* dimensions: {}, sum: `75`
603601

604602
As discussed in the asynchronous cumulative temporality example above,
605603
there are various treatments available for detecting resets. Even if

0 commit comments

Comments
 (0)