Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES/7532.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Added OTEL_METRICS_DISPATCH_INTERVAL_MINUTES setting to allow configuring the periodic telemetry
dispatch interval (default: 5 minutes).
7 changes: 7 additions & 0 deletions docs/admin/reference/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,13 @@ Toggles the activation of OpenTelemetry instrumentation for monitoring and traci

Defaults to `False`.

### OTEL\_METRICS\_DISPATCH\_INTERVAL\_MINUTES

Defines the interval, in minutes, at which the task to collect the total space usage per domain
is dispatched.

Defaults to 5.

### REDACT\_UNSAFE\_EXCEPTIONS

When enabled, task errors that are not `PulpException` subclasses are sanitized to prevent sensitive data leakage, such as credentials, tokens, or signed URLs.
Expand Down
12 changes: 12 additions & 0 deletions pulpcore/app/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@

# opentelemetry settings
OTEL_ENABLED = False
OTEL_METRICS_DISPATCH_INTERVAL_MINUTES = 5
OTEL_PULP_API_HISTOGRAM_BUCKETS = []

# VulnerabilityReport settings
Expand Down Expand Up @@ -530,6 +531,16 @@
},
)

otel_metrics_dispatch_interval_validator = Validator(
"OTEL_METRICS_DISPATCH_INTERVAL_MINUTES",
is_type_of=(int, float),
gt=0,
messages={
"is_type_of": "{name} must be a number.",
"operations": "{name} must be greater than zero.",
},
)


def otel_middleware_hook(settings):
data = {"dynaconf_merge": True}
Expand Down Expand Up @@ -557,6 +568,7 @@ def otel_middleware_hook(settings):
json_header_auth_validator,
authentication_json_header_openapi_security_scheme_validator,
otel_pulp_api_histogram_buckets_validator,
otel_metrics_dispatch_interval_validator,
],
post_hooks=(otel_middleware_hook,),
)
Expand Down
2 changes: 1 addition & 1 deletion pulpcore/app/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ def configure_cleanup():

def configure_periodic_telemetry():
task_name = "pulpcore.app.tasks.telemetry.otel_metrics"
dispatch_interval = timedelta(minutes=5)
dispatch_interval = timedelta(minutes=settings.OTEL_METRICS_DISPATCH_INTERVAL_MINUTES)
name = "Emit OpenTelemetry metrics periodically"

if settings.OTEL_ENABLED and settings.DOMAIN_ENABLED:
Expand Down
Loading