Esempio n. 1
0
        /// <summary>
        /// Initializes Event belonging to a LibHoney object.
        /// </summary>
        public Event(LibHoney libHoney,
                     IEnumerable <KeyValuePair <string, object> > data, IEnumerable <KeyValuePair <string, Func <object> > > dynFields)
        {
            if (libHoney == null)
            {
                throw new ArgumentNullException(nameof(libHoney));
            }
            if (data == null)
            {
                throw new ArgumentNullException(nameof(data));
            }
            if (dynFields == null)
            {
                throw new ArgumentNullException(nameof(dynFields));
            }

            this.libHoney = libHoney;

            fields.Add(libHoney.Fields);
            fields.Add(data);
            fields.AddDynamic(dynFields);
            fields.EvaluateDynamicFields();  // Evalute all the dynamic fields

            // Stash these values away for Send()
            Timestamp  = DateTime.Now;
            WriteKey   = libHoney.WriteKey;
            DataSet    = libHoney.DataSet;
            ApiHost    = libHoney.ApiHost;
            SampleRate = libHoney.SampleRate;
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes Builder belong to a LibHoney object.
        /// </summary>
        public Builder(LibHoney libHoney,
                       IEnumerable <KeyValuePair <string, object> > data, IEnumerable <KeyValuePair <string, Func <object> > > dynFields)
        {
            if (libHoney == null)
            {
                throw new ArgumentNullException(nameof(libHoney));
            }
            if (data == null)
            {
                throw new ArgumentNullException(nameof(data));
            }
            if (dynFields == null)
            {
                throw new ArgumentNullException(nameof(dynFields));
            }

            this.libHoney = libHoney;

            fields.Add(libHoney.Fields);
            fields.Add(data);
            fields.AddDynamic(dynFields);

            // Stash these values away for Send()
            WriteKey   = libHoney.WriteKey;
            DataSet    = libHoney.DataSet;
            ApiHost    = libHoney.ApiHost;
            SampleRate = libHoney.SampleRate;
        }
Esempio n. 3
0
        /// <summary>
        /// Adds data to the global scope of this LibHoney object. These metrics will
        /// be inherited by all builders and events.
        /// </summary>
        /// <param name="data">Data.</param>
        public void Add(IEnumerable <KeyValuePair <string, object> > data)
        {
            if (data == null)
            {
                throw new ArgumentNullException(nameof(data));
            }

            fields.Add(data);
        }