Skip to content

Commit b206715

Browse files
authored
Merge pull request #49417 from brunobat/micrometer-extension-enabler
Allow other extensions to access initialPath
2 parents 0ce5d50 + e575802 commit b206715

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/binder/vertx/HttpRequestMetric.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ public class HttpRequestMetric extends RequestMetricInfo {
1818
/** Cache of vert.x resolved paths: /item/:id --> /item/{id} */
1919
final static ConcurrentHashMap<String, String> vertxWebToUriTemplate = new ConcurrentHashMap<>();
2020

21-
protected HttpServerRequestInternal request;
22-
protected String initialPath;
23-
protected String templatePath;
24-
protected String currentRoutePath;
21+
private HttpServerRequestInternal request;
22+
private String initialPath;
23+
private String templatePath;
24+
private String currentRoutePath;
2525
private final LongAdder activeRequests;
2626

2727
private boolean requestActive = false;
@@ -44,6 +44,10 @@ public String getNormalizedUriPath(Map<Pattern, String> matchPatterns, List<Patt
4444
return super.getNormalizedUriPath(matchPatterns, ignorePatterns, initialPath);
4545
}
4646

47+
public String getInitialPath() {
48+
return initialPath;
49+
}
50+
4751
public String applyTemplateMatching(String path) {
4852
// JAX-RS: UrlPathTemplate set in the
4953
String urlTemplatePath = getUrlTemplatePath();

extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/binder/vertx/VertxHttpServerMetrics.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public HttpRequestMetric responsePushed(LongTaskTimer.Sample socketMetric, HttpM
127127
if (path != null) {
128128
pushCounter
129129
.withTags(Tags.of(
130-
HttpCommonTags.uri(path, requestMetric.initialPath, response.statusCode(),
130+
HttpCommonTags.uri(path, requestMetric.getInitialPath(), response.statusCode(),
131131
config.isServerSuppress4xxErrors()),
132132
VertxMetricsTags.method(method),
133133
VertxMetricsTags.outcome(response),
@@ -184,7 +184,7 @@ public void requestReset(HttpRequestMetric requestMetric) {
184184
sample::stop,
185185
requestsTimer.withTags(Tags.of(
186186
VertxMetricsTags.method(requestMetric.request().method()),
187-
HttpCommonTags.uri(path, requestMetric.initialPath, 0, false),
187+
HttpCommonTags.uri(path, requestMetric.getInitialPath(), 0, false),
188188
Outcome.CLIENT_ERROR.asTag(),
189189
HttpCommonTags.STATUS_RESET)),
190190
requestMetric.request().context());
@@ -210,7 +210,7 @@ public void responseEnd(HttpRequestMetric requestMetric, HttpResponse response,
210210
Timer.Sample sample = requestMetric.getSample();
211211
Tags allTags = Tags.of(
212212
VertxMetricsTags.method(requestMetric.request().method()),
213-
HttpCommonTags.uri(path, requestMetric.initialPath, response.statusCode(),
213+
HttpCommonTags.uri(path, requestMetric.getInitialPath(), response.statusCode(),
214214
config.isServerSuppress4xxErrors()),
215215
VertxMetricsTags.outcome(response),
216216
HttpCommonTags.status(response.statusCode()));
@@ -249,7 +249,7 @@ public LongTaskTimer.Sample connected(LongTaskTimer.Sample sample, HttpRequestMe
249249
config.getServerIgnorePatterns());
250250
if (path != null) {
251251
return websocketConnectionTimer
252-
.withTags(Tags.of(HttpCommonTags.uri(path, requestMetric.initialPath, 0, false)))
252+
.withTags(Tags.of(HttpCommonTags.uri(path, requestMetric.getInitialPath(), 0, false)))
253253
.start();
254254
}
255255
return null;

0 commit comments

Comments
 (0)