public MetricWrapper(ExecutionContext context, List <Dimension> dimensions, String authToken) { int timeoutMs = 300; //default timeout 300ms try { timeoutMs = Int32.Parse(GetEnvironmentVariable(TIMEOUT_MS)); } catch (Exception e) { //ignore and use default timeout } // create endpoint SignalFxAzureFuncEndpoint signalFxEndpoint = new SignalFxAzureFuncEndpoint(); // create reporter with endpoint reporter = new SignalFxReporter(signalFxEndpoint.ToString(), authToken, timeoutMs); // get default dimensions defaultDimensions = GetDefaultDimensions(context); // set wrapper singleton context MetricSender.setWrapper(this); watch = System.Diagnostics.Stopwatch.StartNew(); sendMetricCounter(METRIC_NAME_INVOCATIONS, MetricType.COUNTER); }
private void sendMetric(string metricName, MetricType metricType, Datum datum) { DataPoint dp = new DataPoint(); dp.metric = METRIC_NAME_PREFIX + metricName; dp.metricType = metricType; dp.value = datum; MetricSender.sendMetric(dp); }