chore: remove lastConnected property and update OpenAPI spec (#1639)

* chore: remove `lastConnected` property

* Update OpenAPI spec.
This commit is contained in:
Sander Bruens 2025-02-14 16:51:07 -05:00 committed by GitHub
parent 2cc12e0cb3
commit 34b5e7a2e8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 69 additions and 28 deletions

View file

@ -146,46 +146,94 @@ paths:
type: object
properties:
server:
type: array
items:
type: object
properties:
location:
type: string
asn:
type: number
asOrg:
type: string
tunnelTime:
type: object
properties:
tunnelTime:
type: object
properties:
seconds:
type: number
dataTransferred:
type: object
properties:
bytes:
type: number
bandwidth:
type: object
properties:
current:
type: object
properties:
data:
type: object
properties:
bytes:
type: number
timestamp:
type: integer
peak:
type: object
properties:
data:
type: object
properties:
bytes:
type: number
timestamp:
type: integer
locations:
type: array
items:
type: object
properties:
seconds:
type: number
dataTransferred:
type: object
properties:
bytes:
location:
type: string
asn:
type: number
asOrg:
type: string
tunnelTime:
type: object
properties:
seconds:
type: number
dataTransferred:
type: object
properties:
bytes:
type: number
accessKeys:
type: array
items:
type: object
properties:
accessKeyId:
type: string
type: integer
tunnelTime:
type: object
properties:
seconds:
seconds:
type: number
dataTransferred:
type: object
properties:
bytes:
bytes:
type: number
connection:
type: object
properties:
lastTrafficSeen:
type: number
peakDeviceCount:
type: object
properties:
data:
type: integer
timestamp:
type: integer
examples:
'0':
value: '{"server":[{"location":"US","asn":null,"asOrg":null,"tunnelTime":{"seconds":100},"dataTransferred":{"bytes":100}}],"accessKeys":[{"accessKeyId":"0","tunnelTime":{"seconds":100},"dataTransferred":{"bytes":100}}]}'
value: '{"server":{"tunnelTime":{"seconds":100},"dataTransferred":{"bytes":100},"bandwidth": {"current": {"data": {"bytes": 10},"timestamp": 1739284734},"peak": {"data": {"bytes": 80},"timestamp": 1738959398}},"locations": [{"location": "US","asn": null,"asOrg": null,"dataTransferred": {"bytes": 100},"tunnelTime": {"seconds": 100}}]},"accessKeys":[{"accessKeyId":0,"tunnelTime":{"seconds":100},"dataTransferred":{"bytes":100},"connection": {"lastTrafficSeen": 1739284734,"peakDeviceCount": {"data": 4,"timestamp": 1738959398}}}]}'
/name:
put:
description: Renames the server

View file

@ -202,7 +202,6 @@ describe('PrometheusManagerMetrics', () => {
"seconds": 1000
},
"connection": {
"lastConnected": 1738959398,
"lastTrafficSeen": 1739284734,
"peakDeviceCount": {
"data": 4,
@ -389,7 +388,6 @@ describe('PrometheusManagerMetrics', () => {
"seconds": 1000
},
"connection": {
"lastConnected": null,
"lastTrafficSeen": null,
"peakDeviceCount": {
"data": 0,
@ -406,7 +404,6 @@ describe('PrometheusManagerMetrics', () => {
"seconds": 0
},
"connection": {
"lastConnected": 1738959398,
"lastTrafficSeen": 1738959398,
"peakDeviceCount": {
"data": 4,

View file

@ -35,7 +35,6 @@ interface TimedData<T> {
}
interface ConnectionStats {
lastConnected: number | null;
lastTrafficSeen: number | null;
peakDeviceCount: TimedData<number>;
}
@ -211,8 +210,6 @@ export class PrometheusManagerMetrics implements ManagerMetrics {
}
for (const result of tunnelTimeByAccessKeyRange.result) {
const entry = getServerMetricsAccessKeyEntry(accessKeyMap, result.metric);
const lastConnected = findLastNonZero(result.values ?? []);
entry.connection.lastConnected = lastConnected ? Math.min(now, lastConnected[0]) : null;
const peakTunnelTimeSec = findPeak(result.values ?? []);
if (peakTunnelTimeSec !== null) {
const peakValue = parseFloat(peakTunnelTimeSec[1]);
@ -268,7 +265,6 @@ function getServerMetricsAccessKeyEntry(
dataTransferred: {bytes: 0},
tunnelTime: {seconds: 0},
connection: {
lastConnected: null,
lastTrafficSeen: null,
peakDeviceCount: {
data: 0,