in src/Library/TelemetryGenerator.cs [435:471]
private void DetermineInterest(string contextReporterUid, string sourceNamespace, string destinationNamespace, string sourceAppInsightsMonitoringEnabled,
string destinationAppInsightsMonitoringEnabled, out bool isInstanceInteresting, out bool isInstanceFullyWithinTargetArea, out bool isSourceWithinTargetArea,
out bool isDestinationWithinTargetArea)
{
// in order to be interesting to us, the instance must involve at least one workload that is within our target namespace
// the user is also capable of opting a workload in or out of our area of interest by labeling it appropriately
// if there is no target namespace, any workload is considered to be within the target namespace unless it's outside of the cluster
bool sourceIsWithinTargetNamespace = IsNamespaceSpecified(sourceNamespace) &&
(this.targetNamespaces.Length == 0 ||
this.targetNamespaces.Any(ns => string.Equals(sourceNamespace, ns, StringComparison.InvariantCultureIgnoreCase)));
bool destinationIsWithinTargetNamespace = IsNamespaceSpecified(destinationNamespace) && (
this.targetNamespaces.Length == 0 || this.targetNamespaces.Any(ns => string.Equals(destinationNamespace, ns, StringComparison.InvariantCultureIgnoreCase)));
bool sourceIsWithinIgnoredNamespace = this.ignoredNamespaces.Any(ns => string.Equals(sourceNamespace, ns, StringComparison.InvariantCultureIgnoreCase));
bool destinationIsWithinIgnoredNamespace = this.ignoredNamespaces.Any(ns => string.Equals(destinationNamespace, ns, StringComparison.InvariantCultureIgnoreCase));
bool sourceIsPositivelyLabeled = bool.TryParse(sourceAppInsightsMonitoringEnabled, out bool sourceAppInsightsMonitoringEnabledParsed) && sourceAppInsightsMonitoringEnabledParsed;
bool destinationIsPositivelyLabeled = bool.TryParse(destinationAppInsightsMonitoringEnabled, out bool destinationAppInsightsMonitoringEnabledParsed) &&
destinationAppInsightsMonitoringEnabledParsed;
bool sourceIsNegativelyLabeled = bool.TryParse(sourceAppInsightsMonitoringEnabled, out sourceAppInsightsMonitoringEnabledParsed) && !sourceAppInsightsMonitoringEnabledParsed;
bool destinationIsNegativelyLabeled =
bool.TryParse(destinationAppInsightsMonitoringEnabled, out destinationAppInsightsMonitoringEnabledParsed) && !destinationAppInsightsMonitoringEnabledParsed;
bool sourceIsInterestingBasedOnNamespace = sourceIsWithinTargetNamespace && !sourceIsWithinIgnoredNamespace;
bool destinationIsInterestingBasedOnNamespace = destinationIsWithinTargetNamespace && !destinationIsWithinIgnoredNamespace;
bool sourceIsInteresting = sourceIsPositivelyLabeled || sourceIsInterestingBasedOnNamespace && !sourceIsNegativelyLabeled;
bool destinationIsInteresting = destinationIsPositivelyLabeled || destinationIsInterestingBasedOnNamespace && !destinationIsNegativelyLabeled;
isInstanceInteresting = sourceIsInteresting || destinationIsInteresting;
isInstanceFullyWithinTargetArea = sourceIsInteresting && destinationIsInteresting;
isSourceWithinTargetArea = sourceIsInteresting;
isDestinationWithinTargetArea = destinationIsInteresting;
}