Choosing the right OpenTelemetry instrument
We're now ready to generate metrics from our application. If you recall, in tracing, the tracer produces spans, which are used to create distributed traces. By contrast, the meter does not generate metrics; an instrument does. The meter's role is to produce instruments. OpenTelemetry offers many different instruments to record measurements. The following figure shows a list of all the instruments available:
Each instrument has a specific purpose, and the correct instrument depends on the following:
- The type of measurement being recorded
- Whether the measurement must be done synchronously
- Whether the values being recorded are monotonic or not
For synchronous instruments, a method is called on the instrument when it is time for a measurement to be recorded. For asynchronous instruments, a callback method is configured at the instrument&apos...