SoW-2019-0007-2: Dynamic Snapshot: Triggers send partial event payload with notifications
[lttng-tools.git] / doc / examples / trigger-on-event / README.md
CommitLineData
5024c2ac
JR
1# Trigger notification example
2
3## Description
4This example is made-up of three executables.
5
6### `notification-client`
7
8```
9Usage: notification-client TRIGGER_NAME TRIGGER_NAME2 ...
10```
11
12A simple client that subscribes to the notifications emitted by the `TRIGGER_NAME` trigger.
13
14Multiple trigger names can be passed and subscribed to.
15
16
17### `instrumented-app`
18
19An application that emits the `trigger_example:my_event` event every 2 seconds.
20
21### `demo.sh`
22
23This script adds a trigger named `demo_trigger` which emits a notification when
24the user-space `trigger_example:my_event` event occurs.
25
26This script also adds a trigger named `demo_trigger_capture` which emits a
27notification when the user-space `trigger_example:my_event` event occurs and
28provides captured fields if present.
29
30Once the triggers have been setup, the notification-client is launched to print
31all notifications emitted by the `demo_trigger` and `demo_trigger_capture`
32trigger.
33
34## Building
35
36Simply run the included Makefile.
37
38## Running the example
39
401) Launch a session daemon using:
41 ```
42 $ lttng-sessiond
43 ```
442) Launch the `demo.sh` script
453) Launch the `instrumented-app`
46
47The following output should be produced:
48
49```
50$ ./demo.sh
51Registering a notification trigger named "demo_trigger" for the trigger_example:my_event user-space event
52Trigger registered successfully.
53Subscribed to notifications of trigger "demo_trigger"
54[02-14-2020] 18:13:34.779652 - Received notification of event rule trigger "demo_trigger_capture"
55Captured field values:
56 Unsigned int: 0,
57 CAPTURE UNAVAILABE
58[02-14-2020] 18:13:34.779766 - Received notification of event rule trigger "demo_trigger"
59[02-14-2020] 18:13:36.779798 - Received notification of event rule trigger "demo_trigger_capture"
60Captured field values:
61 Unsigned int: 1,
62 CAPTURE UNAVAILABE
63[02-14-2020] 18:13:36.779888 - Received notification of event rule trigger "demo_trigger"
64[02-14-2020] 18:13:38.780234 - Received notification of event rule trigger "demo_trigger_capture"
65Captured field values:
66 Unsigned int: 2,
67 CAPTURE UNAVAILABE
68[02-14-2020] 18:13:38.780514 - Received notification of event rule trigger "demo_trigger"
69[02-14-2020] 18:13:40.780574 - Received notification of event rule trigger "demo_trigger_capture"
70Captured field values:
71 Unsigned int: 3,
72 CAPTURE UNAVAILABE
73[02-14-2020] 18:13:40.780656 - Received notification of event rule trigger "demo_trigger"
74```
75
76```
77$ ./instrumented-app
78[02-14-2020] 18:13:34.779433 - Tracing event "trigger_example:my_event"
79[02-14-2020] 18:13:36.779693 - Tracing event "trigger_example:my_event"
80[02-14-2020] 18:13:38.780010 - Tracing event "trigger_example:my_event"
81[02-14-2020] 18:13:40.780286 - Tracing event "trigger_example:my_event"
82```
This page took 0.027598 seconds and 5 git commands to generate.