public DetailedGrainReport GetDetailedGrainReport(GrainId grain) { var report = new DetailedGrainReport { Grain = grain, SiloAddress = LocalSilo, SiloName = localSiloName, LocalCacheActivationAddress = directory.GetLocalCacheData(grain), LocalDirectoryActivationAddress = directory.GetLocalDirectoryData(grain).Address, PrimaryForGrain = directory.GetPrimaryForGrain(grain) }; try { var properties = this.grainPropertiesResolver.GetGrainProperties(grain.Type); if (properties.Properties.TryGetValue(WellKnownGrainTypeProperties.TypeName, out var grainClassName)) { report.GrainClassTypeName = grainClassName; } } catch (Exception exc) { report.GrainClassTypeName = exc.ToString(); } var activation = activations.FindTarget(grain); report.LocalActivation = activation switch { ActivationData data => data.ToDetailedString(), _ => activation?.ToString() }; return(report); }
public DetailedGrainReport GetDetailedGrainReport(GrainId grain) { var report = new DetailedGrainReport { Grain = grain, SiloAddress = LocalSilo, SiloName = localSiloName, LocalCacheActivationAddresses = directory.GetLocalCacheData(grain), LocalDirectoryActivationAddresses = directory.GetLocalDirectoryData(grain), PrimaryForGrain = directory.GetPrimaryForGrain(grain) }; try { PlacementStrategy unused; string grainClassName; GrainTypeManager.GetTypeInfo(grain.GetTypeCode(), out grainClassName, out unused); report.GrainClassTypeName = grainClassName; } catch (Exception exc) { report.GrainClassTypeName = exc.ToString(); } List<ActivationData> acts = activations.FindTargets(grain); report.LocalActivations = acts != null ? acts.Select(activationData => activationData.ToDetailedString()).ToList() : new List<string>(); return report; }