Skip to content

The only tool you need to know what is happening and how to fix it.

1.5 KB
Raw Blame
package models

import (
	"time"

	"github.com/google/uuid"
)

type MetricPoint struct {
	ProjectId  uuid.UUID         `json:"projectId" ch:"project_id"`
	Name       string            `json:"name" ch:"name"`
	Value      float64           `json:"value" ch:"value"`
	Tags       map[string]string `json:"tags" ch:"tags"`
	RecordedAt time.Time         `json:"recordedAt" ch:"recorded_at"`
}

type ServerLatestPoint struct {
	ServerName     string            `json:"serverName"`
	Value          float64           `json:"value"`
	LastReportedAt time.Time         `json:"lastReportedAt"`
	Tags           map[string]string `json:"tags,omitempty"`
}

type DiscoveredMetric struct {
	Name       string   `json:"name"`
	TagKeys    []string `json:"tagKeys"`
	MetricType string   `json:"metricType,omitempty"`
	Unit       string   `json:"unit,omitempty"`
}

const (
	MetricNameMemoryUsage                 = "mem.used"
	MetricNameMemoryTotal                 = "mem.total"
	MetricNameCpuUsage                    = "cpu.used_pcnt"
	MetricNameGoRoutines                  = "go.go_routines"
	MetricNameHeapObjects                 = "go.heap_objects"
	MetricNameNumGC                       = "go.num_gc"
	MetricNameGCPauseTotal                = "go.gc_pause"
	MetricNameSystemCPUUtilization        = "system.cpu.utilization"
	MetricNameSystemMemoryUtilization     = "system.memory.utilization"
	MetricNameSystemFilesystemUtilization = "system.filesystem.utilization"
	MetricNameSystemNetworkIO             = "system.network.io"
	// other metric names are custom and added by the clients
)