Skip to content

Commit 43203a7

Browse files
jabubakegarrettjonesgoogle
authored andcommitted
TraceLoggingEnhancer, MonitoredResourceUtil public methods reverted to 1.0.0 surface. (#2032)
* fixing un-intended breaking changes in logging api surface * javadoc typo
1 parent 5d50249 commit 43203a7

3 files changed

Lines changed: 9 additions & 4 deletions

File tree

google-cloud-logging/src/main/java/com/google/cloud/logging/LoggingHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ public LoggingHandler(
206206

207207
this.enhancers.addAll(enhancersParam);
208208

209-
List<LoggingEnhancer> loggingEnhancers = MonitoredResourceUtil.createResourceEnhancers();
209+
List<LoggingEnhancer> loggingEnhancers = MonitoredResourceUtil.getResourceEnhancers();
210210
if (loggingEnhancers != null) {
211211
this.enhancers.addAll(loggingEnhancers);
212212
}

google-cloud-logging/src/main/java/com/google/cloud/logging/MonitoredResourceUtil.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ public static MonitoredResource getResource(String projectId, String resourceTyp
128128
/**
129129
* Returns custom log entry enhancers (if available) for resource type.
130130
*
131-
* @return custom long entry enhancers
131+
* @return custom log entry enhancers
132132
*/
133-
public static List<LoggingEnhancer> createResourceEnhancers() {
133+
public static List<LoggingEnhancer> getResourceEnhancers() {
134134
Resource resourceType = getAutoDetectedResourceType();
135135
return createEnhancers(resourceType);
136136
}

google-cloud-logging/src/main/java/com/google/cloud/logging/TraceLoggingEnhancer.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,15 @@
1919
/* Adds tracing support for logging with thread-local trace ID tracking. */
2020
public class TraceLoggingEnhancer implements LoggingEnhancer {
2121

22+
private final static String TRACE_ID = "trace_id";
2223
private final String traceIdLabel;
2324

25+
public TraceLoggingEnhancer() {
26+
traceIdLabel = TRACE_ID;
27+
}
28+
2429
public TraceLoggingEnhancer(String prefix) {
25-
this.traceIdLabel = (prefix != null) ? prefix + "trace_id" : "";
30+
traceIdLabel = (prefix != null) ? prefix + TRACE_ID : TRACE_ID;
2631
}
2732

2833
private static final ThreadLocal<String> traceId = new ThreadLocal<>();

0 commit comments

Comments
 (0)