0
# Quarkus Micrometer Deployment
1
2
Quarkus Micrometer deployment module provides build-time processing for integrating Micrometer metrics library into Quarkus applications. It handles automatic configuration, metric annotation processing, framework integrations, and registry setup during the build phase for comprehensive observability in cloud-native Java applications.
3
4
## Package Information
5
6
- **Package Name**: quarkus-micrometer-deployment
7
- **Package Type**: maven
8
- **Language**: Java
9
- **Group ID**: io.quarkus
10
- **Artifact ID**: quarkus-micrometer-deployment
11
- **Installation**: Add to pom.xml as a build dependency (typically used by Quarkus extensions, not directly by applications)
12
13
## Core Imports
14
15
```java
16
import io.quarkus.micrometer.deployment.MicrometerRegistryProviderBuildItem;
17
import io.quarkus.micrometer.deployment.RootMeterRegistryBuildItem;
18
import io.quarkus.micrometer.deployment.MicrometerProcessor;
19
```
20
21
## Basic Usage
22
23
This module is primarily used by Quarkus extension developers to integrate metrics into their extensions. Application developers typically don't interact with this module directly.
24
25
```java
26
// Example: Registering a custom meter registry in an extension
27
@BuildStep
28
MicrometerRegistryProviderBuildItem createCustomRegistry() {
29
return new MicrometerRegistryProviderBuildItem(CustomMeterRegistry.class);
30
}
31
32
// Example: Adding custom metric binder
33
@BuildStep(onlyIf = CustomBinderEnabled.class)
34
AdditionalBeanBuildItem addCustomBinder() {
35
return AdditionalBeanBuildItem.unremovableOf(CustomMeterBinder.class);
36
}
37
```
38
39
## Architecture
40
41
The Quarkus Micrometer deployment module is organized into several key components:
42
43
- **Core Build Items**: `MicrometerRegistryProviderBuildItem` and `RootMeterRegistryBuildItem` for registry management
44
- **Main Processors**: Core deployment logic in `MicrometerProcessor` and `MicrometerConfigAlwaysEnabledProcessor`
45
- **Framework Binders**: Automatic instrumentation for HTTP, gRPC, Kafka, Redis, and other technologies
46
- **Export Processors**: Registry endpoint configuration for Prometheus and JSON formats
47
- **MicroProfile Metrics Compatibility**: Bridge layer for MP Metrics API compatibility
48
49
## Capabilities
50
51
### Core Build Items
52
53
Essential build items for registry management and configuration during Quarkus build time.
54
55
```java { .api }
56
public final class MicrometerRegistryProviderBuildItem extends MultiBuildItem {
57
public MicrometerRegistryProviderBuildItem(Class<?> providedRegistryClass);
58
public MicrometerRegistryProviderBuildItem(String registryClassName);
59
public Class<? extends MeterRegistry> getRegistryClass();
60
}
61
62
public final class RootMeterRegistryBuildItem extends SimpleBuildItem {
63
public RootMeterRegistryBuildItem(RuntimeValue<MeterRegistry> value);
64
public RuntimeValue<MeterRegistry> getValue();
65
}
66
```
67
68
[Core Build Items and Processors](./core-processors.md)
69
70
### Framework Integration Binders
71
72
Automatic instrumentation processors for various Quarkus frameworks and technologies.
73
74
```java { .api }
75
// HTTP metrics enablement
76
@BuildStep(onlyIf = HttpServerBinderEnabled.class)
77
AdditionalBeanBuildItem enableHttpServerSupport();
78
79
// Vert.x metrics configuration
80
@BuildStep(onlyIf = VertxBinderEnabled.class)
81
RuntimeConfigSetterBuildItem setVertxConfig();
82
83
// gRPC interceptors
84
@BuildStep(onlyIf = GrpcClientSupportEnabled.class)
85
UnremovableBeanBuildItem addGrpcClientMetricInterceptor();
86
```
87
88
[Framework Integration Binders](./framework-binders.md)
89
90
### Registry Export Processors
91
92
Configuration processors for exposing metrics through various registry endpoints.
93
94
```java { .api }
95
public final class RegistryBuildItem extends MultiBuildItem {
96
public RegistryBuildItem(String name, String path);
97
public String name();
98
public String path();
99
}
100
101
@BuildStep(onlyIf = PrometheusEnabled.class)
102
MicrometerRegistryProviderBuildItem createPrometheusRegistry();
103
```
104
105
[Registry Export Processors](./registry-exports.md)
106
107
### MicroProfile Metrics Compatibility
108
109
Compatibility layer providing seamless migration from MicroProfile Metrics to Micrometer.
110
111
```java { .api }
112
@BuildStep(onlyIf = MicroprofileMetricsEnabled.class)
113
void processAnnotatedMetrics(
114
CombinedIndexBuildItem indexBuildItem,
115
BuildProducer<GeneratedClassBuildItem> generatedClasses
116
);
117
118
// Annotation transformation utilities
119
public static AnnotationTransformerBuildItem transformAnnotations(
120
IndexView index,
121
DotName sourceAnnotation
122
);
123
```
124
125
[MicroProfile Metrics Compatibility](./mp-metrics-compatibility.md)
126
127
## Types
128
129
### Core Types
130
131
```java { .api }
132
// Build-time enablement conditions
133
public static class MicrometerEnabled implements BooleanSupplier {
134
public boolean getAsBoolean();
135
}
136
137
// Registry provider configuration
138
public final class MicrometerRegistryProviderBuildItem extends MultiBuildItem {
139
// See Core Build Items section above
140
}
141
142
// Root registry access
143
public final class RootMeterRegistryBuildItem extends SimpleBuildItem {
144
// See Core Build Items section above
145
}
146
```
147
148
### Framework Integration Types
149
150
```java { .api }
151
// HTTP binder conditions
152
public static class HttpServerBinderEnabled implements BooleanSupplier;
153
public static class HttpClientBinderEnabled implements BooleanSupplier;
154
155
// Vert.x integration types
156
public static class VertxBinderEnabled implements BooleanSupplier;
157
158
// gRPC integration conditions
159
public static class GrpcClientSupportEnabled implements BooleanSupplier;
160
public static class GrpcServerSupportEnabled implements BooleanSupplier;
161
```
162
163
### MicroProfile Metrics Types
164
165
```java { .api }
166
// Annotation processing utilities
167
public final class MetricAnnotationInfo {
168
public final String name;
169
public final String description;
170
public final String unit;
171
public final String[] tags;
172
173
public MetricAnnotationInfo(AnnotationInstance annotation, ClassInfo classInfo);
174
}
175
176
// Annotation transformation support
177
public final class AnnotationHandler {
178
public static AnnotationTransformerBuildItem transformAnnotations(
179
IndexView index,
180
DotName sourceAnnotation
181
);
182
}
183
```