Exemplo n.º 1
0
        public override Response pushMetrics(MetricBuilder builder, ExpectResponse expectResponse)
        {
            if (builder == null)
            {
                throw new Exception("QueryBuilder 不能为空");
            }

            SimpleHttpResponse response = httpClient.doPost(buildUrl(serviceUrl, PUT_POST_API, expectResponse),
                                                            builder.build());

            return(getResponse(response));
        }
Exemplo n.º 2
0
        /**
         * 写入数据 * * @param metric 指标 * @param timestamp 转化为秒的时间点 * @param value * @param tagMap * @return * @throws Exception
         */
        private bool putData(string metric, long timestamp, object value, Dictionary <string, string> tagMap)
        {
            MetricBuilder builder = MetricBuilder.getInstance();

            builder.addMetric(metric).setDataPoint(timestamp, value).addTags(tagMap);
            try
            {
                log.Info("write quest:" + builder.build());
                Response response = httpClient.pushMetrics(builder, ExpectResponse.SUMMARY);
                log.Info("response.statusCode: " + response.getStatusCode());
                return(response.isSuccess());
            }
            catch (Exception e)
            {
                log.Error(e);
                throw e;
            }
        }
Exemplo n.º 3
0
 /**
  * Sends metrics from the builder to the KairosDB server.
  *
  * @param builder
  *            metrics builder
  * @return response from the server
  * @throws IOException
  *             problem occurred sending to the server
  */
 public abstract Response pushMetrics(MetricBuilder builder);
Exemplo n.º 4
0
 public override Response pushMetrics(MetricBuilder builder)
 {
     return(pushMetrics(builder, ExpectResponse.STATUS_CODE));
 }
Exemplo n.º 5
0
 public abstract Response pushMetrics(MetricBuilder builder,
                                      ExpectResponse exceptResponse);