VG
Size: a a a
VG
VG
VG
M
VG
M
K
VG
VG
VG
M
VG
result = new StringBuilder();
status = "Failure";
if (!sampleResult.isSuccessful()) {
result.append("test5,")
.append("label=")
.append(escapeTag(sampleResult.getSampleLabel()))
.append(",status=")
.append(status)
.append(" ")
.append('responsecode="')
.append(escapeValue(sampleResult.getResponseCode()))
.append('",url="')
.append(escapeValue(sampleResult.getUrlAsString()))
.append('",response="')
.append(escapeValue(sampleResult.getResponseMessage()))
.append('" ')
.append(sampleResult.getTimeStamp())
.append("000000");
}
String escapeValue(String val) {
val = val.replaceAll(",", "\\\\,")
.replaceAll(" ", "\\\\ ")
.replaceAll("=", "\\\\=")
.replaceAll("\r\n", " ")
.replaceAll("\n", " ")
.trim();
return val;
}
String escapeTag(String val) {
val = val.replaceAll(",", "\\\\,")
.replaceAll(" ", "_")
.replaceAll("=", "\\\\=")
.replaceAll("\r\n", "_")
.replaceAll("\n", "_")
.trim();
return val;
}
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.util.EntityUtils;
void PostMeasurement(String metric) {
def httpclient = new DefaultHttpClient(new BasicHttpParams());
def httpPost = new HttpPost();
httpPost.setURI(new URI("http://${influx_host}:8086/write?db=jmeter"));
httpPost.setEntity(new StringEntity(metric));
HttpResponse response = httpclient.execute(httpPost);
EntityUtils.consumeQuietly(response.getEntity());
}
if (result.toString()!="") {
PostMeasurement(result.toString());
}
VG
VG
M
KY
KY
KY
KY
KY