Skip to content

Commit

Permalink
Add metric schema in go
Browse files Browse the repository at this point in the history
  • Loading branch information
jrauh01 committed May 21, 2024
1 parent 1f45b90 commit 6af2673
Show file tree
Hide file tree
Showing 6 changed files with 288 additions and 0 deletions.
8 changes: 8 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ require (
github.com/go-sql-driver/mysql v1.8.0
github.com/goccy/go-yaml v1.11.3
github.com/google/uuid v1.6.0
github.com/icinga/icinga-go-library v0.0.0-20240205102806-f0e227c2fb22
github.com/jmoiron/sqlx v1.3.5
github.com/lib/pq v1.10.9
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.19.1
github.com/prometheus/common v0.53.0
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225
golang.org/x/sync v0.6.0
k8s.io/api v0.29.2
Expand All @@ -35,6 +38,7 @@ require (
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/jessevdk/go-flags v1.5.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
Expand All @@ -44,9 +48,13 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/prometheus/client_model v0.6.0 // indirect
github.com/robfig/cron/v3 v3.0.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/ssgreg/journald v1.0.0 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.26.0 // indirect
golang.org/x/net v0.22.0 // indirect
golang.org/x/oauth2 v0.18.0 // indirect
golang.org/x/sys v0.18.0 // indirect
Expand Down
29 changes: 29 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/creasty/defaults v1.7.0 h1:eNdqZvc5B509z18lD8yc212CAqJNvfT1Jq6L8WowdBA=
github.com/creasty/defaults v1.7.0/go.mod h1:iGzKe6pbEHnpMPtfDXZEr0NVxWnPTjb1bbDy08fPzYM=
Expand Down Expand Up @@ -53,12 +57,18 @@ github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLe
github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/icinga/icinga-go-library v0.0.0-20240205102806-f0e227c2fb22 h1:szPuo41PntDY35mDAQYkliwuT2P1P/DB9TUnryRPlR4=
github.com/icinga/icinga-go-library v0.0.0-20240205102806-f0e227c2fb22/go.mod h1:Apo85zqPgovShDWxx/TlUN/bfl+RaPviTafT666iJyw=
github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4=
github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY=
github.com/jessevdk/go-flags v1.5.0 h1:1jKYvbxEjfUl0fmqTCOfonvskHHXMjBySTLW4y9LFvc=
github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4=
github.com/jmoiron/sqlx v1.3.5 h1:vFFPA71p1o5gAeqtEAwLU4dnX2napprKtHr7PYIcN3g=
github.com/jmoiron/sqlx v1.3.5/go.mod h1:nRVWtLre0KfCLJvgxzCsLVMogSvQ1zNJtpYr2Ccp0mQ=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA=
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
Expand Down Expand Up @@ -94,6 +104,8 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU=
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/onsi/ginkgo/v2 v2.13.0 h1:0jY9lJquiL8fcf3M4LAXN5aMlS/b2BV86HFFPCPMgE4=
github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o=
github.com/onsi/gomega v1.29.0 h1:KIA/t2t5UBzoirT4H9tsML45GEbo3ouUnBHsCfD2tVg=
Expand All @@ -103,6 +115,14 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE=
github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho=
github.com/prometheus/client_model v0.6.0 h1:k1v3CzpSRUTrKMppY35TLwPvxHqBu0bYgxZzqGIgaos=
github.com/prometheus/client_model v0.6.0/go.mod h1:NTQHnmxFpouOD0DpvP4XujX3CdOAGQPoaGhyTchlyt8=
github.com/prometheus/common v0.53.0 h1:U2pL9w9nmJwJDa4qqLQ3ZaePJ6ZTwt7cMD3AG3+aLCE=
github.com/prometheus/common v0.53.0/go.mod h1:BrxBKv3FWBIGXw89Mg1AeBq7FSyRzXWI3l3e7W3RN5U=
github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo=
github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo=
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
Expand All @@ -111,6 +131,8 @@ github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDN
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/ssgreg/journald v1.0.0 h1:0YmTDPJXxcWDPba12qNMdO6TxvfkFSYpFIJ31CwmLcU=
github.com/ssgreg/journald v1.0.0/go.mod h1:RUckwmTM8ghGWPslq2+ZBZzbb9/2KgjzYZ4JEP+oRt0=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
Expand All @@ -126,6 +148,12 @@ github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5t
go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk=
go.uber.org/goleak v1.2.0/go.mod h1:XJYK+MuIchqpmGmUSAzotztawfKvYLUIgg7guXrwVUo=
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo=
go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
Expand Down Expand Up @@ -157,6 +185,7 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
Expand Down
69 changes: 69 additions & 0 deletions pkg/common/common.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
package common

import (
"github.com/icinga/icinga-go-library/database"
"github.com/icinga/icinga-go-library/types"
"github.com/icinga/icinga-kubernetes/pkg/contracts"
kmetav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

type IdMeta struct {
Id types.Binary
}

func (m *IdMeta) ID() database.ID {
return m.Id
}

func (m *IdMeta) SetID(id database.ID) {
m.Id = id.(types.Binary)
}

type CanonicalMeta struct {
CanonicalName string
}

func (m *CanonicalMeta) GetCanonicalName() string {
return m.CanonicalName
}

func (m *CanonicalMeta) SetCanonicalName(canonicalName string) {
m.CanonicalName = canonicalName
}

func NewKEnvelope(key string) contracts.KEnvelope {
return &kenvelope{
IdMeta: IdMeta{types.Checksum(key)},
CanonicalMeta: CanonicalMeta{key},
}
}

type kenvelope struct {
IdMeta
CanonicalMeta
}

func (k *kenvelope) KUpsert(kobject kmetav1.Object) contracts.KUpsert {
return &kupsert{
kenvelope: *k,
kobject: kobject,
}
}

func (k *kenvelope) KDelete() contracts.KDelete {
return k
}

type kupsert struct {
kenvelope
kobject kmetav1.Object
}

func (k *kupsert) KObject() kmetav1.Object {
return k.kobject
}

// Assert interface compliance.
var (
_ database.IDer = (*IdMeta)(nil)
)
39 changes: 39 additions & 0 deletions pkg/contracts/contracts.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package contracts

import (
"github.com/icinga/icinga-go-library/database"
"k8s.io/apimachinery/pkg/apis/meta/v1"

Check failure on line 5 in pkg/contracts/contracts.go

View workflow job for this annotation

GitHub Actions / lint

package "k8s.io/apimachinery/pkg/apis/meta/v1" is being imported more than once (ST1019)
kmetav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

Check failure on line 6 in pkg/contracts/contracts.go

View workflow job for this annotation

GitHub Actions / lint

other import of "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// KEnvelope carries identity information about a Kubernetes resource change to be synchronized.
type KEnvelope interface {
entity
KUpsert(kobject kmetav1.Object) KUpsert
KDelete() KDelete
}

// KUpsert carries identity information and the added or updated Kubernetes resource to be synchronized.
type KUpsert interface {
entity
KObject() kmetav1.Object
}

// KDelete carries identity information about a deleted Kubernetes resource to be synchronized.
type KDelete interface {
entity
}

// Resource represents principal entities synchronized from Kubernetes resources to the Icinga Kubernetes database.
type Resource interface {
entity
database.Fingerprinter
v1.Object
Obtain(kobject v1.Object)
}

type entity interface {
database.IDer
GetCanonicalName() string
SetCanonicalName(string)
}
107 changes: 107 additions & 0 deletions pkg/schema/meta.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
package schema

import (
"github.com/icinga/icinga-go-library/database"
"github.com/icinga/icinga-go-library/types"
"github.com/icinga/icinga-kubernetes/pkg/common"
kmetav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
ktypes "k8s.io/apimachinery/pkg/types"
)

type kmetaWithoutNamespace struct {
common.IdMeta
common.CanonicalMeta
Uid ktypes.UID
Name string
ResourceVersion string
Created types.UnixMilli
}

func (m *kmetaWithoutNamespace) Fingerprint() database.Fingerprinter {
return m
}

func (m *kmetaWithoutNamespace) Obtain(kobject kmetav1.Object) {
m.Uid = kobject.GetUID()
m.Name = kobject.GetName()
m.ResourceVersion = kobject.GetResourceVersion()
m.Created = types.UnixMilli(kobject.GetCreationTimestamp().Time)
}

func (m *kmetaWithoutNamespace) GetNamespace() string { return "" }
func (m *kmetaWithoutNamespace) SetNamespace(string) { panic("Not expected to be called") }
func (m *kmetaWithoutNamespace) GetName() string { return m.Name }
func (m *kmetaWithoutNamespace) SetName(string) { panic("Not expected to be called") }
func (m *kmetaWithoutNamespace) GetGenerateName() string { panic("Not expected to be called") }
func (m *kmetaWithoutNamespace) SetGenerateName(string) { panic("Not expected to be called") }
func (m *kmetaWithoutNamespace) GetUID() ktypes.UID { return m.Uid }
func (m *kmetaWithoutNamespace) SetUID(ktypes.UID) { panic("Not expected to be called") }
func (m *kmetaWithoutNamespace) GetResourceVersion() string { return m.ResourceVersion }
func (m *kmetaWithoutNamespace) SetResourceVersion(string) { panic("Not expected to be called") }
func (m *kmetaWithoutNamespace) GetGeneration() int64 { panic("Not expected to be called") }
func (m *kmetaWithoutNamespace) SetGeneration(int64) { panic("Not expected to be called") }
func (m *kmetaWithoutNamespace) GetSelfLink() string { panic("Not expected to be called") }
func (m *kmetaWithoutNamespace) SetSelfLink(string) { panic("Not expected to be called") }
func (m *kmetaWithoutNamespace) GetCreationTimestamp() kmetav1.Time {
return kmetav1.NewTime(m.Created.Time())
}
func (m *kmetaWithoutNamespace) SetCreationTimestamp(kmetav1.Time) {
panic("Not expected to be called")
}
func (m *kmetaWithoutNamespace) GetDeletionTimestamp() *kmetav1.Time {
panic("Not expected to be called")
}
func (m *kmetaWithoutNamespace) SetDeletionTimestamp(*kmetav1.Time) {
panic("Not expected to be called")
}
func (m *kmetaWithoutNamespace) GetDeletionGracePeriodSeconds() *int64 {
panic("Not expected to be called")
}
func (m *kmetaWithoutNamespace) SetDeletionGracePeriodSeconds(*int64) {
panic("Not expected to be called")
}
func (m *kmetaWithoutNamespace) GetLabels() map[string]string { panic("Not expected to be called") }
func (m *kmetaWithoutNamespace) SetLabels(map[string]string) { panic("Not expected to be called") }
func (m *kmetaWithoutNamespace) GetAnnotations() map[string]string {
panic("Not expected to be called")
}
func (m *kmetaWithoutNamespace) SetAnnotations(_ map[string]string) {
panic("Not expected to be called")
}
func (m *kmetaWithoutNamespace) GetFinalizers() []string { panic("Not expected to be called") }
func (m *kmetaWithoutNamespace) SetFinalizers([]string) { panic("Not expected to be called") }
func (m *kmetaWithoutNamespace) GetOwnerReferences() []kmetav1.OwnerReference {
panic("Not expected to be called")
}
func (m *kmetaWithoutNamespace) SetOwnerReferences([]kmetav1.OwnerReference) {
panic("Not expected to be called")
}
func (m *kmetaWithoutNamespace) GetManagedFields() []kmetav1.ManagedFieldsEntry {
panic("Not expected to be called")
}
func (m *kmetaWithoutNamespace) SetManagedFields([]kmetav1.ManagedFieldsEntry) {
panic("Not expected to be called")
}

type kmetaWithNamespace struct {
kmetaWithoutNamespace
Namespace string
}

func (m *kmetaWithNamespace) GetNamespace() string { return m.Namespace }

func (m *kmetaWithNamespace) Fingerprint() database.Fingerprinter {
return m
}

func (m *kmetaWithNamespace) Obtain(kobject kmetav1.Object) {
m.kmetaWithoutNamespace.Obtain(kobject)

m.Namespace = kobject.GetNamespace()
}

// Assert interface compliance.
var (
_ kmetav1.Object = (*kmetaWithoutNamespace)(nil)
_ kmetav1.Object = (*kmetaWithNamespace)(nil)
)
36 changes: 36 additions & 0 deletions pkg/schema/metric.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package schema

type PrometheusClusterMetric struct {
kmetaWithoutNamespace
Timestamp int64
Group string
Name string
Value float64
}

type PrometheusNodeMetric struct {
kmetaWithoutNamespace
NodeId []byte
Timestamp int64
Group string
Name string
Value float64
}

type PrometheusPodMetric struct {
kmetaWithoutNamespace
PodId []byte
Timestamp int64
Group string
Name string
Value float64
}

type PrometheusContainerMetric struct {
kmetaWithoutNamespace
ContainerId []byte
Timestamp int64
Group string
Name string
Value float64
}

0 comments on commit 6af2673

Please sign in to comment.