netdata/netdata

View on GitHub
src/go/collectors/go.d.plugin/modules/proxysql/charts.go

Summary

Maintainability
D
2 days
Test Coverage

File charts.go has 683 lines of code (exceeds 500 allowed). Consider refactoring.
Open

// SPDX-License-Identifier: GPL-3.0-or-later

package proxysql

import (
Severity: Minor
Found in src/go/collectors/go.d.plugin/modules/proxysql/charts.go - About 6 hrs to fix

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

            Dims: module.Dims{
                {ID: "mysql_command_%s_cnt_100us", Name: "100us", Algo: module.Incremental},
                {ID: "mysql_command_%s_cnt_500us", Name: "500us", Algo: module.Incremental},
                {ID: "mysql_command_%s_cnt_1ms", Name: "1ms", Algo: module.Incremental},
                {ID: "mysql_command_%s_cnt_5ms", Name: "5ms", Algo: module.Incremental},
    Severity: Major
    Found in src/go/collectors/go.d.plugin/modules/proxysql/charts.go and 2 other locations - About 3 hrs to fix
    src/go/collectors/go.d.plugin/modules/proxysql/charts.go on lines 205..218
    src/go/collectors/go.d.plugin/modules/rabbitmq/charts.go on lines 85..98

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 264.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

            Dims: module.Dims{
                {ID: "Com_autocommit", Name: "autocommit", Algo: module.Incremental},
                {ID: "Com_autocommit_filtered", Name: "autocommit_filtered", Algo: module.Incremental},
                {ID: "Com_commit", Name: "commit", Algo: module.Incremental},
                {ID: "Com_commit_filtered", Name: "commit_filtered", Algo: module.Incremental},
    Severity: Major
    Found in src/go/collectors/go.d.plugin/modules/proxysql/charts.go and 2 other locations - About 3 hrs to fix
    src/go/collectors/go.d.plugin/modules/proxysql/charts.go on lines 494..507
    src/go/collectors/go.d.plugin/modules/rabbitmq/charts.go on lines 85..98

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 264.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    var (
        mySQLUserChartsTmpl = module.Charts{
            mySQLUserConnectionsUtilizationChartTmpl.Copy(),
            mySQLUserConnectionsCountChartTmpl.Copy(),
        }
    Severity: Major
    Found in src/go/collectors/go.d.plugin/modules/proxysql/charts.go and 1 other location - About 1 hr to fix
    src/go/collectors/go.d.plugin/modules/windows/charts.go on lines 883..910

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 159.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            Dims: module.Dims{
                {ID: "Auth_memory", Name: "auth"},
                {ID: "SQLite3_memory_bytes", Name: "sqlite3"},
                {ID: "query_digest_memory", Name: "query_digest"},
                {ID: "mysql_query_rules_memory", Name: "query_rules"},
    Severity: Major
    Found in src/go/collectors/go.d.plugin/modules/proxysql/charts.go and 1 other location - About 1 hr to fix
    src/go/collectors/go.d.plugin/modules/apache/charts.go on lines 101..113

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 144.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 5 locations. Consider refactoring.
    Open

    func newMySQLUserCharts(username string) *module.Charts {
        charts := mySQLUserChartsTmpl.Copy()
    
        for _, chart := range *charts {
            chart.ID = fmt.Sprintf(chart.ID, username)
    Severity: Major
    Found in src/go/collectors/go.d.plugin/modules/proxysql/charts.go and 4 other locations - About 1 hr to fix
    src/go/collectors/go.d.plugin/modules/dnsmasq_dhcp/charts.go on lines 81..94
    src/go/collectors/go.d.plugin/modules/postgres/charts.go on lines 532..544
    src/go/collectors/go.d.plugin/modules/postgres/charts.go on lines 581..593
    src/go/collectors/go.d.plugin/modules/wireguard/charts.go on lines 83..97

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 142.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        jemallocMemoryUsedChart = module.Chart{
            ID:       "jemalloc_memory_used",
            Title:    "Jemalloc used memory",
            Units:    "bytes",
            Fam:      "memory",
    Severity: Major
    Found in src/go/collectors/go.d.plugin/modules/proxysql/charts.go and 1 other location - About 1 hr to fix
    src/go/collectors/go.d.plugin/modules/hddtemp/charts.go on lines 30..46

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 135.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 6 locations. Consider refactoring.
    Open

        backendStatementsRateChart = module.Chart{
            ID:       "backend_statements_rate",
            Title:    "Statements executed against the backends",
            Units:    "statements/s",
            Fam:      "statements",
    Severity: Major
    Found in src/go/collectors/go.d.plugin/modules/proxysql/charts.go and 5 other locations - About 55 mins to fix
    src/go/collectors/go.d.plugin/modules/nginxplus/charts.go on lines 570..583
    src/go/collectors/go.d.plugin/modules/nginxplus/charts.go on lines 724..737
    src/go/collectors/go.d.plugin/modules/postgres/charts.go on lines 229..242
    src/go/collectors/go.d.plugin/modules/postgres/charts.go on lines 934..947
    src/go/collectors/go.d.plugin/modules/proxysql/charts.go on lines 259..272

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 126.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 6 locations. Consider refactoring.
    Open

        clientStatementsRateChart = module.Chart{
            ID:       "client_statements_rate",
            Title:    "Statements executed by clients",
            Units:    "statements/s",
            Fam:      "statements",
    Severity: Major
    Found in src/go/collectors/go.d.plugin/modules/proxysql/charts.go and 5 other locations - About 55 mins to fix
    src/go/collectors/go.d.plugin/modules/nginxplus/charts.go on lines 570..583
    src/go/collectors/go.d.plugin/modules/nginxplus/charts.go on lines 724..737
    src/go/collectors/go.d.plugin/modules/postgres/charts.go on lines 229..242
    src/go/collectors/go.d.plugin/modules/postgres/charts.go on lines 934..947
    src/go/collectors/go.d.plugin/modules/proxysql/charts.go on lines 233..246

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 126.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 12 locations. Consider refactoring.
    Open

        backendStatusChartTmpl = module.Chart{
            ID:       "backend_%s_status",
            Title:    "Backend status",
            Units:    "status",
            Fam:      "backend status",
    Severity: Major
    Found in src/go/collectors/go.d.plugin/modules/proxysql/charts.go and 11 other locations - About 30 mins to fix
    src/go/collectors/go.d.plugin/modules/consul/charts.go on lines 246..259
    src/go/collectors/go.d.plugin/modules/consul/charts.go on lines 530..543
    src/go/collectors/go.d.plugin/modules/consul/charts.go on lines 544..557
    src/go/collectors/go.d.plugin/modules/envoy/charts.go on lines 92..105
    src/go/collectors/go.d.plugin/modules/mongodb/charts.go on lines 409..422
    src/go/collectors/go.d.plugin/modules/nvidia_smi/charts.go on lines 221..234
    src/go/collectors/go.d.plugin/modules/postgres/charts.go on lines 503..516
    src/go/collectors/go.d.plugin/modules/redis/charts.go on lines 88..101
    src/go/collectors/go.d.plugin/modules/vsphere/charts.go on lines 86..99
    src/go/collectors/go.d.plugin/modules/vsphere/charts.go on lines 188..201
    src/go/collectors/go.d.plugin/modules/vsphere/charts.go on lines 362..375

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 102.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    There are no issues that match your filters.

    Category
    Status