Class Instrumentation (3.12.1)
Stay organized with collections
Save and categorize content based on your preferences.
public final class Instrumentation
Static Fields
DEFAULT_INSTRUMENTATION_VERSION
public static final String DEFAULT_INSTRUMENTATION_VERSION
Field Value
DIAGNOSTIC_INFO_KEY
public static final String DIAGNOSTIC_INFO_KEY
Field Value
INSTRUMENTATION_LOG_NAME
public static final String INSTRUMENTATION_LOG_NAME
Field Value
INSTRUMENTATION_NAME_KEY
public static final String INSTRUMENTATION_NAME_KEY
Field Value
INSTRUMENTATION_SOURCE_KEY
public static final String INSTRUMENTATION_SOURCE_KEY
Field Value
INSTRUMENTATION_VERSION_KEY
public static final String INSTRUMENTATION_VERSION_KEY
Field Value
JAVA_LIBRARY_NAME_PREFIX
public static final String JAVA_LIBRARY_NAME_PREFIX
Field Value
MAX_DIAGNOSTIC_ENTIES
public static final int MAX_DIAGNOSTIC_ENTIES
Field Value
MAX_DIAGNOSTIC_VALUE_LENGTH
public static final int MAX_DIAGNOSTIC_VALUE_LENGTH
Field Value
Static Methods
addPartialSuccessOption(Logging.WriteOption[] options)
public static Logging.WriteOption @Nullable [] addPartialSuccessOption(Logging.WriteOption[] options)
Adds a partialSuccess flag option to array of WriteOption
Parameter
Name |
Description |
options |
WriteOption[]
{WriteOption[]} The options array to be extended
|
Returns
Type |
Description |
com.google.cloud.logging.Logging.WriteOption @org.jspecify.nullness.Nullable [] |
The new array of oprions containing WriteOption.OptionType.PARTIAL_SUCCESS flag set to
true
|
createDiagnosticEntry(String libraryName, String libraryVersion)
public static LogEntry createDiagnosticEntry(String libraryName, String libraryVersion)
The helper method to generate a log entry with diagnostic instrumentation data.
Parameters
Name |
Description |
libraryName |
String
{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
{string} The version of the logging library to be reported. Will be
truncated if longer than 14 characters.
|
Returns
Type |
Description |
LogEntry |
{LogEntry} The entry with diagnostic instrumentation data.
|
getLibraryVersion(Class<?> libraryClass)
public static String getLibraryVersion(Class<?> libraryClass)
Returns a library version associated with given class
Parameter
Name |
Description |
libraryClass |
Class<?>
{Class<?>} The class to be used to determine a library version
|
Returns
Type |
Description |
String |
The version number string for given class or "UNKNOWN" if class library version cannot
be detected
|
populateInstrumentationInfo(Iterable<LogEntry> logEntries)
public static Tuple<Boolean,Iterable<LogEntry>> populateInstrumentationInfo(Iterable<LogEntry> logEntries)
Populates entries with instrumentation info which is added in separate log entry
Parameter
Name |
Description |
logEntries |
Iterable<LogEntry>
Iterable<LogEntry> The list of entries to be populated
|
Returns
Type |
Description |
com.google.cloud.Tuple<Boolean,Iterable<LogEntry>> |
Tuple<Boolean, Iterable<LogEntry>> containing a flag if instrumentation info
was added or not and a modified list of log entries
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-24 UTC.
[{
"type": "thumb-down",
"id": "hardToUnderstand",
"label":"Hard to understand"
},{
"type": "thumb-down",
"id": "incorrectInformationOrSampleCode",
"label":"Incorrect information or sample code"
},{
"type": "thumb-down",
"id": "missingTheInformationSamplesINeed",
"label":"Missing the information/samples I need"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
{"lastModified": "Last updated 2024-09-24 UTC."}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-09-24 UTC."]]