示例#1
0
        public void AddMetric(string ns, bool value, params Modifier[] modifiers)
        {
            var nativeValue = new NativeValue
            {
                v_bool = value ? 1 : 0,
                vtype  = (int)ValueType.TypeBool
            };

            AddMetricWithNativeValue(ns, nativeValue, modifiers);
        }
示例#2
0
        public void AddMetric(string ns, string value, params Modifier[] modifiers)
        {
            var nativeValue = new NativeValue
            {
                v_cstring = Marshal.StringToHGlobalAnsi(value),
                vtype     = (int)ValueType.TypeCString
            };

            AddMetricWithNativeValue(ns, nativeValue, modifiers);
        }
示例#3
0
        public void AddMetric(string ns, double value, params Modifier[] modifiers)
        {
            var nativeValue = new NativeValue
            {
                v_double = value,
                vtype    = (int)ValueType.TypeDouble
            };

            AddMetricWithNativeValue(ns, nativeValue, modifiers);
        }
示例#4
0
        public void AddMetric(string ns, uint value, params Modifier[] modifiers)
        {
            var nativeValue = new NativeValue
            {
                v_uint64 = value,
                vtype    = (int)ValueType.TypeUint64
            };

            AddMetricWithNativeValue(ns, nativeValue, modifiers);
        }
示例#5
0
        private void AddMetricWithNativeValue(string ns, NativeValue nativeValue, params Modifier[] modifiers)
        {
            var nativeModifiers = ToNativeModifiers(modifiers);
            var errPtr          = CBridge.ctx_add_metric(TaskId, ns, nativeValue, nativeModifiers);

            Memory.FreeNativeModifiers(nativeModifiers);
            if (nativeValue.vtype == (int)ValueType.TypeCString)
            {
                Marshal.FreeHGlobal(nativeValue.v_cstring);
            }

            Exceptions.ThrowExceptionIfError(errPtr);
        }
示例#6
0
        internal static IntPtr /* NativeError */
        ctx_add_metric(string taskId, string ns, NativeValue nativeValue, NativeModifiers nativeModifiers)
        {
            if (IsWindows())
            {
                return(CBridgeWin.ctx_add_metric(taskId, ns, nativeValue, nativeModifiers));
            }

            if (IsLinux())
            {
                return(CBridgeLinux.ctx_add_metric(taskId, ns, nativeValue, nativeModifiers));
            }

            throw new NotImplementedException(NoImplementedError);
        }
示例#7
0
 internal static extern IntPtr /* NativeError */
 ctx_add_metric(string taskId, string ns, NativeValue nativeValue, NativeModifiers nativeModifiers);