Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change thread group label to snake_case #130

Merged
merged 2 commits into from
Jul 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ protected String[] labelValues(SampleEvent event) {
String name = labels[i];
String value = null;

// reserved keyword for the sampler's label (the name)
// reserved keywords for the sampler's label name.
if (name.equalsIgnoreCase("label")) {
value = event.getResult().getSampleLabel();
} else if (name.equalsIgnoreCase("code")) {
// code also reserved
value = event.getResult().getResponseCode();
} else if (name.equalsIgnoreCase("threadGroup")) {
} else if (name.equalsIgnoreCase("thread_group")) {
value = event.getThreadGroup();

// try to find it as a plain'ol variable.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void update(SampleEvent e) {
@Test
public void testKeywords() {
BaseCollectorConfig base = TestUtilities.simpleCounterCfg();
base.setLabels(new String[] {"label","code"});
base.setLabels(new String[] {"label","code", "thread_group"});
ListenerCollectorConfig cfg = new ListenerCollectorConfig(base);

TestUpdater u = new TestUpdater(cfg);
Expand All @@ -42,8 +42,8 @@ public void testKeywords() {
String[] labels = u.labelValues(event);


Assert.assertTrue(labels.length == 2);
Assert.assertArrayEquals(new String[] {"test_label", "204"}, labels);
Assert.assertTrue(labels.length == 3);
Assert.assertArrayEquals(new String[] {"test_label", "204", "test_tg"}, labels);
}

@Test
Expand Down