Skip to content

Commit dfdb893

Browse files
authored
Log requests as trace level for OtlpMeterRegistry (#6514)
See #6308 (comment) Signed-off-by: Johnny Lim <[email protected]>
1 parent 004622d commit dfdb893

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

implementations/micrometer-registry-otlp/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ dependencies {
1111
testImplementation 'org.testcontainers:junit-jupiter'
1212
testImplementation 'org.awaitility:awaitility'
1313
testImplementation libs.mockitoCore5
14+
testImplementation libs.logbackLatest
1415
}
1516

1617
dockerTest {

implementations/micrometer-registry-otlp/src/main/java/io/micrometer/registry/otlp/OtlpMeterRegistry.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ protected void publish() {
165165
.build())
166166
.build())
167167
.build();
168+
logger.trace("Request: {}", request);
168169
HttpSender.Request.Builder httpRequest = this.httpSender.post(this.config.url())
169170
.withHeader("User-Agent", this.userAgentHeader)
170171
.withContent("application/x-protobuf", request.toByteArray());
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<!--
2+
3+
Copyright 2025 VMware, Inc.
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
https://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
17+
-->
18+
<configuration>
19+
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
20+
<encoder>
21+
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
22+
</encoder>
23+
</appender>
24+
25+
<root level="info">
26+
<appender-ref ref="STDOUT" />
27+
</root>
28+
29+
<logger name="io.micrometer.registry.otlp.OtlpMeterRegistry" level="trace"/>
30+
</configuration>

0 commit comments

Comments
 (0)