/** * @param instrumentationKey The instrumentation key. * @return The applicationId associated with the instrumentation key or null if it cannot be retrieved. */ public String resolveInstrumentationKey(String instrumentationKey) { if (instrumentationKey == null || instrumentationKey.isEmpty()) { throw new IllegalArgumentException("instrumentationKey must be not null or empty"); } try { String appId = this.appIdCache.get(instrumentationKey); if (appId != null) { return appId; } ProfileFetcherResult result = this.profileFetcher.fetchAppProfile(instrumentationKey); appId = processResult(result, instrumentationKey); if (appId != null) { this.appIdCache.putIfAbsent(instrumentationKey, appId); } return appId; } catch (Exception e) { InternalLogger.INSTANCE.error("InstrumentationKeyResolver - failed to resolve instrumentation key: %s => Exception: %s", instrumentationKey, e); InternalLogger.INSTANCE.trace("Stack trace generated is %s", ExceptionUtils.getStackTrace(e)); } return null; }
/** * @param instrumentationKey The instrumentation key. * @return The applicationId associated with the instrumentation key or null if it cannot be retrieved. */ public String resolveInstrumentationKey(String instrumentationKey) { if (instrumentationKey == null || instrumentationKey.isEmpty()) { throw new IllegalArgumentException("instrumentationKey must be not null or empty"); } try { String appId = this.appIdCache.get(instrumentationKey); if (appId != null) { return appId; } ProfileFetcherResult result = this.profileFetcher.fetchAppProfile(instrumentationKey); appId = processResult(result, instrumentationKey); if (appId != null) { this.appIdCache.putIfAbsent(instrumentationKey, appId); } return appId; } catch (Exception e) { InternalLogger.INSTANCE.error("InstrumentationKeyResolver - failed to resolve instrumentation key: %s => Exception: %s", instrumentationKey, e); InternalLogger.INSTANCE.trace("Stack trace generated is %s", ExceptionUtils.getStackTrace(e)); } return null; }