Skip to content

Commit 9bc39df

Browse files
easyCZroboquat
authored andcommitted
[server] Remove gitpod_server_api_calls_user_total metric
1 parent b8e9226 commit 9bc39df

File tree

5 files changed

+2
-22
lines changed

5 files changed

+2
-22
lines changed

components/server/src/code-sync/code-sync-service.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import {
3131
import { log } from "@gitpod/gitpod-protocol/lib/util/logging";
3232
import { v4 as uuidv4 } from "uuid";
3333
import { accessCodeSyncStorage, UserRateLimiter } from "../auth/rate-limiter";
34-
import { increaseApiCallUserCounter } from "../prometheus-metrics";
3534
import { Config } from "../config";
3635
import { CachingBlobServiceClientProvider } from "@gitpod/content-service/lib/sugar";
3736

@@ -106,7 +105,6 @@ export class CodeSyncService {
106105
}
107106

108107
const id = req.user.id;
109-
increaseApiCallUserCounter(accessCodeSyncStorage, id);
110108
try {
111109
await UserRateLimiter.instance(this.config.rateLimiter).consume(id, accessCodeSyncStorage);
112110
} catch (e) {

components/server/src/prometheus-metrics.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ export function registerServerMetrics(registry: prometheusClient.Registry) {
1212
registry.registerMetric(apiConnectionClosedCounter);
1313
registry.registerMetric(apiCallCounter);
1414
registry.registerMetric(apiCallDurationHistogram);
15-
registry.registerMetric(apiCallUserCounter);
1615
registry.registerMetric(httpRequestTotal);
1716
registry.registerMetric(httpRequestDuration);
1817
registry.registerMetric(messagebusTopicReads);
@@ -75,16 +74,6 @@ export function observeAPICallsDuration(method: string, statusCode: number, dura
7574
apiCallDurationHistogram.observe({ method, statusCode }, duration);
7675
}
7776

78-
const apiCallUserCounter = new prometheusClient.Counter({
79-
name: "gitpod_server_api_calls_user_total",
80-
help: "Total amount of API calls per user",
81-
labelNames: ["method", "user"],
82-
});
83-
84-
export function increaseApiCallUserCounter(method: string, user: string) {
85-
apiCallUserCounter.inc({ method, user });
86-
}
87-
8877
const httpRequestTotal = new prometheusClient.Counter({
8978
name: "gitpod_server_http_requests_total",
9079
help: "Total amount of HTTP requests per express route",

components/server/src/websocket/websocket-connection-manager.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ import {
4040
increaseApiCallCounter,
4141
increaseApiConnectionClosedCounter,
4242
increaseApiConnectionCounter,
43-
increaseApiCallUserCounter,
4443
observeAPICallsDuration,
4544
apiCallDurationHistogram,
4645
} from "../prometheus-metrics";
@@ -377,12 +376,6 @@ class GitpodJsonRpcProxyFactory<T extends object> extends JsonRpcProxyFactory<T>
377376
}
378377

379378
protected async onRequest(method: string, ...args: any[]): Promise<any> {
380-
if (!this.rateLimiter.user.startsWith("session-")) {
381-
increaseApiCallUserCounter(method, this.rateLimiter.user);
382-
} else {
383-
increaseApiCallUserCounter(method, "anonymous");
384-
}
385-
386379
const span = TraceContext.startSpan(method, undefined);
387380
const ctx = { span };
388381
const userId = this.clientMetadata.userId;

operations/observability/mixins/meta/dashboards/components/meta-overview.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@
430430
"uid": "P4169E866C3094E38"
431431
},
432432
"exemplar": true,
433-
"expr": "sum(rate(gitpod_server_api_calls_user_total{cluster=~\"$cluster\", method=~\"ts.*\"}[5m])) by (cluster, method) * 60",
433+
"expr": "sum(rate(gitpod_server_api_calls_total{cluster=~\"$cluster\", method=~\"ts.*\"}[5m])) by (cluster, method) * 60",
434434
"interval": "",
435435
"legendFormat": "{{cluster}} {{method}}",
436436
"refId": "A"

operations/observability/mixins/meta/dashboards/components/server.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1134,7 +1134,7 @@
11341134
"uid": "$datasource"
11351135
},
11361136
"exemplar": true,
1137-
"expr": "sum(rate(gitpod_server_api_calls_user_total{cluster=~\"$cluster\", method=~\"ts.*\"}[5m])) by (cluster, method) * 60",
1137+
"expr": "sum(rate(gitpod_server_api_calls_total{cluster=~\"$cluster\", method=~\"ts.*\"}[5m])) by (cluster, method) * 60",
11381138
"interval": "",
11391139
"legendFormat": "{{cluster}} {{method}}",
11401140
"refId": "A"

0 commit comments

Comments
 (0)