Beispiel #1
0
        private void tmr_Tick(object sender, EventArgs e)
        {
            if (m_SendGauge)
            {
                var gShard = new GDID();
                var gUser  = new GDID();

                var bUser    = cbUserEntity.Checked;
                var bProduct = cbProductEntity.Checked;

                if (bUser)
                {
                    var age       = tbAge.Text;
                    var sex       = tbSex.Text;
                    var country   = tbCountry.Text;
                    var userDim   = "{age:'" + age + "', sex:'" + sex + "', country:'" + country + "'}";
                    var userValue = tbUserValue.Text.AsLong();
                    SocialTrendingGauge.Emit("user", gShard, gUser, userValue, userDim);
                }

                if (bProduct)
                {
                    var product      = "{size:'" + tbSize.Text + "', color:'" + tbColor.Text + "'}";
                    var productValue = tbProductValue.Text.AsLong();
                    SocialTrendingGauge.Emit("product", gShard, gUser, productValue, product);
                }
            }
        }
Beispiel #2
0
 /// <summary>
 /// Saves gauge in volume
 /// This method does not leak
 /// This method is NOT thread-safe
 /// </summary>
 public void WriteGauge(SocialTrendingGauge gauge)
 {
     try
     {
         if (!Running)
         {
             return;
         }
         DoWriteGauge(gauge);
     }
     catch (Exception e)
     {
         Log(MessageType.Error, "WriteGauge", e.ToMessageWithType(), e);
     }
 }
Beispiel #3
0
        protected override void DoWriteGauge(SocialTrendingGauge gauge)
        {
            var date = RoundDatePerDetalization(App.TimeSource.UTCNow, DetalizationLevel);

            var update = m_DBUpdates[gauge.Entity];

            if (update == null)
            {
                throw new MongoSocialException(StringConsts.TRENDING_GAUSE_UNKNOWN_ENTITY_ERROR.Args(gauge.Entity, nameof(DoWriteGauge)));
            }

            update.G_Entity   = gauge.G_Entity;
            update.G_Shard    = gauge.G_Shard;
            update.DateTime   = date;
            update.Value      = gauge.Value;
            update.Count      = gauge.Count;
            update.Dimensions = TrendingHost.MapGaugeDimensions(gauge.Entity, gauge.Dimensions);

            var collection = m_Database[gauge.Entity];
            var r          = collection.Update(update.MongoUpdateEntry);
            //Log(NFX.Log.MessageType.Debug  , "MongoDBVolume.DoWriteGauge", gauge.Entity+ " : " + r.ToJSON(JSONWritingOptions.PrettyPrint));
        }
Beispiel #4
0
 protected abstract void DoWriteGauge(SocialTrendingGauge gauge);