Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include app ver in prometheus metrics #229

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 30 additions & 14 deletions cmd/pw_atc_api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,40 +26,56 @@ var (
version = "dev"
db *sqlx.DB

ErrUnsupportedResponse = `{"error":"Unsupported Request","Type":"%s"}`
ErrRequestFailed = `{"error":"Something went wrong with the request","Type":"%s"}`

prometheusCounterSearch = promauto.NewCounter(prometheus.CounterOpts{
Name: "pw_atc_api_search_count",
Help: "The number of searches handled",
Namespace: "pw_atc_api",
Name: "search_count",
Help: "The number of searches handled",
})

prometheusCounterSearchSummary = promauto.NewSummary(prometheus.SummaryOpts{
Name: "pw_atc_api_search_summary",
Help: "A Summary of the search times in milliseconds",
Namespace: "pw_atc_api",
Name: "search_summary",
Help: "A Summary of the search times in milliseconds",
})

prometheusCounterEnrich = promauto.NewCounter(prometheus.CounterOpts{
Name: "pw_atc_api_enrich_count",
Help: "The number of enrichments handled",
Namespace: "pw_atc_api",
Name: "enrich_count",
Help: "The number of enrichments handled",
})

prometheusCounterEnrichSummary = promauto.NewSummary(prometheus.SummaryOpts{
Name: "pw_atc_api_enrich_summary",
Help: "A Summary of the enrich times in milliseconds",
Namespace: "pw_atc_api",
Name: "enrich_summary",
Help: "A Summary of the enrich times in milliseconds",
})

prometheusCounterFeeder = promauto.NewCounter(prometheus.CounterOpts{
Name: "pw_atc_api_feeder_count",
Help: "The number of requests for feeder information and feeder updates",
Namespace: "pw_atc_api",
Name: "feeder_count",
Help: "The number of requests for feeder information and feeder updates",
})

prometheusCounterFeederSummary = promauto.NewSummary(prometheus.SummaryOpts{
Name: "pw_atc_api_feeder_summary",
Help: "A Summary of the feeder request times in milliseconds",
Namespace: "pw_atc_api",
Name: "feeder_summary",
Help: "A Summary of the feeder request times in milliseconds",
})

ErrUnsupportedResponse = `{"error":"Unsupported Request","Type":"%s"}`
ErrRequestFailed = `{"error":"Something went wrong with the request","Type":"%s"}`
prometheusAppVer = promauto.NewGaugeVec(prometheus.GaugeOpts{
Namespace: "pw_atc_api",
Name: "info",
Help: "Application Info/Metadata",
}, []string{"version"})
)

func init() {
prometheusAppVer.With(prometheus.Labels{"version": version}).Set(1)
}

func main() {
app := cli.NewApp()

Expand Down
24 changes: 18 additions & 6 deletions cmd/pw_ingest/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,31 @@ const (
var (
version = "dev"
prometheusCounterFramesDecoded = promauto.NewGauge(prometheus.GaugeOpts{
Name: "pw_ingest_num_decoded_frames",
Help: "The number of AVR frames decoded",
Namespace: "pw_ingest",
Name: "num_decoded_frames",
Help: "The number of AVR frames decoded",
})
prometheusGaugeCurrentPlanes = promauto.NewGauge(prometheus.GaugeOpts{
Name: "pw_ingest_current_tracked_planes_count",
Help: "The number of planes this instance is currently tracking",
Namespace: "pw_ingest",
Name: "current_tracked_planes_count",
Help: "The number of planes this instance is currently tracking",
})
prometheusOutputFrameDedupe = promauto.NewCounter(prometheus.CounterOpts{
Name: "pw_ingest_output_frame_dedupe_total",
Help: "The total number of deduped frames not output.",
Namespace: "pw_ingest",
Name: "output_frame_dedupe_total",
Help: "The total number of deduped frames not output.",
})
prometheusAppVer = promauto.NewGaugeVec(prometheus.GaugeOpts{
Namespace: "pw_ingest",
Name: "info",
Help: "Application Info/Metadata",
}, []string{"version"})
)

func init() {
prometheusAppVer.With(prometheus.Labels{"version": version}).Set(1)
}

func main() {
app := cli.NewApp()

Expand Down
49 changes: 33 additions & 16 deletions cmd/pw_router/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,39 +40,56 @@ type (
var (
version = "dev"
updatesProcessed = promauto.NewCounter(prometheus.CounterOpts{
Name: "pw_router_updates_processed_total",
Help: "The total number of messages processed.",
Namespace: "pw_router",
Name: "updates_processed_total",
Help: "The total number of messages processed.",
})
updatesSignificant = promauto.NewCounter(prometheus.CounterOpts{
Name: "pw_router_updates_significant_total",
Help: "The total number of messages determined to be significant.",
Namespace: "pw_router",
Name: "updates_significant_total",
Help: "The total number of messages determined to be significant.",
})
updatesInsignificant = promauto.NewCounter(prometheus.CounterOpts{
Name: "pw_router_updates_insignificant_total",
Help: "The total number of messages determined to be insignificant.",
Namespace: "pw_router",
Name: "updates_insignificant_total",
Help: "The total number of messages determined to be insignificant.",
})
updatesIgnored = promauto.NewCounter(prometheus.CounterOpts{
Name: "pw_router_updates_ignored_total",
Help: "The total number of messages determined to be insignificant and thus ignored.",
Namespace: "pw_router",
Name: "updates_ignored_total",
Help: "The total number of messages determined to be insignificant and thus ignored.",
})
updatesPublished = promauto.NewCounter(prometheus.CounterOpts{
Name: "pw_router_updates_published_total",
Help: "The total number of messages published to the output queue.",
Namespace: "pw_router",
Name: "updates_published_total",
Help: "The total number of messages published to the output queue.",
})
updatesError = promauto.NewCounter(prometheus.CounterOpts{
Name: "pw_router_updates_error_total",
Help: "The total number of messages that could not be processed due to an error.",
Namespace: "pw_router",
Name: "updates_error_total",
Help: "The total number of messages that could not be processed due to an error.",
})
cacheEntries = promauto.NewGauge(prometheus.GaugeOpts{
Name: "pw_router_cache_planes_count",
Help: "The number of planes in the reducer cache.",
Namespace: "pw_router",
Name: "cache_planes_count",
Help: "The number of planes in the reducer cache.",
})
cacheEvictions = promauto.NewCounter(prometheus.CounterOpts{
Name: "pw_router_cache_eviction_total",
Help: "The number of cache evictions made from the cache.",
Namespace: "pw_router",
Name: "cache_eviction_total",
Help: "The number of cache evictions made from the cache.",
})
prometheusAppVer = promauto.NewGaugeVec(prometheus.GaugeOpts{
Namespace: "pw_router",
Name: "info",
Help: "Application Info/Metadata",
}, []string{"version"})
)

func init() {
prometheusAppVer.With(prometheus.Labels{"version": version}).Set(1)
}

func main() {
app := cli.NewApp()
zerolog.SetGlobalLevel(zerolog.InfoLevel)
Expand Down
21 changes: 15 additions & 6 deletions cmd/pw_ws_broker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,43 +18,52 @@ var (
version = "dev"

prometheusNumClients = promauto.NewGauge(prometheus.GaugeOpts{
Subsystem: "pw_ws_broker",
Namespace: "pw_ws_broker",
Name: "num_clients",
Help: "The current number of websocket clients we are currently serving",
})
prometheusIncomingMessages = promauto.NewCounterVec(
prometheus.CounterOpts{
Subsystem: "pw_ws_broker",
Namespace: "pw_ws_broker",
Name: "incoming_messages",
Help: "The number of messages from the queue",
},
[]string{"rate"},
)
prometheusKnownPlanes = promauto.NewGauge(prometheus.GaugeOpts{
Subsystem: "pw_ws_broker",
Namespace: "pw_ws_broker",
Name: "known_planes",
Help: "The number of planes we know about",
})
prometheusMessagesSent = promauto.NewCounter(prometheus.CounterOpts{
Subsystem: "pw_ws_broker",
Namespace: "pw_ws_broker",
Name: "messages_sent",
Help: "The number of messages sent to clients over websockets",
})
prometheusMessagesSize = promauto.NewCounter(prometheus.CounterOpts{
Subsystem: "pw_ws_broker",
Namespace: "pw_ws_broker",
Name: "messages_size",
Help: "the raw size of messages sent (before compression)",
})
prometheusSubscriptions = promauto.NewGaugeVec(
prometheus.GaugeOpts{
Subsystem: "pw_ws_broker",
Namespace: "pw_ws_broker",
Name: "subscriptions",
Help: "which tiles people are subscribed to",
},
[]string{"tile"},
)
prometheusAppVer = promauto.NewGaugeVec(prometheus.GaugeOpts{
Namespace: "pw_ws_broker",
Name: "info",
Help: "Application Info/Metadata",
}, []string{"version"})
)

func init() {
prometheusAppVer.With(prometheus.Labels{"version": version}).Set(1)
}

func main() {
app := cli.NewApp()
app.Version = version
Expand Down
Loading