jj
Size: a a a
jj
AG
AL
KY
KY
c
c
jj
v
AL
jj
ВС
ВС
ВС
responseCode !~ /^$/
responseCode <> ''
KY
result = new StringBuilder();
def Tag = "${__groovy(def Tag1 = '${__dateTimeConvert(${__P(TESTSTART.MS)},,dd-MM-yy_HH:mm,)}'; return Tag1;)}"
status = "Failure";
if (!sampleResult.isSuccessful()) {
result.append("test9,")
.append("label=")
.append(escapeTag(sampleResult.getSampleLabel()))
.append(',application=')
.append("${project_name}")
.append(',testRun=')
.append(Tag + '\\\\ ${custom_duration}')
.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());
}
ВС
KY
AG
KY