JMeter JSR233 result to dashboard - java

I have a JMeter test that insert an input via an HTTP call to an asynchronous java-service and then collects an exposed metric on another java-service via a groovy script.
The script then saves the collected metric as a JMeter variable to be reviewed as a performance metric.
I would like to publish this value inside the JMeter -generated dashboard but I can't find a way to save this variable as a JMeter output.
Is there a way? seems JMeter is primarily aimed to test HTTP synchronous services but it's capable of doing such collection of data.

You can use variable(s) in custom graph definitions:
You can graph any sample_variable in CSV over time, you can customize your graphs by settings their properties in the user.properties file.
They must use the id prefix custom_:
jmeter.reportgenerator.graph.custom_<your_graph_name_id>.property.<your_option_name>
To specify that this graph is a customized one :
jmeter.reportgenerator.graph.custom_<your_graph_name_id>.classname=org.apache.jmeter.report.processor.graph.impl.CustomGraphConsumer
Here is an example of a custom graph configuration that graphs the variable ts-hit:
jmeter.reportgenerator.graph.custom_testGraph.classname=org.apache.jmeter.report.processor.graph.impl.CustomGraphConsumer
jmeter.reportgenerator.graph.custom_testGraph.title=Chunk Hit
jmeter.reportgenerator.graph.custom_testGraph.property.set_Y_Axis=Number of Hits
jmeter.reportgenerator.graph.custom_testGraph.set_X_Axis=Over Time
jmeter.reportgenerator.graph.custom_testGraph.property.set_granularity=60000
jmeter.reportgenerator.graph.custom_testGraph.property.set_Sample_Variable_Name=ts-hit
jmeter.reportgenerator.graph.custom_testGraph.property.set_Content_Message=Number of Hits :

Declare the JMeter Variable you're saving in the JSR223 script as a Sample Variable, in order to do this add the next line to user.properties file:
sample_variables=foo
Then you can configure your custom chart like:
jmeter.reportgenerator.graph.custom_testGraph.classname=org.apache.jmeter.report.processor.graph.impl.CustomGraphConsumer
jmeter.reportgenerator.graph.custom_testGraph.title=Your custom chart title
jmeter.reportgenerator.graph.custom_testGraph.property.set_Y_Axis=Your Y axis name
jmeter.reportgenerator.graph.custom_testGraph.set_X_Axis=Over Time
jmeter.reportgenerator.graph.custom_testGraph.property.set_granularity=60000
jmeter.reportgenerator.graph.custom_testGraph.property.set_Sample_Variable_Name=foo
jmeter.reportgenerator.graph.custom_testGraph.property.set_Content_Message=Your custom content message
replace foo with the actual JMeter Variable name of your choice and next time you generate HTML reporting dashboard you should see your variable values plotted over time
More information:
Reporting configuration
Apache JMeter Properties Customization Guide

Related

JMeter Dashboard HTML Report - exclude completely unwanted requests

My test has 20 requests, but 5 of them I've excluded using filter jmeter property:
jmeter.reportgenerator.exporter.html.series_filter
However the dashboard still counts the metrics in table headers:
Is it possible to fix this?
If you want to completely remove the "unwanted" results it's better to remove them from the .jtl file.
The options are in:
Add JSR223 PostProcessor as a child of the request(s) you don't "want" to see and put the following Groovy code into "Script" area:
prev.setIgnore()
where prev stands for previous SampleResult
Use Filter Results Tool which has --include-labels and --exclude-labels parameters allowing you to specify what needs to be included or excluded from the .jtl results file.

How to get vm creation time from the machine's properties

I'm using vijava (5.1) to fetch data from a vCenter about virtual machines.
For that matter I'm using a filter with some properties (for example, guest.hostName, runtime.powerState etc.).
I need to get the creation time for these virtual machines and from what I saw, this info is available in the event logs of the vCenter.
Is there a way to get this info part of the virtual machine's properties?
I searched this info using the vSphere-Client and I didn't - so I guess the only place is from the event logs - but just to be sure, is that the only way?
Thanks
It is hard to get creation time of virtual machine using vijava api. However you can get other below informations from VirtualMachineConfigInfo.
changeVersion : The changeVersion is a unique identifier for a given version of the configuration. Each change to the configuration updates this value. This is typically implemented as an ever increasing count or a time-stamp. However, a client should always treat this as an opaque string.
modified : Last time a virtual machine's configuration was modified.
Folder rootFolder = serviceInstance.getRootFolder();
InventoryNavigator inventoryNavigator = new InventoryNavigator(rootFolder);
vm = (VirtualMachine) inventoryNavigator.searchManagedEntity(VirtualMachine.class.getSimpleName(), vmName);
VirtualMachineConfigInfo vmConfig = vm.getConfig();
System.out.println(vmConfig.getChangeVersion);
image for information in virtualMachineConfigInfo object
Unless you set the creation time as an extra config property then the event log is the only way I know of. If you want to go the extra config route I created a sample that shows how to use them that is part of the pyvmomi-community-samples project.

How to dynamically pass filename to tFTPRename in Talend?

I currently have a job that works like this:
tPrejob-->tOracleConnection1--->tOracleConnection2--->tSetGlobalVar1(timestamp)--->tRunjob(runs prejob to gather file from FTP)
Then there is a tPostjob that is supposed to rename the processed file on the FTP server.
tPostjob--->tFTPRename
It should be renaming the file with "File Processed On " + ((String)globalMap.get("timestamp")) + "This is where I would put the orginal file name"
If I put a standard filename into the Filemask then it will run correctly, however if I try to make the filemask dynamic by passing the filename into it through globalMap.get then I get the Error:
"Exception in component tFTPRename_1 java.lang.NullPointerException"
I've tried several methods for passing the file name into the tFTPRename component, but none are working.
I'm currently capturing the file name in the subjob and outputting it to a txt file and then using tFileInputFullRow on the main job to create that variable. I tried passing this into a tSetGlobalVar and then adding it into the filemask as ((String)globalMap.get("FileName")), but had no luck.
I also tried several methods on the internet, but none of them worked, so I wasn't sure if it was me or if it has something to do with tFTPRename capabilities.
Main Job:
PreJob:
tFTPRename Component:
tFileInputFullRow:
It sounds like you're using the globalMap wrong at some point which would certainly explain the null pointer exception as the globalMap variable doesn't appear to have been set.
Typically the tSetGlobalVar component is for setting static or run time generated variables into the globalMap and I don't think you can actually pass data into it that it can then directly use and push to the globalMap. Your datetime stamp is a good use of the component but you'll need to either use a tFlowToIterate component or use a tJava(Row) component to force the data into the globalMap using something like:
globalMap.put("fileName",inputrow.fileName);
Looking at your previous question then you should have the name of the file from the FTP in the job you are calling in your pre job. Typically here you would be able to then run that as part of the main flow into a tBufferOutput component and then read the data directly into the parent job (simply connect a main flow connector from the tRunJob component to the next component you want to process the data flow and don't forget to give the tRunJob component the same schema as your child job's tBufferOutput).
However, you have a complication here in that you have already used the buffer to capture all of the iterables from the tFTPList component so you're right in the fact that you need to go to a temporary flat file or database to push the state back to the parent job.
From here though you should be able to read in the flat file or database table that contains the field name in your parent job and then run for ease you can just connect this to a tFlowToIterate component which will then store that data in the globalMap (you should have 1 row and 1 column of data here so it's a single variable).
Here's a basic example of running some hard coded data in a tFixedFlowInput to a tFlowToIterate to get it into the globalMap and then retrieve it again with another tFixedFlowInput component:
Once the data is in the tFlowToIterate component then you can easily call it with globalMap.get(rowName.schemaColumnName) or by hitting ctrl+space and selecting it under the tFlowToIterate component:

neo4j java rest binding api not returning from getNodeAutoIndexer

I have an application which uses neo4j embedded database. Now, I want to migrate to neo4j server as I need to integrate this application with a web app (using servlets, tomcat).
I want to change the code minimally, So I thought of using java-rest-binding api of neo4j. But I am stuck at getting the auto node index. The method getAutoNodeIndexer doesn't return. In messages.log of the database, It shows
[o.n.k.EmbeddedGraphDatabase]: GC Monitor: Application threads blocked for an additional 254ms [total block time: 2.678s]
I have no idea how to solve this.
I have set the appropriate properties in the neo4j.properties, which are
node_auto_indexing=true
node_keys_indexable=primaryKey
relationship_auto_indexing=true
relationship_keys_indexable=X-->Y
And this is what my code looks like:
graphDb = new RestGraphDatabase("http://localhost:7474/db/data/");
ReadableIndex<Node> autoNodeIndex = graphDb.index().getNodeAutoIndexer().getAutoIndex();
ReadableRelationshipIndex autoRelIndex = graphDb.index().getRelationshipAutoIndexer().getAutoIndex();
It seems that there's a lot of garbage collection going on. Run your app with a bigger heap (e.g. -Xmx1g) and see what happens.
EDIT:
Also, relationship_keys_indexable=X-->Y seems strange. I'd expect a property name there. What happens if you remove this property or enter a valid value?
To state the official documentation:
The node_keys_indexable key allows you to specify a comma-separated
list of node property keys to be indexed. The
relationship_keys_indexable does the same for relationship property
keys.

Error creating queue with WebSphere MQ API

I trying to create queues using PCF command in the WebSphere API as detailed in $MQM_HOME/samp/pcf/samples/PCF_CreateQeue.java. The creation fails when i add a description
command.addParameter(PCFConstants.MQCA_Q_DESC, "Created using MQMonitor");
I get the error: com.ibm.mq.pcf.PCFException: MQJE001: Completion Code 2, Reason 3015 : MQRCCF_CFST_PARM_ID_ERROR
Is there another way of setting the description, i'm using version 6 of the API.
The Commands page in the PCF manual states that:
The required parameters and the
optional parameters are listed. On
platforms other than z/OSĀ®, the
parameters must occur in the order:
All required parameters, in the order stated, followed by
Optional parameters as required, in any order, unless specifically
noted in the PCF definition.
The section Change, Copy and Create Queue lists the required parameters in the following order:
MQCA_Q_NAME
MQIA_Q_TYPE
Optional parameters, including QDesc
The same manual provides required parameters and their order for all PCF commands so no need to play hide-and-seek trying out parms and orders in the future.
It turns out the addParameter on the PCFMessage should in a certain sequence (stumbled on it). If i change the add parameters if works. This is not just for creating queues, but for channels as well.
command.addParameter(PCFConstants.MQCA_Q_NAME, qname);
command.addParameter(PCFConstants.MQIA_Q_TYPE, PCFConstants.MQQT_LOCAL);
command.addParameter(PCFConstants.MQCA_Q_DESC, qdesc);
command.addParameter(PCFConstants.MQIA_DEF_PERSISTENCE, PCFConstants.MQPER_PERSISTENT);
the above will execute without error.
command.addParameter(PCFConstants.MQCA_Q_NAME, qname);
command.addParameter(PCFConstants.MQCA_Q_DESC, qdesc);
command.addParameter(PCFConstants.MQIA_Q_TYPE, PCFConstants.MQQT_LOCAL);
command.addParameter(PCFConstants.MQIA_DEF_PERSISTENCE, PCFConstants.MQPER_PERSISTENT);
the above will fail after moving around the description.
I haven't seen it documented in the Java docs, and if thats the case i looks forward to some hide and seek.

Categories