Meter is the entry point for creating instruments that record measurements in your application. Meters should be scoped to a single library or application component.
MeterProvider
TheMeterProvider trait provides access to named Meter instances:
Creating a Meter
There are two ways to create a meter:Simple Meter Creation
The simplest way is to use a static name:Meter with Full Scope
For libraries and crates, you should include version and schema information:Meter Naming Guidelines
The meter name should:- Be unique within your application
- Represent the instrumentation scope (typically the library or module name)
- Not collide with other applications or libraries
- Be stable across versions
Global Meter Provider
OpenTelemetry provides a global meter provider that can be accessed from anywhere in your application:Creating Instruments
Once you have aMeter, you can create instruments to record measurements. All instruments are created using a builder pattern:
Available Instrument Builders
TheMeter provides builders for all instrument types:
Synchronous Instruments
Asynchronous Instruments
Instrument Configuration
All instrument builders support common configuration options:Instrument Reuse
Instruments can be cloned to create multiple handles to the same underlying metric:Shutting Down
When your application terminates, shut down the meter provider to flush any pending metrics:Next Steps
Instruments
Learn about the different instrument types
Counter
Record monotonically increasing values
Histogram
Record value distributions
Observable Instruments
Use callbacks to report measurements