netdata/netdata

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

Summary

Maintainability
F
5 days
Test Coverage

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

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

package postgres

import (
Severity: Major
Found in src/go/collectors/go.d.plugin/modules/postgres/charts.go - About 2 days to fix

    Postgres has 22 methods (exceeds 20 allowed). Consider refactoring.
    Open

    func (p *Postgres) addWALFilesCharts() {
        charts := walFilesCharts.Copy()
    
        if err := p.Charts().Add(*charts...); err != nil {
            p.Warning(err)
    Severity: Minor
    Found in src/go/collectors/go.d.plugin/modules/postgres/charts.go - About 2 hrs to fix

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

          catalogRelationSCountChart = module.Chart{
              ID:       "catalog_relations_count",
              Title:    "Relation count",
              Units:    "relations",
              Fam:      "catalog",
      Severity: Major
      Found in src/go/collectors/go.d.plugin/modules/postgres/charts.go and 1 other location - About 1 hr to fix
      src/go/collectors/go.d.plugin/modules/postgres/charts.go on lines 376..396

      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 183.

      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

          catalogRelationsSizeChart = module.Chart{
              ID:       "catalog_relations_size",
              Title:    "Relation size",
              Units:    "B",
              Fam:      "catalog",
      Severity: Major
      Found in src/go/collectors/go.d.plugin/modules/postgres/charts.go and 1 other location - About 1 hr to fix
      src/go/collectors/go.d.plugin/modules/postgres/charts.go on lines 355..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 183.

      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

          dbLocksHeldCountChartTmpl = module.Chart{
              ID:       "db_%s_locks_held",
              Title:    "Database locks held",
              Units:    "locks",
              Fam:      "locks",
      Severity: Major
      Found in src/go/collectors/go.d.plugin/modules/postgres/charts.go and 1 other location - About 1 hr to fix
      src/go/collectors/go.d.plugin/modules/postgres/charts.go on lines 793..811

      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

          dbConflictsReasonRateChartTmpl = module.Chart{
              ID:       "db_%s_conflicts_reason_rate",
              Title:    "Database canceled queries by reason",
              Units:    "queries/s",
              Fam:      "replication",
      Severity: Major
      Found in src/go/collectors/go.d.plugin/modules/postgres/charts.go and 1 other location - About 1 hr to fix
      src/go/collectors/go.d.plugin/modules/mysql/charts.go on lines 213..227

      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

          dbLocksAwaitedCountChartTmpl = module.Chart{
              ID:       "db_%s_locks_awaited_count",
              Title:    "Database locks awaited",
              Units:    "locks",
              Fam:      "locks",
      Severity: Major
      Found in src/go/collectors/go.d.plugin/modules/postgres/charts.go and 1 other location - About 1 hr to fix
      src/go/collectors/go.d.plugin/modules/postgres/charts.go on lines 774..792

      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

      var baseCharts = module.Charts{
          serverConnectionsUtilizationChart.Copy(),
          serverConnectionsUsageChart.Copy(),
          serverConnectionsStateCount.Copy(),
          locksUtilization.Copy(),
      Severity: Major
      Found in src/go/collectors/go.d.plugin/modules/postgres/charts.go and 1 other location - About 1 hr to fix
      src/go/collectors/go.d.plugin/modules/windows/charts.go on lines 1070..1090

      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 145.

      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 newReplicationSlotCharts(slot string) *module.Charts {
          charts := replicationSlotCharts.Copy()
          for _, c := range *charts {
              c.ID = fmt.Sprintf(c.ID, slot)
              c.Labels = []module.Label{
      Severity: Major
      Found in src/go/collectors/go.d.plugin/modules/postgres/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/proxysql/charts.go on lines 574..586
      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 5 locations. Consider refactoring.
      Open

      func newReplicationStandbyAppCharts(app string) *module.Charts {
          charts := replicationStandbyAppCharts.Copy()
          for _, c := range *charts {
              c.ID = fmt.Sprintf(c.ID, app)
              c.Labels = []module.Label{
      Severity: Major
      Found in src/go/collectors/go.d.plugin/modules/postgres/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 581..593
      src/go/collectors/go.d.plugin/modules/proxysql/charts.go on lines 574..586
      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 6 locations. Consider refactoring.
      Open

          buffersIORateChart = module.Chart{
              ID:       "buffers_io_rate",
              Title:    "Buffers written rate",
              Units:    "B/s",
              Fam:      "maintenance",
      Severity: Major
      Found in src/go/collectors/go.d.plugin/modules/postgres/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 934..947
      src/go/collectors/go.d.plugin/modules/proxysql/charts.go on lines 233..246
      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

          tableOpsRowsRateChartTmpl = module.Chart{
              ID:       "table_%s_db_%s_schema_%s_ops_rows_rate",
              Title:    "Table throughput",
              Units:    "rows/s",
              Fam:      "throughput",
      Severity: Major
      Found in src/go/collectors/go.d.plugin/modules/postgres/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/proxysql/charts.go on lines 233..246
      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 7 locations. Consider refactoring.
      Open

          autovacuumWorkersCountChart = module.Chart{
              ID:       "autovacuum_workers_count",
              Title:    "Autovacuum workers",
              Units:    "workers",
              Fam:      "vacuum and analyze",
      Severity: Major
      Found in src/go/collectors/go.d.plugin/modules/postgres/charts.go and 6 other locations - About 45 mins to fix
      src/go/collectors/go.d.plugin/modules/docker/charts.go on lines 47..61
      src/go/collectors/go.d.plugin/modules/docker/charts.go on lines 115..129
      src/go/collectors/go.d.plugin/modules/mongodb/charts.go on lines 267..281
      src/go/collectors/go.d.plugin/modules/nginxplus/charts.go on lines 680..694
      src/go/collectors/go.d.plugin/modules/rabbitmq/charts.go on lines 100..114
      src/go/collectors/go.d.plugin/modules/vsphere/charts.go on lines 258..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 114.

      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

          dbTransactionsRatioChartTmpl = module.Chart{
              ID:       "db_%s_transactions_ratio",
              Title:    "Database transactions ratio",
              Units:    "percentage",
              Fam:      "transactions",
      Severity: Major
      Found in src/go/collectors/go.d.plugin/modules/postgres/charts.go and 5 other locations - About 35 mins to fix
      src/go/collectors/go.d.plugin/modules/cassandra/charts.go on lines 156..168
      src/go/collectors/go.d.plugin/modules/cassandra/charts.go on lines 203..215
      src/go/collectors/go.d.plugin/modules/mongodb/charts.go on lines 294..306
      src/go/collectors/go.d.plugin/modules/postgres/charts.go on lines 190..202
      src/go/collectors/go.d.plugin/modules/postgres/charts.go on lines 688..700

      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 105.

      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 4 locations. Consider refactoring.
      Open

      func (p *Postgres) addTableIndexIOCharts(tbl *tableMetrics) {
          charts := module.Charts{
              newTableChart(tableIndexCacheIORatioChartTmpl.Copy(), tbl),
              newTableChart(tableIndexIORateChartTmpl.Copy(), tbl),
          }
      Severity: Major
      Found in src/go/collectors/go.d.plugin/modules/postgres/charts.go and 3 other locations - About 35 mins to fix
      src/go/collectors/go.d.plugin/modules/postgres/charts.go on lines 1251..1260
      src/go/collectors/go.d.plugin/modules/postgres/charts.go on lines 1273..1282
      src/go/collectors/go.d.plugin/modules/postgres/charts.go on lines 1284..1293

      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 105.

      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 4 locations. Consider refactoring.
      Open

      func (p *Postgres) addTableIOChartsCharts(tbl *tableMetrics) {
          charts := module.Charts{
              newTableChart(tableCacheIORatioChartTmpl.Copy(), tbl),
              newTableChart(tableIORateChartTmpl.Copy(), tbl),
          }
      Severity: Major
      Found in src/go/collectors/go.d.plugin/modules/postgres/charts.go and 3 other locations - About 35 mins to fix
      src/go/collectors/go.d.plugin/modules/postgres/charts.go on lines 1262..1271
      src/go/collectors/go.d.plugin/modules/postgres/charts.go on lines 1273..1282
      src/go/collectors/go.d.plugin/modules/postgres/charts.go on lines 1284..1293

      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 105.

      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 4 locations. Consider refactoring.
      Open

      func (p *Postgres) addTableTOASTIOCharts(tbl *tableMetrics) {
          charts := module.Charts{
              newTableChart(tableTOASCacheIORatioChartTmpl.Copy(), tbl),
              newTableChart(tableTOASTIORateChartTmpl.Copy(), tbl),
          }
      Severity: Major
      Found in src/go/collectors/go.d.plugin/modules/postgres/charts.go and 3 other locations - About 35 mins to fix
      src/go/collectors/go.d.plugin/modules/postgres/charts.go on lines 1251..1260
      src/go/collectors/go.d.plugin/modules/postgres/charts.go on lines 1262..1271
      src/go/collectors/go.d.plugin/modules/postgres/charts.go on lines 1284..1293

      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 105.

      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

          dbIORateChartTmpl = module.Chart{
              ID:       "db_%s_io_rate",
              Title:    "Database reads",
              Units:    "B/s",
              Fam:      "cache",
      Severity: Major
      Found in src/go/collectors/go.d.plugin/modules/postgres/charts.go and 5 other locations - About 35 mins to fix
      src/go/collectors/go.d.plugin/modules/cassandra/charts.go on lines 156..168
      src/go/collectors/go.d.plugin/modules/cassandra/charts.go on lines 203..215
      src/go/collectors/go.d.plugin/modules/mongodb/charts.go on lines 294..306
      src/go/collectors/go.d.plugin/modules/postgres/charts.go on lines 190..202
      src/go/collectors/go.d.plugin/modules/postgres/charts.go on lines 630..642

      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 105.

      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

          checkpointsChart = module.Chart{
              ID:       "checkpoints_rate",
              Title:    "Checkpoints",
              Units:    "checkpoints/s",
              Fam:      "maintenance",
      Severity: Major
      Found in src/go/collectors/go.d.plugin/modules/postgres/charts.go and 5 other locations - About 35 mins to fix
      src/go/collectors/go.d.plugin/modules/cassandra/charts.go on lines 156..168
      src/go/collectors/go.d.plugin/modules/cassandra/charts.go on lines 203..215
      src/go/collectors/go.d.plugin/modules/mongodb/charts.go on lines 294..306
      src/go/collectors/go.d.plugin/modules/postgres/charts.go on lines 630..642
      src/go/collectors/go.d.plugin/modules/postgres/charts.go on lines 688..700

      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 105.

      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 4 locations. Consider refactoring.
      Open

      func (p *Postgres) addTableTOASTIndexIOCharts(tbl *tableMetrics) {
          charts := module.Charts{
              newTableChart(tableTOASTIndexCacheIORatioChartTmpl.Copy(), tbl),
              newTableChart(tableTOASTIndexIORateChartTmpl.Copy(), tbl),
          }
      Severity: Major
      Found in src/go/collectors/go.d.plugin/modules/postgres/charts.go and 3 other locations - About 35 mins to fix
      src/go/collectors/go.d.plugin/modules/postgres/charts.go on lines 1251..1260
      src/go/collectors/go.d.plugin/modules/postgres/charts.go on lines 1262..1271
      src/go/collectors/go.d.plugin/modules/postgres/charts.go on lines 1273..1282

      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 105.

      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

          replicationAppWALLagSizeChartTmpl = module.Chart{
              ID:       "replication_app_%s_wal_lag_size",
              Title:    "Standby application WAL lag size",
              Units:    "B",
              Fam:      "replication",
      Severity: Major
      Found in src/go/collectors/go.d.plugin/modules/postgres/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/proxysql/charts.go on lines 617..630
      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