示例#1
0
        public MetricManager(ServiceConfiguration configuration)
        {
            Validator.ArgumentNotNullOrEmpty(configuration.MdmAccount, nameof(configuration.MdmAccount));
            Validator.ArgumentNotNullOrEmpty(configuration.MdmMetricNamespace, nameof(configuration.MdmMetricNamespace));

            this.cluster  = configuration.Cluster;
            this.nodeName = configuration.NodeName;

            this.socialLoginSuccessCount = new MetricsFactory(configuration.MdmAccount, configuration.MdmMetricNamespace, "SocialLoginSuccessCount").CreateMeasureMetric(Dimensions);
            this.socialLoginFailedCount  = new MetricsFactory(configuration.MdmAccount, configuration.MdmMetricNamespace, "SocialLoginFailedCount").CreateMeasureMetric(Dimensions);
        }
示例#2
0
        private MetricManager(ServiceConfiguration configuration)
        {
            Validator.ArgumentNotNullOrEmpty(configuration.MdmAccount, nameof(configuration.MdmAccount));
            Validator.ArgumentNotNullOrEmpty(configuration.MdmMetricNamespace, nameof(configuration.MdmMetricNamespace));

            this.cluster  = configuration.Cluster;
            this.nodeName = configuration.NodeName;

            this.requestSuccessCount   = new MetricsFactory(configuration.MdmAccount, configuration.MdmMetricNamespace, "RequestSuccessCount").CreateMeasureMetric(Dimensions);
            this.requestFailed4xxCount = new MetricsFactory(configuration.MdmAccount, configuration.MdmMetricNamespace, "RequestFailed4xxCount").CreateMeasureMetric(Dimensions);
            this.requestFailed5xxCount = new MetricsFactory(configuration.MdmAccount, configuration.MdmMetricNamespace, "RequestFailed5xxCount").CreateMeasureMetric(Dimensions);
            this.requestLatency        = new MetricsFactory(configuration.MdmAccount, configuration.MdmMetricNamespace, "RequestLatency").CreateMeasureMetric(Dimensions);
        }
示例#3
0
        public MetricManager(ServiceConfiguration configuration)
        {
            Validator.ArgumentNotNullOrEmpty(configuration.MdmAccount, nameof(configuration.MdmAccount));
            Validator.ArgumentNotNullOrEmpty(configuration.MdmMetricNamespace, nameof(configuration.MdmMetricNamespace));

            this.cluster  = configuration.Cluster;
            this.nodeName = configuration.NodeName;

            this.sendSuccessCount    = new MetricsFactory(configuration.MdmAccount, configuration.MdmMetricNamespace, MetricSendSuccessCount).CreateMeasureMetric(Dimensions);
            this.sendFailedCount     = new MetricsFactory(configuration.MdmAccount, configuration.MdmMetricNamespace, MetricSendFailedCount).CreateMeasureMetric(Dimensions);
            this.sendTotalCount      = new MetricsFactory(configuration.MdmAccount, configuration.MdmMetricNamespace, MetricSendTotalCount).CreateMeasureMetric(Dimensions);
            this.deliverSuccessCount = new MetricsFactory(configuration.MdmAccount, configuration.MdmMetricNamespace, MetricDeliverSuccessCount).CreateMeasureMetric(Dimensions);
            this.deliverFailedCount  = new MetricsFactory(configuration.MdmAccount, configuration.MdmMetricNamespace, MetricDeliverFailedCount).CreateMeasureMetric(Dimensions);
        }
示例#4
0
        private void LogMetric(IMeasureMetric metric, long count, string engagementAccount, string subscriptionId)
        {
            try
            {
                var errorContext    = default(ErrorContext);
                var dimensionValues = new List <string>
                {
                    this.cluster,
                    this.nodeName,
                    engagementAccount,
                    subscriptionId
                };

                if (!metric.LogValue(count, dimensionValues, errorContext))
                {
                    EmailProviderEventSource.Current.Warning(EmailProviderEventSource.EmptyTrackingId, this, nameof(this.LogMetric), OperationStates.FailedNotFaulting, $"Logging {metric.MetricName} failed. ErrorMessage={errorContext.ErrorMessage} ErrorCode=0x{errorContext.ErrorCode:X}");
                }
            }
            catch (Exception ex)
            {
                EmailProviderEventSource.Current.ErrorException(EmailProviderEventSource.EmptyTrackingId, this, nameof(this.LogMetric), OperationStates.Failed, string.Empty, ex);
            }
        }