Skip to content

Commit

Permalink
fix(metrics): strip the provider's package name in agent metrics (#3920)
Browse files Browse the repository at this point in the history
Long tag values can cause issues for some time series systems. The
caching agents in particular are a bit too generous, as the provider
name often includes the full package path (typically 50-60 chars that
don't provide much value).
  • Loading branch information
dreynaud authored and ajordens committed Aug 6, 2019
1 parent d359e53 commit ca4943c
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,13 @@ class MetricInstrumentation implements ExecutionInstrumentation {
counterId = registry.createId('executionCount').withTag('className', MetricInstrumentation.simpleName)
}

private static String stripPackageName(String className) {
return className.substring(className.lastIndexOf(".")+1)
}

private static String agentName(Agent agent) {
"$agent.providerName/$agent.agentType"
String simpleProviderName = stripPackageName(agent.providerName)
"$simpleProviderName/$agent.agentType"
}

@Override
Expand Down

0 comments on commit ca4943c

Please sign in to comment.