in elitzur-scio/src/main/scala/com/spotify/elitzur/scio/ElitzurMetrics.scala [33:51]
def getCounter(className: String,
fieldName: String,
validationType: String,
state: CounterTypes.Value): Counter = {
val stateStr = state.toString
val sb =
new JStringBuilder(fieldName.length + 1 + validationType.length + 8 + stateStr.length)
// This method is called very frequently (per-elitzur field per record) and building strings
// the scala way is slower than expected (it seems to create multiple string builders)
val counterName =
sb
.append(fieldName)
.append("/")
.append(validationType)
.append("/Elitzur")
.append(stateStr)
.toString
ScioMetrics.counter(className, counterName)
}