Skip to content

Commit

Permalink
Change thread group label to snake_case (#130)
Browse files Browse the repository at this point in the history
* use snake_case for thread group label

* add test case for thread_group
  • Loading branch information
johrstrom committed Jul 30, 2023
1 parent b2e1e55 commit f6aa45d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
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
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

0 comments on commit f6aa45d

Please sign in to comment.