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
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic com.google.cloud.MonitoredResourcegetResource(String projectId, String resourceType) BuildMonitoredResourcebased 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 voidMethod is intended to assist in testingMonitoredResourceUtilclass only.
-
Field Details
-
PORJECTID_LABEL
-
-
Method Details
-
setEnvironmentGetter
Method is intended to assist in testingMonitoredResourceUtilclass only.- Parameters:
getter- A mocked environment getter for simulated test environments.
-
getResource
BuildMonitoredResourcebased 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
-