Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public LoggingHandler(

this.enhancers.addAll(enhancersParam);

List<LoggingEnhancer> loggingEnhancers = MonitoredResourceUtil.createResourceEnhancers();
List<LoggingEnhancer> loggingEnhancers = MonitoredResourceUtil.getResourceEnhancers();
if (loggingEnhancers != null) {
this.enhancers.addAll(loggingEnhancers);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ public static MonitoredResource getResource(String projectId, String resourceTyp
/**
* Returns custom log entry enhancers (if available) for resource type.
*
* @return custom long entry enhancers
* @return custom log entry enhancers
*/
public static List<LoggingEnhancer> createResourceEnhancers() {
public static List<LoggingEnhancer> getResourceEnhancers() {
Resource resourceType = getAutoDetectedResourceType();
return createEnhancers(resourceType);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,15 @@
/* Adds tracing support for logging with thread-local trace ID tracking. */
public class TraceLoggingEnhancer implements LoggingEnhancer {

private final static String TRACE_ID = "trace_id";
private final String traceIdLabel;

public TraceLoggingEnhancer() {
traceIdLabel = TRACE_ID;
}

public TraceLoggingEnhancer(String prefix) {
this.traceIdLabel = (prefix != null) ? prefix + "trace_id" : "";
traceIdLabel = (prefix != null) ? prefix + TRACE_ID : TRACE_ID;
}

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