コード例 #1
0
        void SendData(string currentURL, string pageTitle, string methodName, IDictionary <string, long> advancedValues)
        {
            // set the data.
            List <string> entryPath = CreatePath(currentURL, pageTitle, conf);
            EntryBuilder  ebNormal  = new EntryBuilder(entryPath, startTime);

            ebNormal.Url = currentURL;

            ebNormal.Status = Statuses.NewStatus(methodName, exception);
            double value = Time.CurrentTimeMillis() - startTime;

            ebNormal.Value = value;
            ebNormal.Unit  = TimerBuilder.DefaultUnit;

            List <Entry> entriesToSend = new List <Entry>();

            entriesToSend.Add(ebNormal.Build());

            foreach (KeyValuePair <string, long> pair in advancedValues.ToList())
            {
                List <string> advancedPath = new List <string>(entryPath);

                string[] pathEntries = pair.Key.Split('/');
                advancedPath.AddRange(pathEntries);

                EntryBuilder ebAdv = new EntryBuilder(advancedPath, startTime);
                ebAdv.Url    = currentURL;
                ebAdv.Status = Statuses.NewStatus(methodName, exception);
                ebAdv.Value  = value;
                ebAdv.Unit   = TimerBuilder.DefaultUnit;
                ebAdv.Value  = pair.Value;

                entriesToSend.Add(ebAdv.Build());
            }

            if (isDebug)
            {
                foreach (Entry entry in entriesToSend)
                {
                    Logger.GetLogger().DebugMessage("Sending entry. URL: " + currentURL + ", Title: " + pageTitle + ", Entry: " + entry);
                }
            }

            // send the data.
            dataExchangeAPIClient.AddEntries(entriesToSend);
        }