示例#1
0
        private void LogKPIs()
        {
            var kpis = new Dictionary <string, object>();

            foreach (var kpiPropName in new List <string> {
                nameof(EventsSentSinceStart), nameof(PendingEvents), nameof(EventsSentErrorCountSinceStart),
                nameof(LastSendTime), nameof(LastSendAttemptTime),
            })
            {
                kpis.Add(kpiPropName, TheThing.GetSafeProperty(MyBaseThing, kpiPropName));
            }
            var message = new TSM(strPrometheusExporter, "Prometheus Exporter KPIs", eMsgLevel.l4_Message, TheCommonUtils.SerializeObjectToJSONString(kpis));

            TheBaseAssets.MySYSLOG.WriteToLog(95013, TSM.L(eDEBUG_LEVELS.OFF) ? null : message);
            if (!String.IsNullOrEmpty(KPIPublishPropertyName))
            {
                foreach (var senderThing in MySenderThings.MyMirrorCache.TheValues)
                {
                    TheThing.SetSafeProperty(senderThing.GetThing(), KPIPublishPropertyName, new TSMObjectPayload(message, kpis), ePropertyTypes.NOCHANGE); // CODE REVIEW: OK to put an entire message here? This will be serialized to JSON properly, but...
                }
            }
        }