-
Notifications
You must be signed in to change notification settings - Fork 11
Conversation
metrics/metrics.go
Outdated
|
||
import metrics "github.com/rcrowley/go-metrics" | ||
|
||
type Metrics struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint]
- [golint] exported type Metrics should have comment or be unexported
metrics/metrics.go
Outdated
clientCounterName = "counter" | ||
) | ||
|
||
func New() (Metrics, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint]
- [golint] exported function New should have comment or be unexported
metrics/metrics.go
Outdated
return m, nil | ||
} | ||
|
||
func (m *Metrics) IncClientCount() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint]
- [golint] exported method Metrics.IncClientCount should have comment or be unexported
metrics/metrics.go
Outdated
metrics.GetOrRegisterCounter(clientCounterName, m.registry).Inc(int64(1)) | ||
} | ||
|
||
func (m *Metrics) DecClientCount() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint]
- [golint] exported method Metrics.DecClientCount should have comment or be unexported
metrics/metrics.go
Outdated
metrics "github.com/rcrowley/go-metrics" | ||
) | ||
|
||
type Metrics struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint]
- [golint] exported type Metrics should have comment or be unexported
metrics/metrics.go
Outdated
clientCounterName = "counter" | ||
) | ||
|
||
func New() (Metrics, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint]
- [golint] exported function New should have comment or be unexported
metrics/metrics.go
Outdated
return m, nil | ||
} | ||
|
||
func (m *Metrics) IncClientCount() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint]
- [golint] exported method Metrics.IncClientCount should have comment or be unexported
metrics/metrics.go
Outdated
metrics.GetOrRegisterCounter(clientCounterName, m.registry).Inc(int64(1)) | ||
} | ||
|
||
func (m *Metrics) DecClientCount() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint]
- [golint] exported method Metrics.DecClientCount should have comment or be unexported
metrics/metrics.go
Outdated
metrics.GetOrRegisterCounter(clientCounterName, m.registry).Dec(int64(1)) | ||
} | ||
|
||
func (m *Metrics) WriteJSON(w io.Writer) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint]
- [golint] exported method Metrics.WriteJSON should have comment or be unexported
server/metrics.go
Outdated
"github.com/openfresh/plasma/metrics" | ||
) | ||
|
||
func NewMetricsServer(config config.Config, metrics []metrics.Metrics) *http.Server { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint]
- [golint] exported function NewMetricsServer should have comment or be unexported
metrics/metrics.go
Outdated
metrics.GetOrRegisterCounter(clientCounterName, m.registry).Dec(int64(1)) | ||
} | ||
|
||
func (m *Metrics) GetClientCount() int64 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint]
- [golint] exported method Metrics.GetClientCount should have comment or be unexported
metrics/metrics.go
Outdated
return metrics.GetOrRegisterCounter(clientCounterName, m.registry).Count() | ||
} | ||
|
||
func (m *Metrics) WriteJSON(w io.Writer) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint]
- [golint] exported method Metrics.WriteJSON should have comment or be unexported
server/metrics.go
Outdated
"github.com/openfresh/plasma/metrics" | ||
) | ||
|
||
func NewMetricsServer(config config.Config, metrics []metrics.Metrics) *http.Server { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint]
- [golint] exported function NewMetricsServer should have comment or be unexported
metrics/metrics.go
Outdated
) | ||
|
||
const ( | ||
GRPC = "grpc" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint]
- [golint] exported const GRPC should have comment (or a comment on this block) or be unexported
metrics/metrics.go
Outdated
SSE = "sse" | ||
) | ||
|
||
type Metrics struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint]
- [golint] exported type Metrics should have comment or be unexported
metrics/metrics.go
Outdated
registry = metrics.NewRegistry() | ||
} | ||
|
||
type Registry metrics.Registry |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint]
- [golint] exported type Registry should have comment or be unexported
metrics/metrics.go
Outdated
|
||
type Registry metrics.Registry | ||
|
||
func New(metricsType string) (Metrics, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint]
- [golint] exported function New should have comment or be unexported
metrics/metrics.go
Outdated
return m, nil | ||
} | ||
|
||
func GetRegistry() metrics.Registry { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint]
- [golint] exported function GetRegistry should have comment or be unexported
metrics/metrics.go
Outdated
return strings.Join(append([]string{m.Type}, names...), ":") | ||
} | ||
|
||
func (m *Metrics) IncClientCount() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint]
- [golint] exported method Metrics.IncClientCount should have comment or be unexported
metrics/metrics.go
Outdated
metrics.GetOrRegisterCounter(name, m.registry).Inc(int64(1)) | ||
} | ||
|
||
func (m *Metrics) DecClientCount() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint]
- [golint] exported method Metrics.DecClientCount should have comment or be unexported
metrics/metrics.go
Outdated
metrics.GetOrRegisterCounter(name, m.registry).Dec(int64(1)) | ||
} | ||
|
||
func (m *Metrics) GetClientCount() int64 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint]
- [golint] exported method Metrics.GetClientCount should have comment or be unexported
metrics/metrics.go
Outdated
return metrics.GetOrRegisterCounter(name, m.registry).Count() | ||
} | ||
|
||
func (m *Metrics) WriteJSON(w io.Writer) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint]
- [golint] exported method Metrics.WriteJSON should have comment or be unexported
server/meta.go
Outdated
metrics "github.com/rcrowley/go-metrics" | ||
) | ||
|
||
func NewMetaServer(opt Option) *http.Server { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint]
- [golint] exported function NewMetaServer should have comment or be unexported
"net/http" | ||
) | ||
|
||
func HTTPHandler(w http.ResponseWriter, r *http.Request) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint]
- [golint] exported function HTTPHandler should have comment or be unexported
"time" | ||
) | ||
|
||
type Stats struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint]
- [golint] exported type Stats should have comment or be unexported
metrics/stats.go
Outdated
GoVersion string `json:"go_version"` | ||
GoOs string `json:"go_os"` | ||
GoArch string `json:"go_arch"` | ||
CpuNum int `json:"cpu_num"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint]
- [golint] struct field CpuNum should be CPUNum
metrics/stats.go
Outdated
t.Time = tm | ||
} | ||
|
||
var nsInMs float64 = float64(time.Millisecond) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint]
- [golint] should omit type float64 from declaration of var nsInMs; it will be inferred from the right-hand side
metrics/stats.go
Outdated
|
||
// NOTE: The following three variables need to be changed to atomic | ||
var lastSampleTime safeTime | ||
var lastPauseNs uint64 = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint]
- [golint] should drop = 0 from declaration of var lastPauseNs; it is the zero value
metrics/stats.go
Outdated
// NOTE: The following three variables need to be changed to atomic | ||
var lastSampleTime safeTime | ||
var lastPauseNs uint64 = 0 | ||
var lastNumGc uint32 = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint]
- [golint] should drop = 0 from declaration of var lastNumGc; it is the zero value
metrics/stats.go
Outdated
var lastPauseNs uint64 = 0 | ||
var lastNumGc uint32 = 0 | ||
|
||
var connections int64 = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint]
- [golint] should drop = 0 from declaration of var connections; it is the zero value
metrics/stats.go
Outdated
|
||
var connections int64 = 0 | ||
|
||
func IncConnection() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint]
- [golint] exported function IncConnection should have comment or be unexported
atomic.AddInt64(&connections, 1) | ||
} | ||
|
||
func DecConnection() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint]
- [golint] exported function DecConnection should have comment or be unexported
atomic.AddInt64(&connections, -1) | ||
} | ||
|
||
func GetConnection() int64 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint]
- [golint] exported function GetConnection should have comment or be unexported
return atomic.LoadInt64(&connections) | ||
} | ||
|
||
func GetStats() *Stats { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint]
- [golint] exported function GetStats should have comment or be unexported
No description provided.