MINOR: Use thread name and task for sensor name#5111
Conversation
|
This is a follow up to #5009 that incorrectly changes not only sensor names, but also metric names that should not change. |
|
What do you think about this instead (so we can avoid mutable |
| assertNotNull(metrics.getSensor("name-mock.0_0." + throughputOperation)); | ||
|
|
||
| for (final String opName : latencyOperations) { | ||
| StreamsTestUtils.getMetricByNameFilterByTags(metrics.metrics(), "mock.0_0." + opName + "-latency-avg", groupName, metricTags); |
There was a problem hiding this comment.
L116 and 118 also have changes that should be reverted.
There was a problem hiding this comment.
hmm, I'm not sure about that. Those lines are getting the sensor by name which still uses the combination of thread.name() + taskID + operationName or am I missing something?
There was a problem hiding this comment.
oh! yeah, you're right. Sorry!
vvcephei
left a comment
There was a problem hiding this comment.
Thanks for the patch, @bbejeck.
I'm concerned about the unprotected mutable state this introduces. If multithreaded access to the methods in question occurs, then the task name may be overwritten by the second caller before the first caller creates the sensor name, resulting in incorrect execution.
Also, there is one place where we need to revert a couple more lines from #5009 to return the tests to their original state.
| final Sensor.RecordingLevel recordingLevel, | ||
| final String... tags) { | ||
|
|
||
| return addThroughputSensor(null, |
There was a problem hiding this comment.
I think you meant addLatencyAndThroughputSensor
vvcephei
left a comment
There was a problem hiding this comment.
There's one typo, otherwise LGTM! Thanks again.
guozhangwang
left a comment
There was a problem hiding this comment.
LGTM! Thanks @bbejeck
Changes to keep the operation name as is and make the sensor name unique. Reviewers: John Roesler <john@confluent.io>, Matthias J. Sax <matthias@confluent.io>, Guozhang Wang <wangguoz@gmail.com>
Changes to keep the operation name as is and make the sensor name unique.
Committer Checklist (excluded from commit message)