Comments (3)
You should not construct dynamic JSR 223 snippets within your tests, as those will end up in the metaspace.
What you did is, for every sample, you created a new text snippet. That snippet gets compiled into a groovy (class), which ends up in the metaspace.
The templating syntax ${...}
should be avoided by all means in (groovy) JSR 223 scripts. Those parts get replaced while JMeter runs the test. As you are generating random text for each call of the sampler, you will get a unique script.
Another reason to not use templating inside groovy scripts, is that there is often a faster alternative. For your example, I believe the following snippet would be equivalent:
import org.apache.commons.lang3.RandomStringUtils;
String randomString = RandomStringUtils.randomAlphanumeric(16)
String hexString = randomString.getBytes("UTF-8").encodeHex();
vars.put("trace_id", hexString);
Another possibility would be to work with arguments and place the random bits with the templating syntax into the parameters section of the JSR 223 sampler (or pre-processor).
from jmeter.
Hi,
OOM aside, why do you need that complicated piece of code? You run a JSR223PreProcessor so you have full access to Groovy runtime, there's no need to call the ${__groovy()} function inside again.
I guess you need a unique value to use as trace identifier, this should be enough:
vars.put("trace_id", UUID.randomUUID().toString())
Sample output: ebd7bca8-c365-3b64-8157-11b165df0341
from jmeter.
Hi,
OOM aside, why do you need that complicated piece of code? You run a JSR223PreProcessor so you have full access to Groovy runtime, there's no need to call the ${__groovy()} function inside again.
I guess you need a unique value to use as trace identifier, this should be enough: vars.put("trace_id", UUID.randomUUID().toString()) Sample output: ebd7bca8-c365-3b64-8157-11b165df0341
The format of the trace_id needs to conform to the opentelemetry spec. Its a 32-byte hex string.
I actually switched over to gatling for this load test script. Generating the traceid in scala code directly and its proven stable so I've moved on from this.
Would be interested in someone else being able to re-create the scenario. If I understand the problem just adding the preprocessor with the code I included in this issue should be enough to replicate - don't even need to reference the variable I suspect.
from jmeter.
Related Issues (20)
- 90th percentile response time is showing incorrect in HTML report
- First HTTP request in Thread Group has twice latency than other HTTP request HOT 2
- Bug: The name of a property of the AssertionGui control node is misspelled. HOT 1
- Not able to run jmeter in ubuntu. HOT 1
- ThreadGroup line 273 cloneTree(threadGroupTree),I have setted CSVDataSet with filename,but after cloneTree,my filename was lost HOT 1
- Support HTTPS / TLS to send metrics to influxdb
- Kotlin DSL
- Please implement ScriptingTestElementSchema with 'filename' and 'script' support for Kotlin DSL
- TransactionController (in genearteParentSample=false mode) is not recorded if last sampler in it was com.blazemeter.jmeter.controller.ParallelSampler
- Start on a Controller or Sampler
- Java Implementation not sending `Authorization` and `Host` header HOT 1
- Jmeter starts the server remotely, and the client gets stuck
- When in low memory, threads become almost sequential and many errors occur HOT 1
- Connections reuse issue HOT 2
- Ignore space in path of JMeter HOT 1
- GRPC mTLS request: Problem with client certificates being returned empty
- Headers not send on http CONNECT method
- Why does this setting exist? proxy.headers.remove (Cookie and Authorization are always removed)
- JMeter + Docker
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jmeter.