/** * Given a request context, it generates a new dependency target, possibly including the appId found in * the given Request-Context. * @param requestContext - the Request-Context header value * @return the dependency target */ public static String generateChildDependencyTarget(String requestContext) { if (requestContext == null || requestContext.isEmpty()) { InternalLogger.INSTANCE.trace("generateChildDependencyTarget: won't continue as requestContext is null or empty."); return ""; } String instrumentationKey = TelemetryConfiguration.getActive().getInstrumentationKey(); if (instrumentationKey == null || instrumentationKey.isEmpty()) { InternalLogger.INSTANCE.error("Failed to generate target correlation. InstrumentationKey is null or empty."); return ""; } String target = generateSourceTargetCorrelation(instrumentationKey, requestContext); if (target == null) { InternalLogger.INSTANCE.warn("Target value is null and hence returning empty string"); return ""; // we want an empty string instead of null so it plays nicer with bytecode injection } return target; }
/** * Given a request context, it generates a new dependency target, possibly including the appId found in * the given Request-Context. * @param requestContext - the Request-Context header value * @return the dependency target */ public static String generateChildDependencyTarget(String requestContext) { if (requestContext == null || requestContext.isEmpty()) { InternalLogger.INSTANCE.trace("generateChildDependencyTarget: won't continue as requestContext is null or empty."); return ""; } String instrumentationKey = TelemetryConfiguration.getActive().getInstrumentationKey(); if (instrumentationKey == null || instrumentationKey.isEmpty()) { InternalLogger.INSTANCE.error("Failed to generate target correlation. InstrumentationKey is null or empty."); return ""; } String target = generateSourceTargetCorrelation(instrumentationKey, requestContext); if (target == null) { InternalLogger.INSTANCE.warn("Target value is null and hence returning empty string"); return ""; // we want an empty string instead of null so it plays nicer with bytecode injection } return target; }
String source = generateSourceTargetCorrelation(instrumentationKey, requestContext); requestTelemetry.setSource(source);
String source = generateSourceTargetCorrelation(instrumentationKey, requestContext); requestTelemetry.setSource(source);