Skip to content

Commit beafa8b

Browse files
committed
docs: add settings documentation to otel.py and generate documentation
1 parent bbb34dd commit beafa8b

File tree

4 files changed

+34
-5
lines changed

4 files changed

+34
-5
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,4 @@ repos:
9999
entry: pixi run -e default python scripts/generate_settings_docs.py
100100
language: system
101101
pass_filenames: false
102-
files: ^(diracx-.*/src/diracx/.*/settings\.py|docs/.*\.j2|docs/templates/.*\.jinja|scripts/generate_settings_docs\.py)$
102+
files: ^(diracx-.*/src/diracx/.*/settings\.py|diracx-routers/src/diracx/routers/otel\.py|docs/.*\.j2|docs/templates/.*\.jinja|scripts/generate_settings_docs\.py)$

diracx-routers/src/diracx/routers/otel.py

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,34 @@
3535
class OTELSettings(ServiceSettingsBase):
3636
"""Settings for the Open Telemetry Configuration."""
3737

38-
model_config = SettingsConfigDict(env_prefix="DIRACX_OTEL_")
38+
model_config = SettingsConfigDict(
39+
env_prefix="DIRACX_OTEL_", use_attribute_docstrings=True
40+
)
3941

4042
enabled: bool = False
43+
"""
44+
Whether OpenTelemetry is enabled.
45+
"""
46+
4147
application_name: str = "diracx"
48+
"""
49+
The name of the application for OpenTelemetry.
50+
"""
51+
4252
grpc_endpoint: str = ""
53+
"""
54+
The gRPC endpoint for the OpenTelemetry collector.
55+
"""
56+
4357
grpc_insecure: bool = True
44-
# headers to pass to the OTEL Collector
45-
# e.g. {"tenant_id": "lhcbdiracx-cert"}
58+
"""
59+
Whether to use an insecure gRPC connection for the OpenTelemetry collector.
60+
"""
61+
4662
headers: Optional[dict[str, str]] = None
63+
"""
64+
A JSON-encoded dictionary of headers to pass to the OpenTelemetry collector, e.g. {"tenant_id": "lhcbdiracx-cert"}.
65+
"""
4766

4867

4968
def instrument_otel(app: FastAPI) -> None:

docs/admin/reference/env-variables.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,18 +189,28 @@ Settings for the Open Telemetry Configuration.
189189

190190
*Optional*, default value: `False`
191191

192+
Whether OpenTelemetry is enabled.
193+
192194
### `DIRACX_OTEL_APPLICATION_NAME`
193195

194196
*Optional*, default value: `diracx`
195197

198+
The name of the application for OpenTelemetry.
199+
196200
### `DIRACX_OTEL_GRPC_ENDPOINT`
197201

198202
*Optional*, default value: \`\`
199203

204+
The gRPC endpoint for the OpenTelemetry collector.
205+
200206
### `DIRACX_OTEL_GRPC_INSECURE`
201207

202208
*Optional*, default value: `True`
203209

210+
Whether to use an insecure gRPC connection for the OpenTelemetry collector.
211+
204212
### `DIRACX_OTEL_HEADERS`
205213

206214
*Optional*, default value: `None`
215+
216+
A JSON-encoded dictionary of headers to pass to the OpenTelemetry collector, e.g. {"tenant_id": "lhcbdiracx-cert"}.

pixi.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[workspace]
22
channels = ["conda-forge"]
3-
platforms = ["linux-64", "osx-arm64"]
3+
platforms = ["linux-64", "osx-arm64", "osx-64"]
44

55
[dependencies]
66
python = ">=3.11.3,<3.12"

0 commit comments

Comments
 (0)