Class InstrumentationConfigUtil
ConfigProvider.getInstrumentationConfig().-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TgetInstrumentationConfigModel(ConfigProvider configProvider, String instrumentationName, com.fasterxml.jackson.databind.ObjectMapper objectMapper, Class<T> modelType) Return.instrumentation.java.<instrumentationName>, after converting it to themodelTypeusing theobjectMapper.static <T> TgetOrNull(ConfigProvider configProvider, Function<DeclarativeConfigProperties, T> accessor, String... segments) Walk down thesegmentsofConfigProvider.getInstrumentationConfig()and callaccessoron the terminal node.httpClientRequestCapturedHeaders(ConfigProvider configProvider) Return.instrumentation.general.http.client.request_captured_headers, or null if none is configured.httpClientResponseCapturedHeaders(ConfigProvider configProvider) Return.instrumentation.general.http.client.response_captured_headers, or null if none is configured.httpServerRequestCapturedHeaders(ConfigProvider configProvider) Return.instrumentation.general.http.server.request_captured_headers, or null if none is configured.httpServerResponseCapturedHeaders(ConfigProvider configProvider) Return.instrumentation.general.http.server.response_captured_headers, or null if none is configured.static DeclarativeConfigPropertiesjavaInstrumentationConfig(ConfigProvider configProvider, String instrumentationName) Return.instrumentation.java.<instrumentationName>, or null if none is configured.peerServiceMapping(ConfigProvider configProvider) Return a map representation of the peer service map entries in.instrumentation.general.peer.service_mapping, or null if none is configured.
-
Method Details
-
peerServiceMapping
Return a map representation of the peer service map entries in.instrumentation.general.peer.service_mapping, or null if none is configured.- Throws:
DeclarativeConfigException- if an unexpected type is encountered accessing the property
-
httpClientRequestCapturedHeaders
@Nullable public static List<String> httpClientRequestCapturedHeaders(ConfigProvider configProvider) Return.instrumentation.general.http.client.request_captured_headers, or null if none is configured.- Throws:
DeclarativeConfigException- if an unexpected type is encountered accessing the property
-
httpClientResponseCapturedHeaders
@Nullable public static List<String> httpClientResponseCapturedHeaders(ConfigProvider configProvider) Return.instrumentation.general.http.client.response_captured_headers, or null if none is configured.- Throws:
DeclarativeConfigException- if an unexpected type is encountered accessing the property
-
httpServerRequestCapturedHeaders
@Nullable public static List<String> httpServerRequestCapturedHeaders(ConfigProvider configProvider) Return.instrumentation.general.http.server.request_captured_headers, or null if none is configured.- Throws:
DeclarativeConfigException- if an unexpected type is encountered accessing the property
-
httpServerResponseCapturedHeaders
@Nullable public static List<String> httpServerResponseCapturedHeaders(ConfigProvider configProvider) Return.instrumentation.general.http.server.response_captured_headers, or null if none is configured.- Throws:
DeclarativeConfigException- if an unexpected type is encountered accessing the property
-
javaInstrumentationConfig
@Nullable public static DeclarativeConfigProperties javaInstrumentationConfig(ConfigProvider configProvider, String instrumentationName) Return.instrumentation.java.<instrumentationName>, or null if none is configured.- Throws:
DeclarativeConfigException- if an unexpected type is encountered accessing the property
-
getOrNull
@Nullable public static <T> T getOrNull(ConfigProvider configProvider, Function<DeclarativeConfigProperties, T> accessor, String... segments) Walk down thesegmentsofConfigProvider.getInstrumentationConfig()and callaccessoron the terminal node. Returns null ifConfigProvider.getInstrumentationConfig()is null, or if null is encountered walking thesegments, or ifaccessorreturns null.See other methods in
InstrumentationConfigUtilfor usage examples. -
getInstrumentationConfigModel
@Nullable public static <T> T getInstrumentationConfigModel(ConfigProvider configProvider, String instrumentationName, com.fasterxml.jackson.databind.ObjectMapper objectMapper, Class<T> modelType) Return.instrumentation.java.<instrumentationName>, after converting it to themodelTypeusing theobjectMapper. If no configuration exists for theinstrumentationName, returnsnull.This method is a convenience method for a common instrumentation library workflow:
- During initialization, an instrumentation library is given an
ConfigProviderand must initialize according to the relevant config - It checks if the user has provided configuration for it, and if so...
- It converts the configuration to an in-memory model representing all of its relevant properties
- It initializes using the strongly typed in-memory model
Conversion is done using
ObjectMapper.convertValue(Object, Class)fromcom.fasterxml.jackson.databind, and assumes themodelTypeis a POJO written / annotated to support jackson databinding.NOTE: callers MUST add their own dependency on
com.fasterxml.jackson.core:jackson-databind. This module's dependency iscompileOnlysince jackson is a large dependency that many users will not require. It's very possible to convert betweenDeclarativeConfigProperties(or a map representation fromDeclarativeConfigProperties.toMap(DeclarativeConfigProperties)) and a target model type without jackson. This method is provided as an optional convenience method.- Throws:
IllegalArgumentException- if conversion fails. SeeObjectMapper.convertValue(Object, Class)for details.
- During initialization, an instrumentation library is given an
-