Package com.google.cloud.logging
Class MonitoredResourceUtil
java.lang.Object
com.google.cloud.logging.MonitoredResourceUtil
Monitored resource construction utilities to detect resource type and add labels. Used by logging
framework adapters to configure default resource. See usage in
LoggingHandler
.-
Nested Class Summary
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic com.google.cloud.MonitoredResource
getResource
(String projectId, String resourceType) BuildMonitoredResource
based on detected resource type and populate it with labels following Monitored Resource Types documentation.static List<LoggingEnhancer>
Returns custom log entry enhancers (if available) for resource type.protected static void
Method is intended to assist in testingMonitoredResourceUtil
class only.
-
Field Details
-
PORJECTID_LABEL
-
-
Method Details
-
setEnvironmentGetter
Method is intended to assist in testingMonitoredResourceUtil
class only.- Parameters:
getter
- A mocked environment getter for simulated test environments.
-
getResource
BuildMonitoredResource
based on detected resource type and populate it with labels following Monitored Resource Types documentation.- Parameters:
projectId
- A string defining the project idresourceType
- A custom resource type- Returns:
- the created
MonitoredResource
- See Also:
-
getResourceEnhancers
Returns custom log entry enhancers (if available) for resource type.- Returns:
- custom log entry enhancers
-