public final class Instrumentation extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_INSTRUMENTATION_VERSION |
static String |
DIAGNOSTIC_INFO_KEY |
static String |
INSTRUMENTATION_LOG_NAME |
static String |
INSTRUMENTATION_NAME_KEY |
static String |
INSTRUMENTATION_SOURCE_KEY |
static String |
INSTRUMENTATION_VERSION_KEY |
static String |
JAVA_LIBRARY_NAME_PREFIX |
static int |
MAX_DIAGNOSTIC_ENTIES |
static int |
MAX_DIAGNOSTIC_VALUE_LENGTH |
Modifier and Type | Method and Description |
---|---|
static Logging.WriteOption[] |
addPartialSuccessOption(Logging.WriteOption[] options)
Adds a partialSuccess flag option to array of WriteOption
|
static LogEntry |
createDiagnosticEntry(String libraryName,
String libraryVersion)
The helper method to generate a log entry with diagnostic instrumentation data.
|
static String |
getLibraryVersion(Class<?> libraryClass)
Returns a library version associated with given class
|
static com.google.cloud.Tuple<Boolean,Iterable<LogEntry>> |
populateInstrumentationInfo(Iterable<LogEntry> logEntries)
Populates entries with instrumentation info which is added in separate log entry
|
static String |
truncateValue(String value)
Trancates given string to MAX_DIAGNOSTIC_VALUE_LENGTH and adds "*" instead of reduced suffix
|
public static final String DIAGNOSTIC_INFO_KEY
public static final String INSTRUMENTATION_SOURCE_KEY
public static final String INSTRUMENTATION_NAME_KEY
public static final String INSTRUMENTATION_VERSION_KEY
public static final String JAVA_LIBRARY_NAME_PREFIX
public static final String DEFAULT_INSTRUMENTATION_VERSION
public static final String INSTRUMENTATION_LOG_NAME
public static final int MAX_DIAGNOSTIC_VALUE_LENGTH
public static final int MAX_DIAGNOSTIC_ENTIES
public static com.google.cloud.Tuple<Boolean,Iterable<LogEntry>> populateInstrumentationInfo(Iterable<LogEntry> logEntries)
logEntries
- Iterable<LogEntry>
The list of entries to be populatedTuple<Boolean, Iterable<LogEntry>>
containing a flag if instrumentation info
was added or not and a modified list of log entriespublic static Logging.WriteOption[] addPartialSuccessOption(Logging.WriteOption[] options)
options
- {WriteOption[]} The options array to be extendedpublic static LogEntry createDiagnosticEntry(String libraryName, String libraryVersion)
libraryName
- {string} The name of the logging library to be reported. Should be prefixed
with 'java'. Will be truncated if longer than 14 characters.libraryVersion
- {string} The version of the logging library to be reported. Will be
truncated if longer than 14 characters.public static String getLibraryVersion(Class<?> libraryClass)
libraryClass
- The class to be used to determine a library versionCopyright © 2023 Google LLC. All rights reserved.