diff options
author | Chocobozzz <me@florianbigard.com> | 2023-02-27 13:53:54 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-02-27 13:53:54 +0100 |
commit | 8d1f78044ca6eb9995001d3ab83be62460e043a6 (patch) | |
tree | 5b0cf63de96fdc67ef7aaa10af4969d9578406f0 /server/tests/api | |
parent | 5b94394a1a6d471f897d14ac62fe7bec5f9a74c2 (diff) | |
download | PeerTube-8d1f78044ca6eb9995001d3ab83be62460e043a6.tar.gz PeerTube-8d1f78044ca6eb9995001d3ab83be62460e043a6.tar.zst PeerTube-8d1f78044ca6eb9995001d3ab83be62460e043a6.zip |
Add ability to disable http duration OTEL metrics
Diffstat (limited to 'server/tests/api')
-rw-r--r-- | server/tests/api/check-params/users-emails.ts | 3 | ||||
-rw-r--r-- | server/tests/api/server/open-telemetry.ts | 27 |
2 files changed, 27 insertions, 3 deletions
diff --git a/server/tests/api/check-params/users-emails.ts b/server/tests/api/check-params/users-emails.ts index 8cfb1d15f..6ebcc8ffe 100644 --- a/server/tests/api/check-params/users-emails.ts +++ b/server/tests/api/check-params/users-emails.ts | |||
@@ -1,5 +1,4 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
2 | import { MockSmtpServer } from '@server/tests/shared' | ||
3 | import { HttpStatusCode, UserRole } from '@shared/models' | 2 | import { HttpStatusCode, UserRole } from '@shared/models' |
4 | import { cleanupTests, createSingleServer, makePostBodyRequest, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' | 3 | import { cleanupTests, createSingleServer, makePostBodyRequest, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' |
5 | 4 | ||
@@ -112,8 +111,6 @@ describe('Test users API validators', function () { | |||
112 | }) | 111 | }) |
113 | 112 | ||
114 | after(async function () { | 113 | after(async function () { |
115 | MockSmtpServer.Instance.kill() | ||
116 | |||
117 | await cleanupTests([ server ]) | 114 | await cleanupTests([ server ]) |
118 | }) | 115 | }) |
119 | }) | 116 | }) |
diff --git a/server/tests/api/server/open-telemetry.ts b/server/tests/api/server/open-telemetry.ts index db76a3d7f..49f3b520b 100644 --- a/server/tests/api/server/open-telemetry.ts +++ b/server/tests/api/server/open-telemetry.ts | |||
@@ -29,6 +29,8 @@ describe('Open Telemetry', function () { | |||
29 | }) | 29 | }) |
30 | 30 | ||
31 | it('Should enable open telemetry metrics', async function () { | 31 | it('Should enable open telemetry metrics', async function () { |
32 | this.timeout(120000) | ||
33 | |||
32 | server = await createSingleServer(1, { | 34 | server = await createSingleServer(1, { |
33 | open_telemetry: { | 35 | open_telemetry: { |
34 | metrics: { | 36 | metrics: { |
@@ -37,8 +39,12 @@ describe('Open Telemetry', function () { | |||
37 | } | 39 | } |
38 | }) | 40 | }) |
39 | 41 | ||
42 | // Simulate a HTTP request | ||
43 | await server.videos.list() | ||
44 | |||
40 | const res = await makeRawRequest({ url: metricsUrl, expectedStatus: HttpStatusCode.OK_200 }) | 45 | const res = await makeRawRequest({ url: metricsUrl, expectedStatus: HttpStatusCode.OK_200 }) |
41 | expect(res.text).to.contain('peertube_job_queue_total{') | 46 | expect(res.text).to.contain('peertube_job_queue_total{') |
47 | expect(res.text).to.contain('http_request_duration_ms_bucket{') | ||
42 | }) | 48 | }) |
43 | 49 | ||
44 | it('Should have playback metrics', async function () { | 50 | it('Should have playback metrics', async function () { |
@@ -64,6 +70,27 @@ describe('Open Telemetry', function () { | |||
64 | expect(res.text).to.contain('peertube_playback_http_downloaded_bytes_total{') | 70 | expect(res.text).to.contain('peertube_playback_http_downloaded_bytes_total{') |
65 | }) | 71 | }) |
66 | 72 | ||
73 | it('Should disable http request duration metrics', async function () { | ||
74 | await server.kill() | ||
75 | |||
76 | server = await createSingleServer(1, { | ||
77 | open_telemetry: { | ||
78 | metrics: { | ||
79 | enabled: true, | ||
80 | http_request_duration: { | ||
81 | enabled: false | ||
82 | } | ||
83 | } | ||
84 | } | ||
85 | }) | ||
86 | |||
87 | // Simulate a HTTP request | ||
88 | await server.videos.list() | ||
89 | |||
90 | const res = await makeRawRequest({ url: metricsUrl, expectedStatus: HttpStatusCode.OK_200 }) | ||
91 | expect(res.text).to.not.contain('http_request_duration_ms_bucket{') | ||
92 | }) | ||
93 | |||
67 | after(async function () { | 94 | after(async function () { |
68 | await server.kill() | 95 | await server.kill() |
69 | }) | 96 | }) |