Skip to content

Commit 0c0d99a

Browse files
MJarmohilmarf
andauthored
add Auth and metrics findings (#88)
* add Auth and metrics findings Signed-off-by: MJarmo <michal.jarmolkiewicz@sap.com> * cloned by test script Signed-off-by: Hilmar Falkenberg <hilmar.falkenberg@sap.com> * code:format Signed-off-by: Hilmar Falkenberg <hilmar.falkenberg@sap.com> * revert Signed-off-by: Hilmar Falkenberg <hilmar.falkenberg@sap.com> * task code:format Signed-off-by: Hilmar Falkenberg <hilmar.falkenberg@sap.com> * add section for mTLS Signed-off-by: Hilmar Falkenberg <hilmar.falkenberg@sap.com> --------- Signed-off-by: MJarmo <michal.jarmolkiewicz@sap.com> Signed-off-by: Hilmar Falkenberg <hilmar.falkenberg@sap.com> Co-authored-by: MJarmo <michal.jarmolkiewicz@sap.com> Co-authored-by: Hilmar Falkenberg <hilmar.falkenberg@sap.com>
1 parent 40c51a5 commit 0c0d99a

File tree

2 files changed

+156
-0
lines changed

2 files changed

+156
-0
lines changed

docs/Authentication.md

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
# Authentication
2+
3+
Summary of how authentication works in OpenTelemetry Collector using server- and client-side authenticators.
4+
5+
## Modes
6+
7+
- Server side: collector intercepts inbound HTTP/gRPC, extracts headers or query params, calls the server authenticator, returns
8+
401/Unauthenticated on failure, forwards with enriched context on success.
9+
- Client side: collector wraps outbound HTTP or gRPC with authenticator-provided credentials so every request carries required headers,
10+
tokens, or signing.
11+
12+
## Authenticator types
13+
14+
- Server (receivers): `basicauthextension`, `bearertokenauthextension`, `oidcauthextension`
15+
- Client (exporters): `asapauthextension`, `basicauthextension`, `bearertokenauthextension`, `oauth2clientauthextension`,
16+
`sigv4authextension`
17+
18+
## Notes
19+
20+
For example for client-side OAuth2 in the collector you need an OAuth2 authorization server that exposes a token endpoint. The oauth2client
21+
extension is configured with that server’s token_url, your client_id/client_secret (and optional scopes/audience/TLS). It will call the
22+
token endpoint to obtain/refresh access tokens and inject Authorization: Bearer token on exporter requests. Without a reachable OAuth2
23+
server, the extension cannot get tokens.
24+
25+
## Server-side example (basic auth)
26+
27+
```yaml
28+
extensions:
29+
basicauth/server:
30+
htpasswd: ./htpasswd # file with user:hashed-password entries
31+
32+
receivers:
33+
otlp:
34+
protocols:
35+
http:
36+
auth:
37+
authenticator: basicauth/server
38+
grpc:
39+
auth:
40+
authenticator: basicauth/server
41+
42+
exporters:
43+
debug: {}
44+
45+
service:
46+
extensions: [basicauth/server]
47+
pipelines:
48+
traces:
49+
receivers: [otlp]
50+
processors: []
51+
exporters: [debug]
52+
metrics:
53+
receivers: [otlp]
54+
processors: []
55+
exporters: [debug]
56+
```
57+
58+
## Client-side example (OAuth2)
59+
60+
```yaml
61+
extensions:
62+
oauth2client:
63+
client_id: my-client
64+
client_secret: supersecret
65+
token_url: https://auth.example.com/oauth/token
66+
scopes: [metrics.write]
67+
68+
exporters:
69+
otlphttp:
70+
endpoint: https://backend.example.com
71+
auth:
72+
authenticator: oauth2client
73+
74+
service:
75+
extensions: [oauth2client]
76+
pipelines:
77+
metrics:
78+
receivers: [otlp]
79+
processors: []
80+
exporters: [otlphttp]
81+
```
82+
83+
## References
84+
85+
- `opentelemetry-collector/config/configauth/README.md`
86+
87+
## mTLS
88+
89+
When using mutual TLS (mTLS) for authentication, both the client and server present their own certificates to verify each other's
90+
identities. For more details on setting up mTLS with OpenTelemetry Collector, refer to this guide:
91+
<https://dev.to/vipinvkmenon/setting-up-otel-collectors-for-mtls-4n4o>
92+
93+
### in short
94+
95+
#### mTLS receiver server
96+
97+
```yaml
98+
receivers:
99+
otlp:
100+
protocols:
101+
grpc:
102+
tls:
103+
cert_file: /etc/certs/server-tls.pem
104+
key_file: /etc/certs/server-tls.key
105+
client_ca_file: /etc/certs/ca.pem
106+
```
107+
108+
#### mTLS exporter client
109+
110+
```yaml
111+
exporters:
112+
otlp:
113+
tls:
114+
cert_file: /etc/certs/client-tls.pem
115+
key_file: /etc/certs/client-tls.key
116+
ca_file: /etc/certs/ca.pem
117+
```

docs/Metrics.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Log pipeline metrics
2+
3+
## Exporter send attempts (per exporter)
4+
5+
- `otelcol_exporter_sent_log_records`
6+
- `otelcol_exporter_send_failed_log_records`
7+
- Counted per send attempt; any non-nil error marks the whole batch as failed. Retries add more increments.
8+
9+
## Queue instrumentation (when `sending_queue` is enabled)
10+
11+
- Gauges: queue size and queue capacity (in batches).
12+
- Counters: enqueue failures for logs.
13+
- Histograms: batch size (items) and batch size (bytes) recorded at enqueue time.
14+
15+
## Consumed-side counters (behind feature gate)
16+
17+
- Item and byte counts as data leaves processors toward exporters, labeled per component/exporter.
18+
- Requires `telemetry.newPipelineTelemetry` to be enabled; size counter depends on telemetry level.
19+
20+
## Exporter helper chain
21+
22+
- `BaseExporter` composes: timeout → retry → obsreport (span + sent/failed counters) → optional queue wrapper → actual exporter.
23+
- Counts are taken before downstream mutation so batching processors do not change the numerator.
24+
- Spans are started per export call with attributes: exporter name and `data_type=logs`.
25+
26+
## Limitations and caveats
27+
28+
- Attempt-based counting means retries inflate sent/failed totals; not unique record counts.
29+
- No partial success visibility: any error marks the entire batch failed.
30+
- Queue metrics are batch-based; histograms emit only when queueing is enabled.
31+
- Profiles signal is not instrumented by obsreport/queue.
32+
- Size counters rely on telemetry level/gate; if disabled you see only item counts.
33+
34+
## What to watch
35+
36+
- Delivery health: `otelcol_exporter_send_failed_log_records` vs `otelcol_exporter_sent_log_records`.
37+
- Backpressure: `otelcol_exporter_queue_size` vs `queue_capacity`; watch enqueue-failure counter for drops.
38+
- Batch shape: `otelcol_exporter_queue_batch_send_size` and `otelcol_exporter_queue_batch_send_size_bytes`.
39+
- Pipeline loss/refusal (with gate on): consumed item/size counters plus refusal/failure attributes from obsconsumer wrappers.

0 commit comments

Comments
 (0)