This repository has been archived by the owner on Dec 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #714 from TheThingsNetwork/develop
v2.9.3
- Loading branch information
Showing
11 changed files
with
131 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright © 2017 The Things Network | ||
// Use of this source code is governed by the MIT license that can be found in the LICENSE file. | ||
|
||
package application | ||
|
||
import ( | ||
"github.com/prometheus/client_golang/prometheus" | ||
) | ||
|
||
var applicationCount = prometheus.NewGaugeFunc(prometheus.GaugeOpts{ | ||
Namespace: "ttn", | ||
Subsystem: "handler", | ||
Name: "registered_applications", | ||
Help: "Registered applications.", | ||
}, func() float64 { | ||
var count uint64 | ||
for _, store := range stores { | ||
applications, err := store.Count() | ||
if err != nil { | ||
continue | ||
} | ||
count += uint64(applications) | ||
} | ||
return float64(count) | ||
}) | ||
|
||
func init() { | ||
prometheus.Register(applicationCount) | ||
} | ||
|
||
var stores []*RedisApplicationStore | ||
|
||
func countStore(store *RedisApplicationStore) { | ||
stores = append(stores, store) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright © 2017 The Things Network | ||
// Use of this source code is governed by the MIT license that can be found in the LICENSE file. | ||
|
||
package device | ||
|
||
import ( | ||
"github.com/prometheus/client_golang/prometheus" | ||
) | ||
|
||
var deviceCount = prometheus.NewGaugeFunc(prometheus.GaugeOpts{ | ||
Namespace: "ttn", | ||
Subsystem: "handler", | ||
Name: "registered_devices", | ||
Help: "Registered devices.", | ||
}, func() float64 { | ||
var count uint64 | ||
for _, store := range stores { | ||
devices, err := store.Count() | ||
if err != nil { | ||
continue | ||
} | ||
count += uint64(devices) | ||
} | ||
return float64(count) | ||
}) | ||
|
||
func init() { | ||
prometheus.Register(deviceCount) | ||
} | ||
|
||
var stores []*RedisDeviceStore | ||
|
||
func countStore(store *RedisDeviceStore) { | ||
stores = append(stores, store) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright © 2017 The Things Network | ||
// Use of this source code is governed by the MIT license that can be found in the LICENSE file. | ||
|
||
package device | ||
|
||
import ( | ||
"github.com/prometheus/client_golang/prometheus" | ||
) | ||
|
||
var deviceCount = prometheus.NewGaugeFunc(prometheus.GaugeOpts{ | ||
Namespace: "ttn", | ||
Subsystem: "networkserver", | ||
Name: "registered_devices", | ||
Help: "Registered devices.", | ||
}, func() float64 { | ||
var count uint64 | ||
for _, store := range stores { | ||
devices, err := store.Count() | ||
if err != nil { | ||
continue | ||
} | ||
count += uint64(devices) | ||
} | ||
return float64(count) | ||
}) | ||
|
||
func init() { | ||
prometheus.Register(deviceCount) | ||
} | ||
|
||
var stores []*RedisDeviceStore | ||
|
||
func countStore(store *RedisDeviceStore) { | ||
stores = append(stores, store) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters