Beispiel #1
0
        public Point BuildQueueMetadata(string action, ISendResponse sendResponse, ISenderAgent senderAgent, IQueueCountInfo queueCountInfo)
        {
            var assemblyName = Assembly.GetExecutingAssembly().GetName();

            var tags = new Dictionary <string, object>
            {
                { "counter", "queueCount" },
                { "hostname", Environment.MachineName },
                { "version", assemblyName.Version.ToString() },
                { "application", assemblyName.Name },
                //{ "target", senderAgent.TargetDescription },
                { "isSuccess", sendResponse.IsSuccess },
                { "action", action }
            };

            if (!string.IsNullOrEmpty(sendResponse.Message))
            {
                tags.Add("message", sendResponse.Message);
            }

            var fields = new Dictionary <string, object>
            {
                //{ "value", (decimal)sendResponse.PointCount },
                { "value", (decimal)queueCountInfo.TotalQueueCount },
                { "elapsed", sendResponse.Elapsed.TotalMilliseconds.ToString("0") },
                { "failQueueCount", queueCountInfo.FailQueueCount },
                { "totalQueueCount", queueCountInfo.TotalQueueCount },
                { "queueCount", queueCountInfo.QueueCount },
                { "absoluteAmountDelta", sendResponse.PointCount },
            };

            var point = new Point
            {
                Measurement = MetaMeasurementName,
                Tags        = tags,
                Fields      = fields,
                Precision   = TimeUnit.Milliseconds,
                Timestamp   = DateTime.UtcNow
            };

            return(point);
        }
 internal QueueChangeEventInfo(IQueueCountInfo before, IQueueCountInfo after)
 {
     Before = before;
     After  = after;
 }