public Metric9DWrapper( string mdmAccountName, string mdmNamespace, string metricName, string dimension1Name, string dimension2Name, string dimension3Name, string dimension4Name, string dimension5Name, string dimension6Name, string dimension7Name, string dimension8Name, string dimension9Name) { if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { this.metric = MeasureMetric9D.Create( mdmAccountName, mdmNamespace, metricName, dimension1Name, dimension2Name, dimension3Name, dimension4Name, dimension5Name, dimension6Name, dimension7Name, dimension8Name, dimension9Name, addDefaultDimension: true); } }
internal MetricsEmitter(IInternalServiceConfiguration config, TraceWriterWrapper traceWriter) { this.config = Guard.IsNotNull(config, nameof(config)); this.trace = Guard.IsNotNull(traceWriter, nameof(traceWriter)); var mdmAccount = config.MdmAccountName; var mdmNamespace = config.MdmNamespace; if (string.IsNullOrEmpty(mdmAccount) || string.IsNullOrEmpty(mdmNamespace)) { this.trace.WriteError("MetricsEmitter: MdmAccount or Namespace value is empty in configuration. Disabling metrics."); this.isMetricsEnabled = false; return; } ErrorContext mdmError = new ErrorContext(); DefaultConfiguration.SetDefaultDimensionNamesValues( ref mdmError, 1, new[] { "DataCenter" }, new[] { this.config.DataCenter }); this.clusterHealthMetric = MeasureMetric2D.Create(mdmAccount, mdmNamespace, "ClusterHealthState", ClusterNameDimension, HealthStateDimension); this.appHealthMetric = MeasureMetric3D.Create(mdmAccount, mdmNamespace, "AppHealthState", ClusterNameDimension, AppNameDimension, HealthStateDimension); this.nodeHealthMetric = MeasureMetric3D.Create(mdmAccount, mdmNamespace, "NodeHealthState", ClusterNameDimension, NodeNameDimension, HealthStateDimension); this.serviceHealthMetric = MeasureMetric4D.Create(mdmAccount, mdmNamespace, "ServiceHealthState", ClusterNameDimension, AppNameDimension, ServiceNameDimension, HealthStateDimension); this.partitionHealthMetric = MeasureMetric5D.Create(mdmAccount, mdmNamespace, "PartitionHealthState", ClusterNameDimension, AppNameDimension, ServiceNameDimension, PartitionIdDimension, HealthStateDimension); this.replicaHealthMetric = MeasureMetric6D.Create(mdmAccount, mdmNamespace, "ReplicaHealthState", ClusterNameDimension, AppNameDimension, ServiceNameDimension, PartitionIdDimension, ReplicaIdDimension, HealthStateDimension); this.deployedAppHealthMetric = MeasureMetric4D.Create(mdmAccount, mdmNamespace, "DeployedApplicationHealthState", ClusterNameDimension, AppNameDimension, NodeNameDimension, HealthStateDimension); this.deployedServicePackageHealthMetric = MeasureMetric5D.Create(mdmAccount, mdmNamespace, "DeployedServicePackageHealthState", ClusterNameDimension, AppNameDimension, ServiceNameDimension, NodeNameDimension, HealthStateDimension); this.clusterHealthEventMetric = MeasureMetric5D.Create(mdmAccount, mdmNamespace, "ClusterHealthEvent", ClusterNameDimension, HealthStateDimension, SourceDimension, PropertyDimension, IsExpiredDimension); this.appHealthEventMetric = MeasureMetric6D.Create(mdmAccount, mdmNamespace, "AppHealthEvent", ClusterNameDimension, AppNameDimension, HealthStateDimension, SourceDimension, PropertyDimension, IsExpiredDimension); this.nodeHealthEventMetric = MeasureMetric6D.Create(mdmAccount, mdmNamespace, "NodeHealthEvent", ClusterNameDimension, NodeNameDimension, HealthStateDimension, SourceDimension, PropertyDimension, IsExpiredDimension); this.serviceHealthEventMetric = MeasureMetric7D.Create(mdmAccount, mdmNamespace, "ServiceHealthEvent", ClusterNameDimension, AppNameDimension, ServiceNameDimension, HealthStateDimension, SourceDimension, PropertyDimension, IsExpiredDimension); this.partitionHealthEventMetric = MeasureMetric8D.Create(mdmAccount, mdmNamespace, "PartitionHealthEvent", ClusterNameDimension, AppNameDimension, ServiceNameDimension, PartitionIdDimension, HealthStateDimension, SourceDimension, PropertyDimension, IsExpiredDimension); this.replicaHealthEventMetric = MeasureMetric9D.Create(mdmAccount, mdmNamespace, "ReplicaHealthEvent", ClusterNameDimension, AppNameDimension, ServiceNameDimension, PartitionIdDimension, ReplicaIdDimension, HealthStateDimension, SourceDimension, PropertyDimension, IsExpiredDimension); this.deployedAppHealthEventMetric = MeasureMetric7D.Create(mdmAccount, mdmNamespace, "DeployedApplicationHealthEvent", ClusterNameDimension, AppNameDimension, NodeNameDimension, HealthStateDimension, SourceDimension, PropertyDimension, IsExpiredDimension); this.deployedServicePackageHealthEventMetric = MeasureMetric8D.Create(mdmAccount, mdmNamespace, "DeployedServicePackageHealthEvent", ClusterNameDimension, AppNameDimension, ServiceNameDimension, NodeNameDimension, HealthStateDimension, SourceDimension, PropertyDimension, IsExpiredDimension); this.trace.WriteInfo("MetricsEmitter: Initialized Service Fabric MDM metrics. AccountName: {0}, namespace: {1}", mdmAccount, mdmNamespace); }