Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*--------------------------------------------------------------------------
* Copyright (c) 2010-2020, Elon.su All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the elon developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Elon.su, you can also mail [email protected]
*--------------------------------------------------------------------------
*/
package com.github.dennisit.vplus.data.metric.pipeline;
import com.alibaba.fastjson.JSON;
import com.github.dennisit.vplus.data.criteria.RetryCriteria;
import com.github.dennisit.vplus.data.metric.JMetricCollector;
import com.github.dennisit.vplus.data.metric.JMetricPipeline;
import com.github.dennisit.vplus.data.criteria.action.RetryAction;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;
import java.util.List;
import java.util.Map;
import java.util.Optional;
/**
* Created by Elon.su on 17/11/2.
*/
public class FalconPipeline implements JMetricPipeline {
private static final Logger LOG = LoggerFactory.getLogger(FalconPipeline.class);
public static final String DEFAULT_AGENT_URL = "http://127.0.0.1:1988/v1/push";
private String httpUrl;
private String endpoint;
private String tags;
private int step;
private static RestTemplate template;
static {
template = new RestTemplate();
}
public FalconPipeline() {
}
public FalconPipeline(String endpoint, String tags, int step) {
this(DEFAULT_AGENT_URL, endpoint, tags, step);
}
public FalconPipeline(String httpUrl, String endpoint, String tags, int step) {
this.endpoint = endpoint;
this.tags = tags;
this.step = step;
this.httpUrl = httpUrl;
}
@Override
public void initialized() {
}
@Override
public void pipeline(JMetricCollector collector, String key, Object value, long milliseconds) {
FalconMeta meta = builder(key, value, milliseconds);
RetryAction.doWithTry(new RetryCriteria