Skip to content

Commit

Permalink
Delay option override for later usage
Browse files Browse the repository at this point in the history
  • Loading branch information
yohfee committed Nov 20, 2024
1 parent f3bb834 commit 23b1c54
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions mackerel-plugin-jvm/lib/jvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,15 @@ func (m JVMPlugin) FetchMetrics() (map[string]interface{}, error) {
// GraphDefinition interface for mackerelplugin
func (m JVMPlugin) GraphDefinition() map[string]mp.Graphs {
labelPrefix := m.LabelPrefix
lowerJavaName := strings.ToLower(m.Prefix)
if labelPrefix == "" {
labelPrefix = m.JavaName
}

lowerJavaName := m.Prefix
if lowerJavaName == "" {
lowerJavaName = m.JavaName
}
lowerJavaName = strings.ToLower(lowerJavaName)

return map[string]mp.Graphs{
fmt.Sprintf("jvm.%s.gc_events", lowerJavaName): {
Expand Down Expand Up @@ -414,16 +422,8 @@ func Do() {
}

jvm.JavaName = *optJavaName

jvm.Prefix = *optKeyPrefix
if jvm.Prefix == "" {
jvm.Prefix = jvm.JavaName
}

jvm.LabelPrefix = *optLabelPrefix
if jvm.LabelPrefix == "" {
jvm.LabelPrefix = jvm.JavaName
}

helper := mp.NewMackerelPlugin(jvm)
helper.Tempfile = *optTempfile
Expand Down

0 comments on commit 23b1c54

Please sign in to comment.