Ejemplo n.º 1
0
        private MeasureMetric10D CreateMetric(IAdxMetric metric)
        {
            ErrorContext     errorContext = new ErrorContext();
            MeasureMetric10D instance     = MeasureMetric10D.Create(
                this._mdmAccountName,
                this._mdmNamespace,
                metric.MetricName,
                MdmDimensionNames.Geo,
                MdmDimensionNames.Tenant,
                MdmDimensionNames.Role,
                MdmDimensionNames.RoleInstance,
                MdmDimensionNames.Org,
                MdmDimensionNames.PortalType,
                MdmDimensionNames.PortalId,
                MdmDimensionNames.PortalApp,
                MdmDimensionNames.PortalUrl,
                MdmDimensionNames.PortalVersion,
                ref errorContext);

            if (errorContext.ErrorCode != 0)
            {
                MetricsReportingEvents.Instance.MetricReportingFailed(metric.MetricName, "CreateMetric failed: " + errorContext.ErrorMessage);
            }

            return(instance);
        }
Ejemplo n.º 2
0
        public void LogValueForMetric(IAdxMetric metric, long rawValue)
        {
#if CLOUDINSTRUMENTATION
            if (this._initializationFailed)
            {
                return;
            }
            var ifxMetric = _metricsCache.GetOrAdd(metric, this.CreateMetric);

            try
            {
                ErrorContext errorContext = new ErrorContext();
                ifxMetric.LogValue(rawValue, this._geo, this._tenant, this._role, this._roleInstance, this._org, this._portalType, this._portalId, this._portalApp, this._portalUrl, this._portalVersion, ref errorContext);
                if (errorContext.ErrorCode != 0)
                {
                    MetricsReportingEvents.Instance.MetricReportingFailed(metric.MetricName, "LogValue failed: " + errorContext.ErrorMessage);
                }
            }
            catch (Exception ex)
            {
                if (ex is ThreadAbortException || ex is OutOfMemoryException)
                {
                    throw;
                }
                MetricsReportingEvents.Instance.MetricReportingFailed(metric.MetricName, ex.ToString());
            }
#endif
        }
Ejemplo n.º 3
0
 public bool Equals(IAdxMetric other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(string.Equals(this.MetricName, other.MetricName));
 }