Skip to content

Commit e77fdb9

Browse files
committed
Make telemetry task dispatch interval configurable
Assisted By: claude-opus-4.6
1 parent 3cd99e7 commit e77fdb9

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

pulpcore/app/settings.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,7 @@
417417

418418
# opentelemetry settings
419419
OTEL_ENABLED = False
420+
OTEL_METRICS_DISPATCH_INTERVAL_MINUTES = 5
420421
OTEL_PULP_API_HISTOGRAM_BUCKETS = []
421422

422423
# VulnerabilityReport settings
@@ -530,6 +531,16 @@
530531
},
531532
)
532533

534+
otel_metrics_dispatch_interval_validator = Validator(
535+
"OTEL_METRICS_DISPATCH_INTERVAL_MINUTES",
536+
is_type_of=(int, float),
537+
gt=0,
538+
messages={
539+
"is_type_of": "{name} must be a number.",
540+
"operations": "{name} must be greater than zero.",
541+
},
542+
)
543+
533544

534545
def otel_middleware_hook(settings):
535546
data = {"dynaconf_merge": True}
@@ -557,6 +568,7 @@ def otel_middleware_hook(settings):
557568
json_header_auth_validator,
558569
authentication_json_header_openapi_security_scheme_validator,
559570
otel_pulp_api_histogram_buckets_validator,
571+
otel_metrics_dispatch_interval_validator,
560572
],
561573
post_hooks=(otel_middleware_hook,),
562574
)

pulpcore/app/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ def configure_cleanup():
486486

487487
def configure_periodic_telemetry():
488488
task_name = "pulpcore.app.tasks.telemetry.otel_metrics"
489-
dispatch_interval = timedelta(minutes=5)
489+
dispatch_interval = timedelta(minutes=settings.OTEL_METRICS_DISPATCH_INTERVAL_MINUTES)
490490
name = "Emit OpenTelemetry metrics periodically"
491491

492492
if settings.OTEL_ENABLED and settings.DOMAIN_ENABLED:

0 commit comments

Comments
 (0)