public InternalContext getInternal() { if (internal == null) { internal = new InternalContext(tags); } return internal; }
/** * Gets the current operation (typically an HTTP request). * Used to correlate events - for example, exceptions generated while processing a request. * @return The operation. */ public OperationContext getOperation() { if (operation == null) { operation = new OperationContext(tags); } return operation; }
/** * Gets the object describing the role and instnace in the cloud. * @return the cloud context */ public CloudContext getCloud() { if (cloud == null) { cloud = new CloudContext(tags); } return cloud; }
@Test public void testSetRoleName() { ConcurrentHashMap<String, String> map = new ConcurrentHashMap<String, String>(); CloudContext context = new CloudContext(map); final String expected = "mock-role"; context.setRole(expected); assertEquals(expected, context.getRole()); assertEquals(1, map.size()); assertEquals(expected, map.get(ContextTagKeys.getKeys().getCloudRole())); } }
public void setIp(String value) { if (!Strings.isNullOrEmpty(value) && isIPV4(value)) { MapUtil.setStringValueOrRemove(tags, ContextTagKeys.getKeys().getLocationIP(), value); } }
/** * Gets the operation id. * @return Operation id. */ public String getId() { return MapUtil.getValueOrNull(tags, ContextTagKeys.getKeys().getOperationId()); }
/** * Gets a value indicating whether it is the first session. * @return True if first session, false otherwise. */ public Boolean getIsFirst() { return MapUtil.getBoolValueOrNull(tags, ContextTagKeys.getKeys().getSessionIsFirst()); }
/** * Sets the synthetic source. * @param syntheticSource The synthetic source. */ public void setSyntheticSource(String syntheticSource) { MapUtil.setStringValueOrRemove(tags, ContextTagKeys.getKeys().getSyntheticSource(), syntheticSource); } }
/** * Gets the session ID * @return Session ID */ public String getId() { return MapUtil.getValueOrNull(tags, ContextTagKeys.getKeys().getSessionId()); }
/** * Sets a value indicating whether it is a new session. * @param isNewSession A value indicating whether it is a new session. */ public void setIsNewSession(Boolean isNewSession) { MapUtil.setBoolValueOrRemove(tags, ContextTagKeys.getKeys().getSessionIsNew(), isNewSession); } }
/** * Gets the operation name. * @return Operation name. */ public String getName() { return MapUtil.getValueOrNull(tags, ContextTagKeys.getKeys().getOperationName()); }
/** * Set the Operation Parent id * @param parentId */ public void setParentId(String parentId) { MapUtil.setStringValueOrRemove(tags, ContextTagKeys.getKeys().getOperationParentId(), parentId); }
/** * Gets the object describing a user session tracked by this instance. * @return The user's session. */ public SessionContext getSession() { if (session == null) { session = new SessionContext(tags); } return session; }
/** * Gets the object describing the device tracked by this instance. * @return The device. */ public DeviceContext getDevice() { if (device == null) { device = new DeviceContext(tags); } return device; }
/** * Gets the object describing a user tracked by this instance. * @return The user. */ public UserContext getUser() { if (user == null) { user = new UserContext(tags); } return user; }
/** * Gets the object describing the component (application) tracked by this instance. * @return The component. */ public ComponentContext getComponent() { if (component == null) { component = new ComponentContext(tags); } return component; }
/** *Gets the object describing a location tracked by this instance. * @return The location. */ public LocationContext getLocation() { if (location == null) { location = new LocationContext(tags); } return location; }
public ContextTagKeys() { reset(); }
/** * Sets the operation id. * @param id The operation id. */ public void setId(String id) { MapUtil.setStringValueOrRemove(tags, ContextTagKeys.getKeys().getOperationId(), id); }
public void reset() { reset("ContextTagKeys", "com.microsoft.applicationinsights.extensibility.context.ContextTagKeys"); }