metrics: improve tests (#5686)

This commit is contained in:
Alessandro Ros
2026-04-24 18:26:54 +02:00
committed by GitHub
parent 43d649d791
commit 4c10d7e7c8
4 changed files with 934 additions and 81 deletions
+2 -2
View File
@@ -298,7 +298,7 @@ Username and password can be passed through the `Authorization: Basic` HTTP head
Authorization: Basic base64(myuser:mypass)
```
When using a web browser, a dialog is first shown to users, asking for credentials, and then the header is automatically inserted into every request. If you need to automatically fill credentials from a parent web page, read [Embed streams in a website](../4-read/13-web-browsers.md#embed-streams-in-a-website).
When using a web browser, a dialog is first shown to users, asking for credentials, and then the header is automatically inserted into every request. If you need to automatically fill credentials from a parent web page, read [Embed in a website](../4-read/13-web-browsers.md#embed-in-a-website).
If the `Authorization: Basic` header cannot be used (for instance, in software like OBS Studio, which only allows to provide a "Bearer Token"), credentials can be passed through the `Authorization: Bearer` header (i.e. the "Bearer Token" in OBS), where the value is the concatenation of username and password, separated by a colon:
@@ -350,4 +350,4 @@ In OBS Studio, this is the "Bearer Token" field.
If the `Authorization: Bearer` token cannot be directly provided (for instance, with web browsers that directly access _MediaMTX_ and show a credential dialog), you can pass the token as password, using an arbitrary user.
In web browsers, if you need to automatically fill credentials from a parent web page, read [Embed streams in a website](../4-read/13-web-browsers.md#embed-streams-in-a-website).
In web browsers, if you need to automatically fill credentials from a parent web page, read [Embed in a website](../4-read/13-web-browsers.md#embed-in-a-website).
+2 -2
View File
@@ -7,7 +7,7 @@ This server can be enabled by setting `metrics: yes` in the configuration.
Metrics can be extracted with Prometheus or with a simple HTTP request:
```
curl localhost:9998/metrics
curl http://localhost:9998/metrics
```
Obtaining:
@@ -150,7 +150,7 @@ Bitrates are not provided directly as metrics because they can be computed from
Metrics can be filtered by using HTTP query parameters:
- `type=[TYPE]`: show metrics of a certain type only (where TYPE can be `paths`, `hls_muxers`, `rtsp_conns`, `rtsp_sessions`, `rtsps_conns`, `rtsps_sessions`, `rtmp_conns`, `rtmps_conns`, `srt_conns`, `webrtc_sessions`)
- `type=[TYPE]`: show metrics of a certain type only. TYPE can be `paths`, `hls_muxers`, `rtsp_conns`, `rtsp_sessions`, `rtsps_conns`, `rtsps_sessions`, `rtmp_conns`, `rtmps_conns`, `srt_conns`, `webrtc_sessions`.
- `path=[PATH]`: show metrics belonging to a specific path only
- `hls_muxer=[PATH]`: show metrics belonging to a specific HLS muxer only
- `rtsp_conn=[ID]` show metrics belonging to a specific RTSP connection only
+5 -3
View File
@@ -2,7 +2,9 @@
Web browsers can read a stream from the server by using the WebRTC or the HLS protocol.
## Web browsers and WebRTC
## Direct read
### WebRTC
You can read a stream by using the [WebRTC protocol](02-webrtc.md) by visiting the web page:
@@ -10,7 +12,7 @@ You can read a stream by using the [WebRTC protocol](02-webrtc.md) by visiting t
http://localhost:8889/mystream
```
## Web browsers and HLS
### HLS
Web browsers can also read a stream with the [HLS protocol](05-hls.md). Latency is higher but there are fewer problems related to connectivity between server and clients. Visit the web page:
@@ -18,7 +20,7 @@ Web browsers can also read a stream with the [HLS protocol](05-hls.md). Latency
http://localhost:8888/mystream
```
## Embed streams in a website
## Embed in a website
Live streams can be embedded into an external website by using the WebRTC or HLS protocol. Before embedding, check that the stream is ready and can be accessed with intended protocol by visiting web pages mentioned in the previous section.
File diff suppressed because it is too large Load Diff