How can you check the value of a metric in vetor.dev unit tests - vector-vrl

When testing Vector log_to_metric transformations, how can a unit test validate the metric count?
I've been able to validate the tags, kind and metric name, but for an incremental metric (a counter), I've not been able to validate the count with:
.counter.value, .counter or .value. All of these come out as null when checked in the unit test VRL.
This is despite the JSON dump in the failed vector test showing a clear value:
output payloads from ["my_event_counter"] (events encoded as JSON):
{"name":"my_event_counter","tags":{"entity":"interesting","system":"my_system"},"timestamp":"2022-09-08T10:30:58.173920Z","kind":"incremental","counter":{"value":1.0}}

Related

Error in Running Multiple Threads with JPOS on JMeter for ISO8583

I am Trying to run My IS08583 Script for Multiple Users using JPOS Plugin. However i could find below Output in the Sampler Result. Can anyone suggest what settings needs to be changed in JPOS for running my Script on Multiple users without this Error. Currently i am running only 2 Threads, in which one thread gives successful Output and Other gives error as mentioned below..
Thread Name: GBM_Transaction
Sample Start: 2020-08-24 15:45:13 IST
Load time: 1
Connect Time: 0
Latency: 0
Size in bytes: 0
Sent bytes:0
Headers size in bytes: 0
Body size in bytes: 0
Sample Count: 1
Error Count: 1
Data type ("text"|"bin"|""): text
Response code:
Response message: org.jpos.iso.ISOException: Duplicate key 'jmeter-2d8b3043-send.120000003938777.req' detected
SampleResult fields:
ContentType:
DataEncoding: null
When sending and receiving multiple request and response messages over the same socket connection,
jPOS needs to match responses (as they may come in in a different order) to requests.
It does that based on keys it generates for each message, e.g. jmeter-2d8b3043-send.120000003938777.req.
The part 120000003938777 is generated (by default) from the fields MTI (1200), DE41 and DE11 (00003 and 938777 presumably).
If your script does not vary those fields e.g. randomly, as suggested, the same key will be generated
for multiple messages and you get that error when jPOS detects the duplicate key.
Obviously, this makes it impossible to unambiguously match responses to requests.
What you can do is:
vary the fields DE41 and/or DE11, or
in case your messages do not contain those fields, define different keys in the "ISO8583 Connection Configuration" under "Mux Key Configuration" and vary those.
The JMeter functions ${__time()} and ${__RandomString()} are quite useful for that.
Refer also https://github.com/jpos/jPOS/blob/master/doc/src/asciidoc/ch08/qmux.adoc#mti-mapping-and-default-key.
Disclaimer: I am the author of the JMeter ISO8583 plugin.

Value cannot be null: Parameter: Source error received from JMeter

I have been receiving this error message on particular request - "Value cannot be null. Parameter name: source".
My Scenario is that 1 user will be transacting 5 transaction (Search and Remit). I'm targeting to run 650 Users to 3250 Transaction. The problem is that one particular request which is getting details from the DB, some data is passed but mostly are the mentioned error message above.
I Have 2 CSV Config, 1 from Users, the 2nd is for the Data where the second csv is inside the Loop Controller.
Your application tells you that the request is not correct, it expects a value and you're failing to provide the value. Use Debug Sampler and View Results Tree listener combination to validate the values of the JMeter Variables which are being sent for successful and not successful requests, it might be a test data issue, for example an extra comma in the CSV file will make CSV Data Set config "think" that this is the delimiter for the next column.

EvaluatorException while Iterating through Performance Timings in ClientSide

I am interested in domload and windowload tried to iterate through(tried both length and size()) the timings array. But it is throwing following error.
2016/06/23 20:07:54 ERROR -
com.googlecode.jmeter.plugins.webdriver.sampler.WebDriverSampler:
sun.org.mozilla.javascript.internal.EvaluatorException: Java class
"com.google.common.collect.Maps$TransformedEntriesMap" has no public
instance field or method named "0". (#8) in at line number 8
For more details please refer here Collecting client side Performance Metrics from Phantomjs through Jmeter

Overwriting Messages with Same Correlation ID and Sequence Number in Spring

Based on my own experiments (can't find this documented anywhere), if 2 messages, having the same correlation ID and sequence number, aggregator will only take the 1st message and discard/ignore the other message.
Is there a way to make aggregator use the last message received instead?
The aggregation will merge the payload into 1 string.
Simple scenario:
3 messages with same correlation ID and sequence size of 2, ordered by time received
sequence#: 1; payload: abc
sequence#: 1; payload: def
sequence#: 2; payload: ghi
Current output: abcghi
Expected output: defghi
This scenario happens when sequence# 2 is missing which is meant for the 1st message. And the correlation ID (obtained from decoded payload) is very limited, hence it will be used multiple times.
Original message
The raw messages came in this format:
"Sequence Size","Sequence Number","ID","Text"
ID ranges between 0-9
example message: 2,1,8,abc
Sample raw message payload:
2,1,8,abc
2,1,8,def
2,2,8,ghi
The aggregator basically combine the text
You need to use a custom release strategy (it can have the same logic as the default SequenceSizeReleaseStrategy, but it can't be that class). With the default strategy duplicate sequences are skipped.
However, you will also need a custom message group store to enact your desired behavior; otherwise the output will be abcdefghi.
However, the discarded message will not be sent to the discard channel in that case.
It's generally not a good idea to reuse correlation id; if you must, then use the group-timeout or a reaper to discard the partial group before any possibility of reuse of the correlation id.
BTW, you might find it easier to use a custom CorrelationStrategy and ReleaseStrategy rather than using the default and manipulating the headers.

BIRT Report processes grid in reverse order in web viewer

I have a BIRT report with 2 datasets Measure that returns a single row name and a number, and Contracts which returns a contract type and a value.
The report is laid out to show the measure and then the list of contracts and values. I want to do a ratio of the contract value to the measure, the whole thing looking like:
MEASURE 1 --- 200
CONTRACT TYPE 1 --- 1000 --- 0.2
CONTRACT TYPE 2 --- 200 --- 1.0
CONTRACT TYPE 3 --- 400 --- 0.5
This is done by setting up a hierarchy in the Report Layout as follows:
+ Report Layout
++ Grid
+++ Table (bound to measure data set, has OnRender trigger that sets global variable for measure name and number)
++ Grid
+++ Table (bound to Contract Type data set)
++++ Cell
+++++ Bound data element with a formula that gets the global variable for the Measure and does the contract value / measure number math
This works exactly as expected when I run the report from the previewer in the Eclipse designer.
When I run on the web viewer, all the ratios are blank.
So I put a logging in the OnRender trigger and the formula to see what the global variables are set to.
When I run in the previewer, I get the following results:
-- measure name global variable - Enrollment
-- measure value global variable - 14000
--- contract ratio cal get measure value -- 14000
--- contract ratio cal get measure value -- 14000
--- contract ratio cal get measure value -- 14000
--- (and so on, one for each contract type row returned.)
When I run in the web viewer, I get the following results
--- contract ratio cal get measure value -- null
--- contract ratio cal get measure value -- null
--- contract ratio cal get measure value -- null
--- (and so on, one for each contract type row returned.
-- measure name global variable - Enrollment
-- measure value global variable - 14000
In other words, in the previewer the top of the report grid cell and data set execute first, and in the web viewer, the order is reversed.
What I'm finding says that execution should happen in the order it appears in the Report Layout hierarchy in the designer. Anyone have any idea what I can do?
Thanks,
Steve
The main difference between a preview and the webviewer is, a preview does not have a specific render step. Technically, a preview is a "RunAndRender" task, when webviewer has two distinct "run" and "render" tasks. This is why sometimes we can see this kind of differences.
As you describe the issue, it seems this global variable is defined in "onRender" script of your measure datafield, but it is consumed by contracts from "onCreate" "onPrepare", or from an expression of an element.
Anyway to solve the problem you would better set this global variable in onCreate script and make it persistent, to be sure it can be consumed from onRender events. To make a global var persistent there are two options:
Report variable: create a report variable in your outline and use it with vars["myVariable"]
old fashion: use reportContext.setPersistentGlobalVariable and reportContext.getPersistentGlobalVariable
It is generally not a good idea to do calculations in the onRender events.
You should move your code to the onCreate events instead.
After reading the information found in this question that discusses the differences between the generation phase and presentation phase in the web viewer, I altered my approach.
I created the global variables in the OnFetch trigger for the dataset, which made them available to include in the data elements placed in the Contract section of my report.
The results now duplicate what was being generated in the previewer.

Resources