You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This example shows how to emit OpenTelemetry metrics from MATLAB. It uses all 3 synchronous instruments counter, updowncounter, and histogram.
2
+
There are two examples in this directory, metrics\_example and async\_metrics\_example.
3
+
4
+
## metrics\_example
5
+
This example shows how to emit OpenTelemetry synchronous metrics from MATLAB. It uses all 3 synchronous instruments counter, updowncounter, and histogram.
3
6
* At the beginning of the first run, initialization is necessary to create and store a global meter provider.
4
7
* The example then enters a loop and at each iteration updates all 3 instruments. The metrics will then be exported periodically at a fixed time interval.
5
8
6
-
## Running the Example
9
+
## async\_metrics\_example
10
+
This example shows how to emit OpenTelemetry asynchronous metrics from MATLAB. Is uses all 3 asynchronous instruments observable counter, observable
11
+
updowncounter, and obervable gauge.
12
+
* Initialization is first done by creating and storing a global meter provider, and specifying a data export interval and timeout.
13
+
* The asynchronous instruments are then created, passing in their respective callback functions.
14
+
* The example then pauses for 100 seconds, allowing the asynchronous instruments to periodically fetch and export their measurements.
15
+
* Finally, the global meter provider is shut down to stop any further data exports.
16
+
17
+
## Running the Examples
7
18
1. Start an instance of [OpenTelemetry Collector](https://github.com/open-telemetry/opentelemetry-collector).
8
19
2. Start MATLAB.
9
20
3. Ensure the installation directory of OpenTelemetry-matlab is on the MATLAB path.
10
-
4. Run metrics_example.
21
+
4. Run metrics\_example or async\_metrics\_example.
0 commit comments