Class Instrumentation (3.18.0)

public final class Instrumentation

Inheritance

java.lang.Object > Instrumentation

Static Fields

DEFAULT_INSTRUMENTATION_VERSION

public static final String DEFAULT_INSTRUMENTATION_VERSION
Field Value
Type Description
String

DIAGNOSTIC_INFO_KEY

public static final String DIAGNOSTIC_INFO_KEY
Field Value
Type Description
String

INSTRUMENTATION_LOG_NAME

public static final String INSTRUMENTATION_LOG_NAME
Field Value
Type Description
String

INSTRUMENTATION_NAME_KEY

public static final String INSTRUMENTATION_NAME_KEY
Field Value
Type Description
String

INSTRUMENTATION_SOURCE_KEY

public static final String INSTRUMENTATION_SOURCE_KEY
Field Value
Type Description
String

INSTRUMENTATION_VERSION_KEY

public static final String INSTRUMENTATION_VERSION_KEY
Field Value
Type Description
String

JAVA_LIBRARY_NAME_PREFIX

public static final String JAVA_LIBRARY_NAME_PREFIX
Field Value
Type Description
String

MAX_DIAGNOSTIC_ENTIES

public static final int MAX_DIAGNOSTIC_ENTIES
Field Value
Type Description
int

MAX_DIAGNOSTIC_VALUE_LENGTH

public static final int MAX_DIAGNOSTIC_VALUE_LENGTH
Field Value
Type Description
int

Static Methods

addPartialSuccessOption(Logging.WriteOption[] options)

public static Logging.WriteOption[] 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
WriteOption[]

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<?>

The class to be used to determine a library version

Returns
Type Description
String

The version number string for given class or DEFAULT_INSTRUMENTATION_VERSION 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

truncateValue(String value)

public static String truncateValue(String value)

Trancates given string to MAX_DIAGNOSTIC_VALUE_LENGTH and adds "*" instead of reduced suffix

Parameter
Name Description
value String

{String} Value to be truncated

Returns
Type Description
String

The truncated string