Skip to content

Commit 4948d23

Browse files
committed
feat: Implements protobuf OpenTelemetry support
1 parent 8ba9416 commit 4948d23

File tree

23 files changed

+1133
-406
lines changed

23 files changed

+1133
-406
lines changed

Cargo.lock

Lines changed: 132 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "dispenser"
3-
version = "0.14.1"
3+
version = "0.15.0"
44
edition = "2021"
55
license = "MIT"
66

@@ -47,3 +47,6 @@ reqwest = { version = "0.12", default-features = false, features = ["json"] }
4747
x509-parser = "0.18.0"
4848
http = "1.4.0"
4949
axum = "0.8.8"
50+
opentelemetry-proto = { version = "0.31.0", features = ["gen-tonic-messages", "logs", "trace", "metrics", "with-serde"] }
51+
prost = "0.14.3"
52+
bytes = "1.11.1"

INSTALL.deb.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ wget ...
2121

2222

2323
```sh
24-
sudo apt install ./dispenser-0.14.1-0.x86_64.deb
24+
sudo apt install ./dispenser-0.15.0-0.x86_64.deb
2525
```
2626

2727
You can validate that it was successfully installed by switching to the

INSTALL.redhat.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ wget ...
2323

2424

2525
```sh
26-
sudo dnf install ./dispenser-0.14.1-0.x86_64.rpm
26+
sudo dnf install ./dispenser-0.15.0-0.x86_64.rpm
2727
```
2828

2929
You can validate that it was successfully installed by switching to the

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ Download the latest `.deb` or `.rpm` package from the [releases page](https://gi
4242

4343
```sh
4444
# Download the .deb package
45-
# wget https://github.com/ixpantia/dispenser/releases/download/v0.14.1/dispenser-0.14.1-0.x86_64.deb
45+
# wget https://github.com/ixpantia/dispenser/releases/download/v0.15.0/dispenser-0.15.0-0.x86_64.deb
4646

47-
sudo apt install ./dispenser-0.14.1-0.x86_64.deb
47+
sudo apt install ./dispenser-0.15.0-0.x86_64.deb
4848
```
4949

5050
### RHEL / CentOS / Fedora
@@ -53,7 +53,7 @@ sudo apt install ./dispenser-0.14.1-0.x86_64.deb
5353
# Download the .rpm package
5454
# wget ...
5555

56-
sudo dnf install ./dispenser-0.14.1-0.x86_64.rpm
56+
sudo dnf install ./dispenser-0.15.0-0.x86_64.rpm
5757
```
5858

5959
The installation process will:

TELEMETRY.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,14 @@ Dispenser supports several authentication methods via environment variables:
7575
Dispenser acts as a sidecar host for your services. When telemetry is enabled, Dispenser starts an **Ingestion Service** listening on.
7676

7777
* **Endpoint**: `http://0.0.0.0:4318`
78-
* **Protocol**: OTLP/HTTP (JSON)
78+
* **Protocol**: OTLP/HTTP (Protobuf with JSON fallback)
7979

8080
### Automatic Environment Variables
8181

8282
Dispenser automatically injects the following environment variables into all managed containers to simplify instrumentation:
8383

8484
* `OTEL_EXPORTER_OTLP_ENDPOINT="http://host.docker.internal:4318"`
85+
* `OTEL_EXPORTER_OTLP_PROTOCOL="http/protobuf"`
8586
* `OTEL_SERVICE_NAME="{service_name}"` (The name from your `service.toml`)
8687

8788
Standard OTel SDKs will automatically detect these variables and begin shipping logs and traces to Dispenser without further configuration.
@@ -146,8 +147,8 @@ Stores structured logs emitted by applications via OTel.
146147
| `body` | `STRING` | The log message. |
147148
| `trace_id` | `STRING` | Associated trace ID (hex). |
148149
| `span_id` | `STRING` | Associated span ID (hex). |
149-
| `attributes` | `MAP<STRING, STRING>` | Flattened log attributes. |
150-
| `resource` | `MAP<STRING, STRING>` | Resource attributes (pod, node, etc). |
150+
| `attributes` | `STRING` | JSON string of log attributes. |
151+
| `resource` | `STRING` | JSON string of resource attributes (pod, node, etc). |
151152

152153
### Traces Table (`dispenser-traces`)
153154

@@ -167,7 +168,8 @@ Stores distributed tracing spans.
167168
| `status_code` | `STRING` | OK, ERROR. |
168169
| `status_message` | `STRING` | Error description. |
169170
| `service` | `STRING` | Service name. |
170-
| `attributes` | `MAP<STRING, STRING>` | Span attributes. |
171+
| `attributes` | `STRING` | JSON string of span attributes. |
172+
| `events` | `ARRAY<STRUCT>` | Span events with `timestamp`, `name`, and `attributes`. |
171173

172174
### Container Output Table (`dispenser-container-output`)
173175

src/cli.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,20 @@ static ARGS: OnceLock<Args> = OnceLock::new();
5656
pub fn get_cli_args() -> &'static Args {
5757
ARGS.get_or_init(Args::parse)
5858
}
59+
60+
#[cfg(test)]
61+
mod tests {
62+
use super::*;
63+
64+
#[test]
65+
fn test_signal_conversion() {
66+
assert_eq!(
67+
nix::sys::signal::Signal::from(Signal::Reload),
68+
nix::sys::signal::Signal::SIGHUP
69+
);
70+
assert_eq!(
71+
nix::sys::signal::Signal::from(Signal::Stop),
72+
nix::sys::signal::Signal::SIGINT
73+
);
74+
}
75+
}

0 commit comments

Comments
 (0)