|
1 |
| -.. _enterprise-flight-recorder: |
| 1 | +.. _enterprise-flight-recorder: |
2 | 2 |
|
3 | 3 | Flight recorder
|
4 | 4 | ===============
|
5 | 5 |
|
| 6 | +**Example on GitHub**: `flightrec <https://github.com/tarantool/doc/tree/latest/doc/code_snippets/snippets/config/instances.enabled/flightrec>`_ |
| 7 | + |
6 | 8 | The flight recorder available in the Enterprise Edition is an event collection tool that
|
7 | 9 | gathers various information about a working Tarantool instance, such as:
|
8 | 10 |
|
9 | 11 | * logs
|
10 |
| - |
11 | 12 | * metrics
|
12 |
| - |
13 | 13 | * requests and responses
|
14 | 14 |
|
15 | 15 | This information helps you investigate incidents related
|
16 | 16 | to :ref:`crashing <admin-disaster_recovery>` a Tarantool instance.
|
17 | 17 |
|
18 |
| - |
19 |
| -.. _enable: |
| 18 | +.. _enterprise-flight-recorder_enable: |
20 | 19 |
|
21 | 20 | Enabling the flight recorder
|
22 | 21 | ----------------------------
|
23 | 22 |
|
24 | 23 | The flight recorder is disabled by default and can be enabled and configured for
|
25 | 24 | a specific Tarantool instance.
|
26 |
| -To enable the flight recorder, set the ``flightrec_enabled`` |
27 |
| -:doc:`configuration option </reference/configuration/index>` to ``true``. |
28 |
| -This option is :ref:`dynamic <box_cfg_params>` and can be changed at runtime by calling ``box.cfg{}``: |
| 25 | +To enable the flight recorder, set the :ref:`flightrec.enabled <configuration_reference_flightrec_enabled>` |
| 26 | +configuration option to ``true``. |
| 27 | + |
| 28 | +.. literalinclude:: /code_snippets/snippets/config/instances.enabled/flightrec/config.yaml |
| 29 | + :language: yaml |
| 30 | + :start-at: flightrec: |
| 31 | + :end-at: enabled: true |
| 32 | + :dedent: |
29 | 33 |
|
30 |
| -.. code-block:: lua |
31 | 34 |
|
32 |
| - box.cfg{ flightrec_enabled = true } |
| 35 | +After ``flightrec.enabled`` is set to ``true``, the flight recorder starts collecting data in the flight recording file ``current.ttfr``. |
| 36 | +This file is stored in the ``snapshot.dir`` directory. |
| 37 | +By default, the directory is ``var/lib/{{ instance_name }}/<file_name>.ttfr``. |
33 | 38 |
|
34 |
| -After ``flightrec_enabled`` is set to ``true``, the flight recorder starts collecting data in the flight recording file ``current.ttfr``. |
35 |
| -This file is stored in the :ref:`memtx_dir <cfg_basic-memtx_dir>` directory. |
36 | 39 | If the instance crashes and reboots, Tarantool rotates the flight recording:
|
37 | 40 | ``current.ttfr`` is renamed to ``<timestamp>.ttfr`` (for example, ``20230411T050721.ttfr``)
|
38 | 41 | and the new ``current.ttfr`` file is created for collecting data.
|
39 | 42 | In the case of correct shutdown (for example, using ``os.exit()``),
|
40 | 43 | Tarantool continues writing to the existing ``current.ttfr`` file after restart.
|
41 | 44 |
|
42 |
| -.. NOTE:: |
| 45 | +.. NOTE:: |
43 | 46 |
|
44 | 47 | Note that old flight recordings should be removed manually.
|
45 | 48 |
|
46 | 49 |
|
| 50 | +.. _enterprise-flight-recorder_configure: |
47 | 51 |
|
48 |
| -.. _config: |
49 |
| - |
50 |
| -Configuration |
51 |
| -------------- |
52 |
| - |
53 |
| -This section describes options related to the flight recorder configuration. |
54 |
| -Note that all options are :ref:`dynamic <box_cfg_params>` and can be changed at runtime. |
55 |
| - |
56 |
| -.. TODO not implemented yet |
57 |
| - .. _config-directory: |
58 |
| -
|
59 |
| - Flight recording directory |
60 |
| - ~~~~~~~~~~~~~~~~~~~~~~~~~~ |
61 |
| -
|
62 |
| - .. _cfg_flightrec_dir: |
63 |
| -
|
64 |
| - .. confval:: flightrec_dir |
65 |
| -
|
66 |
| - Specifies the directory used to store flight recordings (``*.ttfr`` files). |
67 |
| -
|
68 |
| - | Type: string |
69 |
| - | Default: :ref:`memtx_dir <cfg_basic-memtx_dir>` |
70 |
| - | Environment variable: TT_FLIGHTREC_DIR |
71 |
| -
|
72 |
| -
|
73 |
| -
|
74 |
| -.. _config-logs: |
75 |
| - |
76 |
| -Logs |
77 |
| -~~~~ |
78 |
| - |
79 |
| -This section describes the flight recorder settings related to :ref:`logging <cfg_logging-log>`. |
80 |
| -For example, you can configure a more detailed logging level in the flight recorder for deeper analysis. |
81 |
| - |
82 |
| -* :ref:`flightrec_logs_size <cfg_flightrec_logs_size>` |
83 |
| -* :ref:`flightrec_logs_max_msg_size <cfg_flightrec_logs_max_msg_size>` |
84 |
| -* :ref:`flightrec_logs_log_level <cfg_flightrec_logs_log_level>` |
85 |
| - |
86 |
| -.. _cfg_flightrec_logs_size: |
87 |
| - |
88 |
| -.. confval:: flightrec_logs_size |
89 |
| - |
90 |
| - Specifies the size (in bytes) of the log storage. |
91 |
| - You can set this option to ``0`` to disable the log storage. |
92 |
| - |
93 |
| - | Type: integer |
94 |
| - | Default: 10485760 |
95 |
| - | Environment variable: TT_FLIGHTREC_LOGS_SIZE |
96 |
| -
|
97 |
| - |
98 |
| -.. _cfg_flightrec_logs_max_msg_size: |
99 |
| - |
100 |
| -.. confval:: flightrec_logs_max_msg_size |
101 |
| - |
102 |
| - Specifies the maximum size (in bytes) of the log message. |
103 |
| - The log message is truncated if its size exceeds this limit. |
104 |
| - |
105 |
| - | Type: integer |
106 |
| - | Default: 4096 |
107 |
| - | Maximum: 16384 |
108 |
| - | Environment variable: TT_FLIGHTREC_LOGS_MAX_MSG_SIZE |
109 |
| -
|
110 |
| - |
111 |
| -.. _cfg_flightrec_logs_log_level: |
112 |
| - |
113 |
| -.. confval:: flightrec_logs_log_level |
114 |
| - |
115 |
| - Specifies the level of detail the log has. |
116 |
| - You can learn more about log levels from the :ref:`log_level <cfg_logging-log_level>` |
117 |
| - option description. |
118 |
| - Note that the ``flightrec_logs_log_level`` value might differ from ``log_level``. |
119 |
| - |
120 |
| - | Type: integer |
121 |
| - | Default: 6 |
122 |
| - | Environment variable: TT_FLIGHTREC_LOGS_LOG_LEVEL |
123 |
| -
|
124 |
| - |
125 |
| -.. _config-metrics: |
126 |
| - |
127 |
| -Metrics |
128 |
| -~~~~~~~ |
129 |
| - |
130 |
| -This section describes the flight recorder settings related to collecting |
131 |
| -:ref:`metrics <metrics-reference>`. |
132 |
| - |
133 |
| -* :ref:`flightrec_metrics_period <cfg_flightrec_metrics_period>` |
134 |
| -* :ref:`flightrec_metrics_interval <cfg_flightrec_metrics_interval>` |
135 |
| - |
136 |
| -.. _cfg_flightrec_metrics_period: |
137 |
| - |
138 |
| -.. confval:: flightrec_metrics_period |
139 |
| - |
140 |
| - Specifies the time period (in seconds) that defines how long metrics are stored from the moment of dump. |
141 |
| - So, this value defines how much historical metrics data is collected up to the moment of crash. |
142 |
| - The frequency of metric dumps is defined by :ref:`flightrec_metrics_interval <cfg_flightrec_metrics_interval>`. |
143 |
| - |
144 |
| - | Type: integer |
145 |
| - | Default: 180 |
146 |
| - | Environment variable: TT_FLIGHTREC_METRICS_PERIOD |
147 |
| -
|
148 |
| - |
149 |
| -.. _cfg_flightrec_metrics_interval: |
150 |
| - |
151 |
| -.. confval:: flightrec_metrics_interval |
152 |
| - |
153 |
| - Specifies the time interval (in seconds) that defines the frequency of dumping metrics. |
154 |
| - This value shouldn't exceed :ref:`flightrec_metrics_period <cfg_flightrec_metrics_period>`. |
155 |
| - |
156 |
| - | Type: number |
157 |
| - | Default: 1.0 |
158 |
| - | Minimum: 0.001 |
159 |
| - | Environment variable: TT_FLIGHTREC_METRICS_INTERVAL |
160 |
| -
|
161 |
| -.. NOTE:: |
162 |
| - |
163 |
| - Given that the average size of a metrics entry is 2 kB, |
164 |
| - you can estimate the size of the metrics storage as follows: |
165 |
| - |
166 |
| - .. code-block:: console |
167 |
| -
|
168 |
| - (flightrec_metrics_period / flightrec_metrics_interval) * 2 kB |
169 |
| -
|
170 |
| -
|
171 |
| -
|
172 |
| -.. _config-requests: |
173 |
| - |
174 |
| -Requests |
175 |
| -~~~~~~~~ |
176 |
| - |
177 |
| -This section lists the flight recorder settings related to |
178 |
| -storing the :ref:`request and response <internals-requests_responses>` data. |
179 |
| - |
180 |
| -* :ref:`flightrec_requests_size <cfg_flightrec_requests_size>` |
181 |
| -* :ref:`flightrec_requests_max_req_size <cfg_flightrec_requests_max_req_size>` |
182 |
| -* :ref:`flightrec_requests_max_res_size <cfg_flightrec_requests_max_res_size>` |
183 |
| - |
184 |
| -.. _cfg_flightrec_requests_size: |
185 |
| - |
186 |
| -.. confval:: flightrec_requests_size |
187 |
| - |
188 |
| - Specifies the size (in bytes) of storage for the request and response data. |
189 |
| - You can set this parameter to ``0`` to disable a storage of requests and responses. |
190 |
| - |
191 |
| - | Type: integer |
192 |
| - | Default: 10485760 |
193 |
| - | Environment variable: TT_FLIGHTREC_REQUESTS_SIZE |
194 |
| -
|
195 |
| - |
196 |
| - |
197 |
| -.. _cfg_flightrec_requests_max_req_size: |
198 |
| - |
199 |
| -.. confval:: flightrec_requests_max_req_size |
200 |
| - |
201 |
| - Specifies the maximum size (in bytes) of a request entry. |
202 |
| - A request entry is truncated if this size is exceeded. |
| 52 | +Configuring a flight recorder |
| 53 | +----------------------------- |
203 | 54 |
|
204 |
| - | Type: integer |
205 |
| - | Default: 16384 |
206 |
| - | Environment variable: TT_FLIGHTREC_REQUESTS_MAX_REQ_SIZE |
| 55 | +When the flight recorder is enabled, you can set the options related to :ref:`logging <cfg_logging-log>`, |
| 56 | +:ref:`metrics <metrics-reference>`, and storing the :ref:`request and response <internals-requests_responses>` data. |
207 | 57 |
|
| 58 | +The ``flightrec`` configuration might look as follows: |
208 | 59 |
|
209 |
| -.. _cfg_flightrec_requests_max_res_size: |
| 60 | +.. literalinclude:: /code_snippets/snippets/config/instances.enabled/flightrec/config.yaml |
| 61 | + :language: yaml |
| 62 | + :start-at: flightrec: |
| 63 | + :end-at: 10485780 |
| 64 | + :dedent: |
210 | 65 |
|
211 |
| -.. confval:: flightrec_requests_max_res_size |
| 66 | +In the example, the following options are set: |
212 | 67 |
|
213 |
| - Specifies the maximum size (in bytes) of a response entry. |
214 |
| - A response entry is truncated if this size is exceeded. |
| 68 | +* :ref:`flightrec.logs_size <configuration_reference_flightrec_logs_size>` -- a log storage size in bytes. |
| 69 | +* :ref:`flightrec.logs_log_level <configuration_reference_flightrec_logs_log_level>` -- a :ref:`log_level <cfg_logging-log_level>`. |
| 70 | +* :ref:`flightrec.metrics_period <configuration_reference_flightrec_metrics_period>` -- the number of seconds to store metrics after the dump. |
| 71 | +* :ref:`flightrec.metrics_interval <configuration_reference_flightrec_metrics_interval>` -- the frequency of metrics dumps in seconds. |
| 72 | +* :ref:`flightrec.requests_size <configuration_reference_flightrec_requests_size>` -- a storage size for the request and response data in bytes. |
215 | 73 |
|
216 |
| - | Type: integer |
217 |
| - | Default: 16384 |
218 |
| - | Environment variable: TT_FLIGHTREC_REQUESTS_MAX_RES_SIZE |
| 74 | +Read more: :ref:`Flight recorder configuration options <configuration_reference_flightrec>`. |
0 commit comments