Upgrading¶
This page has two guides. Use the first when you move from release 2.4.0 to this release. Use the second first when you come from a release older than 2.4.0, then the first.
- From 2.4.0 to this release. The config has one layout
with one set of rules: unknown keys fail the load, durations and sizes are
written with units, a service is declared once under
connections, and every feature is optional and says what it needs. There is no migration tool. The old keys are not read, and the guide below lists every one of them with its new place. - To 2.4.0 from an older release. Release 2.4.0 moved the settings for files, archives, worker discovery and cache exchange into new sections.
Upgrading from 3.1.0 to this release¶
A worker that does not turn the new features on works as before. What is
new for it is listed under item 3: one token in the config summary line, more pending offsets after a parse failure under raise,
new metric families at 0, and a new config section.
BaseDrakkarHandlerhas four new members:detach,attach,detach_stateandrequest_stop(see Detach). A handler class that already defines its own attribute or method with one of these names hides the framework member. Rename yours to use the new ones.- The detach feature is off by default. To use it, turn on
autodiscoverandsources.kafka.detach.enabled; to give operators the Live-page control, alsoui.detach_enabled. - The split feature is off by default. A worker with
split.enabled: falsebehaves as before. Its handler is not checked for the new hook names: a handler that already has its ownsplit,part_data,part_key,aggregate,on_job_timeout,http_job_resultorpart_data_modelstarts as before, and the framework never calls them. A handler with a method namedsplitlogssplit_disabledonce (level info). Four things are new for such a worker:- The config summary line of the start has one more token,
split=off, aftersources=[...]. Change a parser of that line. - The seventeen
drakkar_split_*metric families exist, with the value 0. - The root config accepts a
splitsection. Withsplit.enabled: falseonly its own values are checked (the ranges, the two timeouts, the form of theaggregate_sinksentries); no other key of your config is read by these checks. - Under
sources.kafka.on_parse_error: raise, a message that fails to parse leaves every offset of its window pending, not only its own. The commit could not pass that message before either; only the pending count of the partition is higher.
- The config summary line of the start has one more token,
Before you set split.enabled: true: BaseDrakkarHandler has the new
hooks split, part_data, aggregate and on_job_timeout and the class
attribute part_data_model, so rename a member of your handler that has
one of these names for another purpose (with the feature on, the start
fails when the handler has one of them without split, and when split
is not an async generator). The DLQ record gets two new values of
dk-stage, split and aggregate; check consumers of the DLQ topic
that read that header. The source topic, the parts topic, the results
topic and the DLQ topic must be four different topics. Create the parts
topic and the results topic (the results topic with the partition count
of the source topic), give the worker the rights on them and on the two
new consumer groups, set split.aggregate_sinks, and make your sinks
accept repeats. See Split.
Upgrading from 3.0.3 to 3.1.0¶
Every message now has a request id, and one handler hook names it.
logging.message_identityis gone. Delete the block. Each Kafka message now has arequest_id, which every log line of its processing carries. To keep the value yoursourcenamed, return it from the hook:source: header:x-request-idbecomes arequest_id(msg)that reads that header frommsg.headers, andsource: value:order.idone that readsmsg.payload. Log queries change from yourname(for exampleorder_id) torequest_id.message_identity(msg, configured)andhttp_request_id(req, headers)becomerequest_id(msg). It is called for Kafka messages and HTTP requests. For an HTTP requestmsg.topicis__webapp__,msg.headersholds the request headers,msg.valuethe raw body andmsg.payloadthe parsed request. Return a text of at most 64 ASCII characters with no whitespace. An invalid answer or a raise no longer answers 500; it gets a generated id and logsrequest_id_hook_failed.- Generated ids have a new form,
req_<UTC time>_<8 hex>_<counter>. Code that parses an id should not depend on its form. - Kafka rows and DLQ records now carry the id. Recorder rows of Kafka
tasks and messages have the
request_idcolumn set, and the DLQ record of a Kafka message has adk-request-idheader. A tool that read “request_idis set” as “this is an HTTP request” must readorigin(http) instead. - With
logging.format: ecsyou can rename thedrakkarobject withlogging.ecs_namespace, and copyrequest_idto the root withlogging.ecs_request_id_at_root: true.
Upgrading from 2.4.0 to this release¶
This release is not backward compatible. A config written for 2.4.0 fails to load, and the message lists every key that must change. The release changes these things:
- Every key has its final name and place. A name carries no unit; the value does.
- Services (Kafka, Postgres, Redis, Mongo, Consul) are declared once under
connections, and sources, sinks, the DLQ, the recorder and autodiscover name them. - The flight recorder is a section of its own,
recorder, and it does not depend on the UI. The HTTP server is a section of its own,api. - The worker registry and the election of cluster tasks are one optional feature,
autodiscover, with one provider. - The DLQ record is the original message, and every sink declares a failure policy.
- The recorder can keep its history in Postgres and recent events in memory.
- The archive has a cluster scope and an own-files scope.
- Each worker keeps its own files in its own folder
<storage.dir>/<cluster>/<worker>/, and a worker name must be a safe word. - Plugins,
periodic.tasks, the throughput feature and thestaticregistry are removed. - Backpressure counts tasks and bytes: new windows wait for room under
executor.max_pending_tasksandexecutor.max_pending_bytes, and the Kafka fetch pauses atsources.kafka.max_queued_messages. The twoexecutor.backpressure_*_multiplierkeys are removed. Task output counts in the pending bytes while its hooks and delivery run, so large outputs slow intake. - The queue of rows waiting for the recorder file has a byte bound,
recorder.sqlite.max_queue. - A task’s
durationends at the process exit, read off the event loop, so it can be shorter on a busy worker (see Task run time).
1. Plan the upgrade¶
Work in this order:
- Drain the old DLQ topic, or give the new workers a new
dlq.topic(the DLQ record). Records written by an older worker are not replayed by the new tool. - Decide how to roll out. The archive lock moved, so a worker of 2.4.0 and
a worker of this release cannot see each other’s lock. Stop every worker,
upgrade and start them again; or set
recorder.archive.enabled: falseon every worker during the rolling restart and turn it back on at the end (the archive lock). The registry card, the sealed recorder files, the meta files and the cache exchange route keep their format, so workers of both releases read each other’s cards and files. - Rewrite the config with the steps and the table of every old key.
- Change the handler code (handler and code changes).
- Update log queries, dashboards and alerts (behaviour).
- Start one worker and read the load message. Repeat until it starts (check the result).
- Delete the old files and tables (old files).
2. The rules of the layout¶
Learn these once. Every section follows them.
-
Unknown keys fail the load, in the YAML file and in a
DK_variable. One message lists them all, in sorted order, with the closest valid key:config has unknown keys (YAML paths; as env vars they are DK_ plus the path with "__"; see docs/config-reference.md): sinks.kafka.results.max_retires (did you mean 'max_retries'?) ui.recorderA list element is written
[i], for exampleui.timeline.events[2].colour. The names you choose (a sink instance, a connection) are not checked, but the keys below them are. The free mapsapp,executor.env,headersof an HTTP sink,statements,scriptsandclient_configaccept any key. 2. The top level answers operator questions, in this order:worker,cluster,connections,sources,executor,threads,sinks,dlq,storage,recorder,cache,autodiscover,metrics,logging,runtime_health,api,ui,app. 3. A service is declared once.connections.<kind>.<name>(kindskafka,postgres,redis,mongo,consul) says how to reach a service and how to log in. A consumer saysconnection: <name>; the default name ismain. The entry must be declared, or the load fails with<path>.connection '<name>' is not defined under connections.<kind>. The checked consumers are an enabled Kafka source, every configured sink of a connection kind, the DLQ when it has a destination,recorder.postgreswhen the recorder is enabled with providerpostgres, andautodiscoverwhen enabled with providerconsul,postgresorredis. A Kafka cluster not namedmaintherefore needssources.kafka.connection,dlq.connectionand theconnectionof each Kafka sink. A different login to one server is a different connection. Each sink owns its client or pool. 4. Choice plus block.recorder.provider(sqliteorpostgres) selects an implementation;recorder.sqliteandrecorder.postgreshold its settings. The block of the provider you do not select loads and does nothing. 5. Switches. A feature with settings is a block withenabled(autodiscover.enabled,recorder.annotations.enabled). A switch with no other setting is a flat<feature>_enabled(ui.merge_enabled). 6. Limits.0means no limit.nullmeans “not given: derive it”. A limit ismax_<thing>. 7. Units are in the value, not in the name. A duration is0or terms of<number><unit>with no spaces, unitsd,h,m,s,msin descending order, each at most once:30s,2h45m,1.5h,500ms,30d. A size is0or one<number><unit>with unitB,KB,MB,GB,TB(1000) orKiB,MiB,GiB,TiB(1024):64KiB,256MB. A bare number other than0is refused. An environment variable takes the same text (DK_EXECUTOR__TASK_TIMEOUT=5m). Some keys take whole seconds, hours or days only;90sfor a key that counts whole minutes fails. The messages:<path> needs a unit, for example 30s; got '30' <path> is not a duration, got '5 min'; write for example 30s or 2h45m <path> needs a unit, for example 64KiB; got '65536' <path> is not a size, got '64kb'; write for example 64KiB or 256MB <path> must be a whole number of seconds, got '1500ms' <path> must be from 16MiB to 512MiB, got 600MiB <path> must be at least 1s, got 0(
hours,minutesanddaysreplacesecondsfor the keys that count in them.) A range message prints the bounds and the value with units, never as bare seconds or bytes. 8. One failure vocabulary.timeout,max_retries(retries after the first attempt),backoff,max_backoff,breaker_failures,breaker_cooldown. A sink’s budget isdelivery_timeout. A failure event ison_<event>: <action>. 9. Shallow. At mostsection.block.key, not counting the names you choose and the Kafkasecurityblock. 10. Environment variables areDK_plus the new path in upper case with__between the levels. A name that you chose in YAML (main-db) is reached by its upper-case form with_:DK_SINKS__POSTGRES__MAIN_DB__POOL_MAXsetssinks.postgres.main-db.pool_max. When two declared names differ only by case or by-against_, such a variable fails the load.
Every feature is optional. A worker can run its main loop only. Each feature and what it needs:
| Feature | Switch | Needs |
|---|---|---|
API server, /healthz, /readyz, peer routes |
api.enabled |
nothing |
Operator UI, /ws, /api/v1/*, docs |
ui.enabled |
api.enabled |
| Kafka source | sources.kafka.enabled |
connections.kafka.<connection> |
Sinks (kafka, postgres, mongo, redis) |
the instance | connections.<kind>.<connection> |
| DLQ | dlq.enabled |
connections.kafka.<dlq.connection> and a topic |
| Recorder, memory store | recorder.enabled or ui.enabled |
the memory store needs ui.enabled |
Recorder, provider sqlite |
recorder.enabled |
storage.dir |
Recorder, provider postgres |
recorder.enabled |
connections.postgres.<recorder.postgres.connection> |
| Archive | recorder.archive.enabled |
provider sqlite, storage.dir; the cluster scope also needs autodiscover and storage.shared_dir |
| Autodiscover | autodiscover.enabled |
autodiscover.provider, api.enabled; filesystem needs storage.shared_dir; consul, postgres and redis need their connection |
| Cluster-scope periodic tasks | @periodic(scope='cluster') |
autodiscover |
| Cache | cache.enabled |
storage.dir for persistence |
| Cache exchange | cache.exchange.enabled |
cache.enabled, storage.dir, autodiscover |
3. Migrate the config, step by step¶
Do the steps in order. After each one you can start a worker: the load message lists what is left.
- Find your keys. Search the YAML files and the environment (Kubernetes
manifests,
.envfiles, CI variables) for keys of the table. An environment variable isDK_plus the YAML path with__between the levels, soDK_KAFKA__BROKERSiskafka.brokers. - Declare the services. Move the root
kafka:section toconnections.kafka.main, every key unchanged (brokers,security,client_config,ui_url,ui_cluster_name). A config with the Kafka source on needs this entry even when empty (main: {}), because the source and the DLQ namemainby default. Move eachdsn,uriandurlof a Postgres, Mongo or Redis sink to an entry underconnections.postgres,connections.mongoorconnections.redis, and name the entry in the sink’sconnection. Sinks that used one server can share one entry. A Kafka sink or the DLQ that has its ownbrokersgets an entry of its own (move itsbrokersandsecuritythere) and names it inconnection. Theclient_configof a sink or of the DLQ stays on it; it is now merged after the connection’s, so the sink wins on a shared key. A Postgres entry also holdsschema,manage_schemaand apool_minandpool_maxfor the autodiscover tables; the sink’s ownpool_minandpool_maxstay on the sink. Put secrets (dsn,uri,url,token, SASL and key passwords) in the environment:DK_CONNECTIONS__POSTGRES__MAIN__DSN. - Rename the keys and write the units. Follow the table.
120seconds is2m,500milliseconds is500ms,1048576bytes is1MiB. The environment values change the same way:DK_EXECUTOR__TASK_TIMEOUT_SECONDS=300becomesDK_EXECUTOR__TASK_TIMEOUT=5m. - Choose the recorder.
ui.recorder.persistenceis gone. Unset with astorage.dir: write nothing (recorder.enableddefaults totrue, the provider tosqlite). Unset with an emptystorage.dir, ornone:recorder.enabled: false.sqlite:recorder.provider: sqlite.postgres:recorder.provider: postgres. A worker withui.enabled: falsenow records intostorage.dirtoo; setrecorder.enabled: falseto keep it as it was. - Choose the API and the UI.
ui.host,ui.portandui.public_urlareapi.host,api.portandapi.public_url.ui.enabled: falseno longer closes the port: the worker still serves/healthz,/readyzand the peer route. To open no port at all, setapi.enabled: falseas well. - Choose autodiscover. If the workers use the workers list, the cache exchange or
a cluster task, set
autodiscover.enabled: trueand oneautodiscover.provider(filesystem,postgres,redisorconsul) for the registry and the election. Withfilesystem, setstorage.shared_dirto the folder you used asshared.dir; it no longer falls back tostorage.dir. The default is off. - Delete the removed keys:
sinks.custom,throughput,periodic,fleet.registry.static,fleet.registry.filesystem.dir,fleet.registry.consul.mode,fleet.registry.consul.service_name,fleet.registry.redis,fleet.registry.postgres, everyplugin_options,executor.backpressure_high_multiplier,executor.backpressure_low_multiplier, and the top-levelwebapp:section (it issources.http). - Start a worker. Read the message, fix the keys it lists, start again. Then read Check the result.
A config before and after (the keys that change; a Kubernetes ConfigMap holds the
same YAML):
# before
kafka:
brokers: kafka-1:9092
sources:
kafka: {enabled: true, session_timeout_ms: 45000}
executor:
task_timeout_seconds: 300
sinks:
postgres:
results:
dsn: postgresql://app@db/app
dlq: {flush_timeout_seconds: 30}
ui:
port: 8080
recorder: {persistence: sqlite, rotation_interval_hours: 1}
history:
archive: {retention_days: 30}
shared: {dir: /mnt/fleet}
fleet:
registry: {provider: filesystem, offline_after_seconds: 60}
# after
connections:
kafka:
main: {brokers: "kafka-1:9092"}
postgres:
main: {dsn: "postgresql://app@db/app"} # better: DK_CONNECTIONS__POSTGRES__MAIN__DSN
sources:
kafka: {enabled: true, session_timeout: 45s}
executor:
task_timeout: 5m
sinks:
postgres:
results: {connection: main}
dlq: {flush_timeout: 30s}
api: {port: 8080}
recorder:
provider: sqlite
sqlite: {rotation_interval: 1h}
archive: {retention: 30d}
storage: {shared_dir: /mnt/fleet}
autodiscover: {enabled: true, provider: filesystem, offline_after: 1m}
4. Every old key and its new place¶
One row for every key of the previous layout. * is a name that you choose (a sink
instance, a connection). <entry> is a name under connections.<kind>. A path that
ends in [] is a list element. The environment variable of a new path is DK_ plus
the path in upper case with __; a value takes the same text as in YAML. A row
that says “unchanged” keeps its path, its default and its meaning.
| Old path | New path | How to write the value |
|---|---|---|
worker_name_env |
worker.name_env |
|
cluster_name |
cluster.name |
|
cluster_name_env |
cluster.name_env |
|
kafka.brokers |
connections.kafka.main.brokers |
|
kafka.security.protocol |
connections.kafka.main.security.protocol |
|
kafka.security.sasl_mechanism |
connections.kafka.main.security.sasl_mechanism |
|
kafka.security.sasl_username |
connections.kafka.main.security.sasl_username |
|
kafka.security.sasl_password |
connections.kafka.main.security.sasl_password |
|
kafka.security.ssl_ca_location |
connections.kafka.main.security.ssl_ca_location |
|
kafka.security.ssl_certificate_location |
connections.kafka.main.security.ssl_certificate_location |
|
kafka.security.ssl_key_location |
connections.kafka.main.security.ssl_key_location |
|
kafka.security.ssl_key_password |
connections.kafka.main.security.ssl_key_password |
|
kafka.security.ssl_endpoint_identification_algorithm |
connections.kafka.main.security.ssl_endpoint_identification_algorithm |
|
kafka.client_config |
connections.kafka.main.client_config |
|
kafka.ui_url |
connections.kafka.main.ui_url |
|
kafka.ui_cluster_name |
connections.kafka.main.ui_cluster_name |
|
executor.binary_path |
unchanged | |
executor.env |
unchanged | |
executor.env_inherit_parent |
unchanged | |
executor.env_inherit_deny |
unchanged | |
executor.max_executors |
unchanged | |
executor.task_timeout_seconds |
executor.task_timeout |
120 is 2m; whole seconds |
executor.max_stdout_bytes |
executor.max_stdout |
a size; 0 is no limit |
executor.max_stderr_bytes |
executor.max_stderr |
a size; 0 is no limit |
executor.window_size |
unchanged | |
executor.max_retries |
unchanged | |
executor.on_failure |
unchanged | |
executor.drain_timeout_seconds |
executor.drain_timeout |
30 is 30s; whole seconds |
executor.backpressure_high_multiplier |
removed | The Kafka fetch pauses at sources.kafka.max_queued_messages queued messages (default 1000); windows wait at executor.max_pending_tasks and executor.max_pending_bytes. See Backpressure in tasks and bytes. |
executor.backpressure_low_multiplier |
removed | The fetch resumes at half of sources.kafka.max_queued_messages. Delete the key. |
sinks.kafka.*.on_failure |
unchanged | also takes delivery_timeout, breaker_failures and breaker_cooldown on the instance |
sinks.kafka.*.max_retries |
unchanged | |
sinks.kafka.*.depends_on |
unchanged | |
sinks.kafka.*.topic |
unchanged | |
sinks.kafka.*.brokers |
connections.kafka.<entry>.brokers |
and sinks.kafka.<name>.connection: <entry>; a sink with an empty brokers uses connections.kafka.main |
sinks.kafka.*.ui_url |
unchanged | |
sinks.kafka.*.security.protocol |
connections.kafka.<entry>.security.protocol |
a sink with its own cluster names that entry in sinks.kafka.<name>.connection |
sinks.kafka.*.security.sasl_mechanism |
connections.kafka.<entry>.security.sasl_mechanism |
a sink with its own cluster names that entry in sinks.kafka.<name>.connection |
sinks.kafka.*.security.sasl_username |
connections.kafka.<entry>.security.sasl_username |
a sink with its own cluster names that entry in sinks.kafka.<name>.connection |
sinks.kafka.*.security.sasl_password |
connections.kafka.<entry>.security.sasl_password |
a sink with its own cluster names that entry in sinks.kafka.<name>.connection |
sinks.kafka.*.security.ssl_ca_location |
connections.kafka.<entry>.security.ssl_ca_location |
a sink with its own cluster names that entry in sinks.kafka.<name>.connection |
sinks.kafka.*.security.ssl_certificate_location |
connections.kafka.<entry>.security.ssl_certificate_location |
a sink with its own cluster names that entry in sinks.kafka.<name>.connection |
sinks.kafka.*.security.ssl_key_location |
connections.kafka.<entry>.security.ssl_key_location |
a sink with its own cluster names that entry in sinks.kafka.<name>.connection |
sinks.kafka.*.security.ssl_key_password |
connections.kafka.<entry>.security.ssl_key_password |
a sink with its own cluster names that entry in sinks.kafka.<name>.connection |
sinks.kafka.*.security.ssl_endpoint_identification_algorithm |
connections.kafka.<entry>.security.ssl_endpoint_identification_algorithm |
a sink with its own cluster names that entry in sinks.kafka.<name>.connection |
sinks.kafka.*.client_config |
unchanged | merged after the client_config of the connection; the sink wins on a shared key |
sinks.kafka.*.flush_timeout_seconds |
sinks.kafka.*.flush_timeout |
30.0 is 30s |
sinks.postgres.*.on_failure |
unchanged | also takes delivery_timeout, breaker_failures and breaker_cooldown on the instance |
sinks.postgres.*.max_retries |
unchanged | |
sinks.postgres.*.depends_on |
unchanged | |
sinks.postgres.*.dsn |
connections.postgres.<entry>.dsn |
and sinks.postgres.<name>.connection: <entry> |
sinks.postgres.*.pool_min |
unchanged | |
sinks.postgres.*.pool_max |
unchanged | |
sinks.postgres.*.statements |
unchanged | |
sinks.postgres.*.ui_url |
unchanged | |
sinks.mongo.*.on_failure |
unchanged | also takes delivery_timeout, breaker_failures and breaker_cooldown on the instance |
sinks.mongo.*.max_retries |
unchanged | |
sinks.mongo.*.depends_on |
unchanged | |
sinks.mongo.*.uri |
connections.mongo.<entry>.uri |
and sinks.mongo.<name>.connection: <entry> |
sinks.mongo.*.database |
unchanged | |
sinks.mongo.*.statements.*.collection |
unchanged | |
sinks.mongo.*.statements.*.op |
unchanged | |
sinks.mongo.*.statements.*.filter |
unchanged | |
sinks.mongo.*.statements.*.update |
unchanged | |
sinks.mongo.*.ui_url |
unchanged | |
sinks.http.*.on_failure |
unchanged | also takes delivery_timeout, breaker_failures and breaker_cooldown on the instance |
sinks.http.*.max_retries |
unchanged | |
sinks.http.*.depends_on |
unchanged | |
sinks.http.*.url |
unchanged | |
sinks.http.*.method |
unchanged | |
sinks.http.*.timeout_seconds |
sinks.http.*.request_timeout |
30 is 30s; whole seconds |
sinks.http.*.headers |
unchanged | |
sinks.http.*.encoding |
unchanged | |
sinks.http.*.ui_url |
unchanged | |
sinks.redis.*.on_failure |
unchanged | also takes delivery_timeout, breaker_failures and breaker_cooldown on the instance |
sinks.redis.*.max_retries |
unchanged | |
sinks.redis.*.depends_on |
unchanged | |
sinks.redis.*.url |
connections.redis.<entry>.url |
and sinks.redis.<name>.connection: <entry> |
sinks.redis.*.key_prefix |
unchanged | |
sinks.redis.*.scripts |
unchanged | |
sinks.redis.*.ui_url |
unchanged | |
sinks.filesystem.*.on_failure |
unchanged | also takes delivery_timeout, breaker_failures and breaker_cooldown on the instance |
sinks.filesystem.*.max_retries |
unchanged | |
sinks.filesystem.*.depends_on |
unchanged | |
sinks.filesystem.*.base_path |
unchanged | |
sinks.filesystem.*.ui_url |
unchanged | |
sinks.custom |
removed | Plugins are not supported. Use one of the six built-in sink types; see the handler changes. |
sinks.delivery_timeout_seconds |
sinks.defaults.delivery_timeout |
30.0 is 30s; every sink can override it |
sinks.circuit_breaker.failure_threshold |
sinks.defaults.breaker_failures |
every sink can override it |
sinks.circuit_breaker.cooldown_seconds |
sinks.defaults.breaker_cooldown |
30.0 is 30s; every sink can override it |
dlq.topic |
unchanged | |
dlq.brokers |
connections.kafka.<entry>.brokers |
and dlq.connection: <entry>; an empty dlq.brokers meant connections.kafka.main |
dlq.security.protocol |
connections.kafka.<entry>.security.protocol |
name the entry in dlq.connection |
dlq.security.sasl_mechanism |
connections.kafka.<entry>.security.sasl_mechanism |
name the entry in dlq.connection |
dlq.security.sasl_username |
connections.kafka.<entry>.security.sasl_username |
name the entry in dlq.connection |
dlq.security.sasl_password |
connections.kafka.<entry>.security.sasl_password |
name the entry in dlq.connection |
dlq.security.ssl_ca_location |
connections.kafka.<entry>.security.ssl_ca_location |
name the entry in dlq.connection |
dlq.security.ssl_certificate_location |
connections.kafka.<entry>.security.ssl_certificate_location |
name the entry in dlq.connection |
dlq.security.ssl_key_location |
connections.kafka.<entry>.security.ssl_key_location |
name the entry in dlq.connection |
dlq.security.ssl_key_password |
connections.kafka.<entry>.security.ssl_key_password |
name the entry in dlq.connection |
dlq.security.ssl_endpoint_identification_algorithm |
connections.kafka.<entry>.security.ssl_endpoint_identification_algorithm |
name the entry in dlq.connection |
dlq.client_config |
unchanged | merged after the client_config of the connection; the DLQ wins on a shared key |
dlq.flush_timeout_seconds |
dlq.flush_timeout |
30.0 is 30s |
dlq.on_send_failure |
unchanged | |
metrics.enabled |
unchanged | |
metrics.port |
unchanged | |
metrics.task_label_histograms |
unchanged | |
throughput.cost_label |
removed | The throughput feature is removed. Delete the key and DK_THROUGHPUT__*. |
throughput.min_cost |
removed | The throughput feature is removed. Delete the key. |
runtime_health.enabled |
unchanged | |
runtime_health.tick_seconds |
runtime_health.tick |
0.25 is 250ms |
runtime_health.warn_lag_seconds |
runtime_health.warn_lag |
0.1 is 100ms |
runtime_health.stall_seconds |
runtime_health.stall |
1.0 is 1s |
runtime_health.max_stall_stacks |
unchanged | |
runtime_health.sample_interval_seconds |
runtime_health.sample_interval |
10.0 is 10s |
runtime_health.history_window_seconds |
runtime_health.history_window |
900 is 15m; whole seconds |
runtime_health.episode_max_seconds |
runtime_health.max_episode |
300.0 is 5m |
runtime_health.probe_interval_seconds |
runtime_health.stack_probe_enabled and runtime_health.stack_probe_interval |
0.0 (off) is stack_probe_enabled: false; a positive value is stack_probe_enabled: true with that interval, for example 1s |
io.max_threads |
threads.io |
0 is null; a value is 1 to 512 |
offload.max_threads |
threads.offload |
0 is null; a value is 1 to 32 |
logging.level |
unchanged | |
logging.format |
unchanged | |
logging.output |
unchanged | |
ui.enabled |
unchanged | now needs api.enabled; controls only the user-facing UI |
ui.host |
api.host |
|
ui.port |
api.port |
|
ui.auth_token |
unchanged | |
ui.allowed_ws_origins |
ui.allowed_origins |
|
ui.probe_enabled |
ui.probe.enabled |
|
ui.merge_enabled |
unchanged | |
ui.kafka_read_enabled |
unchanged | |
ui.public_url |
api.public_url |
|
ui.expose_env_vars |
recorder.capture.env_vars |
|
ui.max_rows |
unchanged | |
ui.log_min_duration_ms |
logging.min_task_duration |
500 is 500ms |
ui.ws_min_duration_ms |
ui.ws_min_duration |
500 is 500ms |
ui.prometheus_url |
ui.prometheus.url |
|
ui.prometheus_rate_interval |
ui.prometheus.rate_interval |
stays a PromQL text such as 5m |
ui.prometheus_worker_label |
ui.prometheus.worker_label |
|
ui.prometheus_cluster_label |
ui.prometheus.cluster_label |
|
ui.custom_links |
unchanged | |
ui.link_bases |
unchanged | |
ui.custom_renderers_path |
unchanged | |
ui.consume_pause.enabled |
unchanged | |
ui.consume_pause.durations_seconds |
ui.consume_pause.durations |
[15, 60, 300, 900] is [15s, 1m, 5m, 15m]; each entry 1s to 1h |
ui.recorder.persistence |
removed | Use recorder.enabled and recorder.provider: unset with a storage.dir needs nothing; unset with an empty storage.dir and none become recorder.enabled: false; sqlite is recorder.provider: sqlite; postgres is recorder.provider: postgres. |
ui.recorder.memory.window_seconds |
recorder.memory.window |
120 is 2m; whole seconds |
ui.recorder.memory.rows_per_executor |
recorder.memory.rows_per_executor |
|
ui.recorder.memory.max_mib |
recorder.memory.max_size |
256 is 256MiB |
ui.recorder.postgres.connection |
recorder.postgres.connection |
|
ui.recorder.postgres.table_prefix |
recorder.postgres.table_prefix |
|
ui.recorder.postgres.retention_hours |
recorder.postgres.initial_retention |
6 is 6h, whole hours; the default is now 24h |
ui.recorder.postgres.store_output |
recorder.postgres.store_completed_output |
|
ui.recorder.postgres.batch_rows |
recorder.postgres.batch_rows |
|
ui.recorder.postgres.queue_max_mib |
recorder.postgres.max_queue |
128 is 128MiB |
ui.recorder.postgres.resilience.timeout_seconds |
recorder.postgres.resilience.timeout |
5.0 is 5s |
ui.recorder.postgres.resilience.retries |
recorder.postgres.resilience.max_retries |
|
ui.recorder.postgres.resilience.backoff_seconds |
recorder.postgres.resilience.backoff |
0.2 is 200ms |
ui.recorder.postgres.resilience.backoff_max_seconds |
recorder.postgres.resilience.max_backoff |
5.0 is 5s |
ui.recorder.postgres.resilience.breaker.failure_threshold |
recorder.postgres.resilience.breaker_failures |
|
ui.recorder.postgres.resilience.breaker.cooldown_seconds |
recorder.postgres.resilience.breaker_cooldown |
30.0 is 30s |
ui.recorder.store_events |
recorder.capture.events |
|
ui.recorder.store_config |
recorder.capture.config |
|
ui.recorder.store_state |
recorder.sqlite.state_snapshots |
|
ui.recorder.state_sync_interval_seconds |
recorder.sqlite.state_interval |
10 is 10s; whole seconds |
ui.recorder.rotation_interval_hours |
recorder.sqlite.rotation_interval |
1 is 1h; whole hours |
ui.recorder.store_output |
recorder.capture.output |
|
ui.recorder.store_stdin |
recorder.capture.stdin |
|
ui.recorder.stdin_max_bytes |
recorder.capture.max_stdin |
65536 is 64KiB |
ui.recorder.flush_interval_seconds |
recorder.flush_interval |
5 is 5s; whole seconds |
ui.recorder.max_buffer |
recorder.max_buffer_rows |
|
ui.recorder.max_flush_retries |
recorder.sqlite.max_flush_retries |
|
ui.recorder.event_min_duration_ms |
recorder.capture.min_event_duration |
0 is 0; 100 is 100ms |
ui.recorder.output_min_duration_ms |
recorder.capture.min_output_duration |
500 is 500ms |
ui.recorder.annotations_enabled |
recorder.annotations.enabled |
|
ui.recorder.annotation_max_bytes |
recorder.annotations.max_size |
16384 is 16KiB |
ui.recorder.annotation_max_bytes_per_call |
recorder.annotations.max_size_per_call |
262144 is 256KiB |
ui.recorder.annotation_log_max_bytes |
recorder.annotations.max_log_size |
2048 is 2KiB |
ui.release.enabled |
unchanged | |
ui.release.repo |
unchanged | |
ui.release.pinned_version |
unchanged | |
ui.release.cache_dir |
unchanged | |
ui.release.check_update |
unchanged | |
ui.probe_details.max_writes |
ui.probe.max_writes |
|
ui.probe_details.max_total_bytes |
ui.probe.max_total_size |
5000000 is 5MB |
ui.timeline.history_factor |
unchanged | |
ui.timeline.max_age_minutes |
ui.timeline.max_age |
60 is 1h; whole minutes |
ui.timeline.color_rules[].name |
unchanged | |
ui.timeline.color_rules[].when[].label |
unchanged | |
ui.timeline.color_rules[].when[].field |
unchanged | |
ui.timeline.color_rules[].when[].op |
unchanged | |
ui.timeline.color_rules[].when[].value |
unchanged | |
ui.timeline.color_rules[].color |
unchanged | |
ui.timeline.labels.tag |
unchanged | |
ui.timeline.labels.caption |
unchanged | |
ui.timeline.labels.highlight |
unchanged | |
ui.timeline.labels.filter |
unchanged | |
ui.timeline.labels.marker |
unchanged | |
ui.timeline.events[].name |
unchanged | |
ui.timeline.events[].kind |
unchanged | |
ui.timeline.events[].color |
unchanged | |
ui.timeline.events[].line |
unchanged | |
ui.timeline.events[].label |
unchanged | |
ui.timeline.events[].enabled |
unchanged | |
ui.timeline.events[].show |
unchanged | |
ui.timeline.events[].link |
unchanged | |
ui.timeline.events[].action |
unchanged | |
ui.trace.history_max_files |
recorder.search.max_files |
|
ui.trace.history_max_seconds |
recorder.search.timeout |
10.0 is 10s |
ui.docs.site_dir |
unchanged | |
ui.docs.title |
unchanged | |
ui.docs.anchors[].match.label |
unchanged | |
ui.docs.anchors[].match.value |
unchanged | |
ui.docs.anchors[].match.sink |
unchanged | |
ui.docs.anchors[].match.event |
unchanged | |
ui.docs.anchors[].match.page |
unchanged | |
ui.docs.anchors[].path |
unchanged | |
ui.docs.anchors[].title |
unchanged | |
cache.enabled |
unchanged | |
cache.flush_interval_seconds |
cache.flush_interval |
3.0 is 3s |
cache.cleanup_interval_seconds |
cache.cleanup_interval |
60.0 is 1m |
cache.max_memory_entries |
unchanged | null (no cap) is 0; 0 logs a startup warning |
storage.dir |
unchanged | |
shared.dir |
storage.shared_dir |
an empty shared.dir fell back to storage.dir; this is still true for the history folder, but autodiscover.provider: filesystem needs storage.shared_dir |
history.archive.enabled |
recorder.archive.enabled |
|
history.archive.window_hours |
recorder.archive.window |
24 is 24h; whole hours |
history.archive.due_after_hours |
recorder.archive.due_after |
48 is 48h; whole hours |
history.archive.retention_days |
recorder.archive.retention |
30 is 30d; whole days |
history.archive.interval |
recorder.archive.interval |
3600 is 1h; at least 30s |
history.archive.cron |
recorder.archive.cron |
|
history.archive.lease_seconds |
recorder.archive.lease |
60 is 1m; 40s to 24h |
history.archive.sweep_after_seconds |
recorder.archive.sweep_after |
7200 is 2h |
history.merged_retention_days |
recorder.archive.merged_retention |
32 is 32d; whole days |
periodic.election.provider |
autodiscover.provider |
one provider for the registry and the election; the default filesystem is now '' and the feature is off |
periodic.election.connection |
autodiscover.connection |
|
periodic.election.resilience.timeout_seconds |
autodiscover.resilience.timeout |
the same block as the registry |
periodic.election.resilience.retries |
autodiscover.resilience.max_retries |
the same block as the registry |
periodic.election.resilience.backoff_seconds |
autodiscover.resilience.backoff |
the same block as the registry |
periodic.election.resilience.backoff_max_seconds |
autodiscover.resilience.max_backoff |
the same block as the registry |
periodic.election.resilience.breaker.failure_threshold |
autodiscover.resilience.breaker_failures |
the same block as the registry |
periodic.election.resilience.breaker.cooldown_seconds |
autodiscover.resilience.breaker_cooldown |
the same block as the registry |
periodic.election.plugin_options |
removed | Plugins are not supported. Delete the key. |
periodic.tasks.*.enabled |
removed | periodic.tasks is removed. To stop a task, do not declare it. |
periodic.tasks.*.interval |
removed | Change the interval of the @periodic decorator. |
periodic.tasks.*.cron |
removed | Change the cron of the @periodic decorator. |
periodic.tasks.*.lease_seconds |
removed | Change the lease_seconds of the @periodic decorator. |
fleet.registry.provider |
autodiscover.provider |
static and none are removed; the default filesystem is now '' and the feature is off; set autodiscover.enabled: true |
fleet.registry.connection |
autodiscover.connection |
|
fleet.registry.heartbeat_seconds |
autodiscover.heartbeat |
10 is 10s |
fleet.registry.refresh_seconds |
autodiscover.refresh |
15 is 15s |
fleet.registry.offline_after_seconds |
autodiscover.offline_after |
60 is 1m |
fleet.registry.prune_after_seconds |
autodiscover.prune_after |
86400 is 24h |
fleet.registry.resilience.timeout_seconds |
autodiscover.resilience.timeout |
5.0 is 5s; one block for the registry and the election |
fleet.registry.resilience.retries |
autodiscover.resilience.max_retries |
one block for the registry and the election |
fleet.registry.resilience.backoff_seconds |
autodiscover.resilience.backoff |
0.2 is 200ms; one block for the registry and the election |
fleet.registry.resilience.backoff_max_seconds |
autodiscover.resilience.max_backoff |
5.0 is 5s; one block for the registry and the election |
fleet.registry.resilience.breaker.failure_threshold |
autodiscover.resilience.breaker_failures |
one block for the registry and the election |
fleet.registry.resilience.breaker.cooldown_seconds |
autodiscover.resilience.breaker_cooldown |
30.0 is 30s; one block for the registry and the election |
fleet.registry.filesystem.dir |
removed | The card folder is <storage.shared_dir>/fleet/workers. |
fleet.registry.static.peers[].name |
removed | The static provider is removed. Use filesystem, postgres, redis or consul. |
fleet.registry.static.peers[].cluster |
removed | The static provider is removed. |
fleet.registry.static.peers[].url |
removed | The static provider is removed. |
fleet.registry.consul.mode |
removed | The consul provider has one mode, publish. |
fleet.registry.consul.service_name |
removed | The catalog mode is removed. Delete the key. |
fleet.registry.plugin_options |
removed | Plugins are not supported. Delete the key. |
fleet.cache_exchange.enabled |
cache.exchange.enabled |
|
fleet.cache_exchange.interval_seconds |
cache.exchange.interval |
30.0 is 30s |
fleet.cache_exchange.page_size |
cache.exchange.page_size |
|
fleet.cache_exchange.timeout_seconds |
cache.exchange.timeout |
5.0 is 5s |
fleet.cache_exchange.cycle_deadline_seconds |
cache.exchange.cycle_deadline |
null stays null |
fleet.cache_exchange.max_concurrent_peers |
cache.exchange.max_concurrent_peers |
|
connections.consul.*.address |
unchanged | |
connections.consul.*.token |
unchanged | |
connections.consul.*.datacenter |
unchanged | |
connections.consul.*.key_prefix |
connections.consul.*.state_prefix |
|
connections.redis.*.url |
unchanged | |
connections.redis.*.key_prefix |
connections.redis.*.state_prefix |
|
connections.postgres.*.dsn |
unchanged | |
connections.postgres.*.manage_schema |
unchanged | |
connections.postgres.*.pool_min |
unchanged | |
connections.postgres.*.pool_max |
unchanged | |
sources.kafka.enabled |
unchanged | now needs connections.kafka.<connection> |
sources.kafka.topic |
unchanged | |
sources.kafka.consumer_group |
unchanged | |
sources.kafka.max_poll_records |
unchanged | |
sources.kafka.max_poll_interval_ms |
sources.kafka.max_poll_interval |
300000 is 5m |
sources.kafka.session_timeout_ms |
sources.kafka.session_timeout |
45000 is 45s |
sources.kafka.heartbeat_interval_ms |
sources.kafka.heartbeat_interval |
3000 is 3s |
sources.kafka.on_parse_error |
unchanged | |
sources.kafka.startup_align_enabled |
sources.kafka.startup_align.enabled |
|
sources.kafka.startup_min_wait_seconds |
sources.kafka.startup_align.min_wait |
4.0 is 4s |
sources.kafka.startup_align_interval_seconds |
sources.kafka.startup_align.interval |
10 is 10s; whole seconds |
sources.http.enabled |
unchanged | |
sources.http.host |
unchanged | |
sources.http.port |
unchanged | |
sources.http.path |
unchanged | |
sources.http.sinks_enabled |
sources.http.deliver_to_sinks |
|
sources.http.request_timeout_seconds |
sources.http.request_timeout |
30.0 is 30s |
sources.http.max_concurrent |
unchanged | |
sources.http.max_body_bytes |
sources.http.max_body |
10485760 is 10MiB |
sources.http.clients[].name |
unchanged | |
sources.http.clients[].token |
unchanged | |
sources.http.clients[].rpm |
unchanged | |
app |
unchanged | open map; unchanged |
Keys of release 2.4.0 that an earlier build of this release already replaced, and keys of 2.4.0 that the table above does not list:
| Old path | New path | How to write the value |
|---|---|---|
fleet.registry.timeout_seconds |
autodiscover.resilience.timeout |
5 is 5s; the value now limits one attempt, and max_retries: 2 makes up to three attempts. Set max_retries: 0 for one attempt |
history.archive.lock_stale_seconds |
recorder.archive.lease and recorder.archive.sweep_after |
the old value was the lease and the sweep age: set sweep_after to it and keep the default lease |
history.archive.pass_interval_seconds |
recorder.archive.interval or recorder.archive.cron |
0 (a pass after each rotation) has no counterpart: the pass runs at slots, 1h by default |
history.archive.election and every key below it |
autodiscover.* |
one provider for the registry and the election |
webapp.* |
sources.http.* |
the webapp: section is the HTTP source |
DK_UI__RECORDER__DB_DIR and the other keys of the guide to 2.4.0 |
see that guide, then this table |
The new keys¶
These keys have no old key. The defaults work for most deployments.
| Path | Default | What it does |
|---|---|---|
worker.name |
'' |
A literal worker name. worker.name_env still wins when its variable is set and not empty. |
connections.kafka.*, connections.mongo.* |
none | The Kafka and Mongo services, declared once. |
sources.kafka.connection |
main |
The Kafka cluster of the source. |
sinks.<type>.*.connection |
main |
The service of a Kafka, Postgres, Mongo or Redis sink. |
sinks.defaults.on_failure, .max_retries |
dlq, 2 |
The failure policy of every sink. A sink can override each key. |
sinks.*.*.delivery_timeout, .breaker_failures, .breaker_cooldown |
not given | Per-sink overrides of sinks.defaults. |
dlq.enabled, dlq.provider, dlq.connection |
true, kafka, main |
A switch for the DLQ, the destination type (kafka only) and its cluster. |
recorder.enabled, recorder.provider |
true, sqlite |
Durable recording on or off, and where it goes. |
recorder.postgres.max_output, recorder.postgres.max_size |
64KiB, 0 |
Limits of the Postgres history: one output value, and the whole table. |
autodiscover.enabled |
false |
Turns on the registry and the election. |
api.enabled |
true |
Runs the HTTP server. |
executor.max_pending_tasks |
2000 |
New windows wait while this many tasks are created and not settled. At least executor.max_executors. |
executor.max_pending_bytes |
1GiB |
New windows wait while the pending bytes reach this size: task stdin, the output of tasks whose on_task_complete or sink delivery still runs, and output kept for on_message_complete and on_window_complete. At least 16MiB. |
sources.kafka.max_queued_messages |
1000 |
The Kafka fetch pauses at this many queued messages and resumes at half. At least sources.kafka.max_poll_records. |
ui.delete_enabled |
false |
Serves the delete of one merge result from the Databases view. Off: 403. |
recorder.sqlite.max_queue |
128MiB |
The most text (stdout, stderr, metadata and args) in the queue of rows waiting for the recorder file, 16MiB to 1GiB. Past it the oldest rows are dropped from the file only; the memory store keeps them, and drakkar_recorder_dropped_events_total counts them. Read only with recorder.provider: sqlite. |
5. What changes in behaviour¶
The subsections cover one area each. Read the ones that apply to your deployment.
Config keys are strict¶
Before this release, a nested section dropped a key it did not know, and the
value stopped applying with no message. Now every unknown key fails the load, in
the YAML file and in a DK_* variable, and one message lists them all:
config has unknown keys (YAML paths; as env vars they are DK_ plus the path with "__"; see docs/config-reference.md):
sinks.kafka.results.max_retires (did you mean 'max_retries'?)
ui.recorder.db_dir
- Delete or correct each key in the message. A key that was ignored
before, for example
rotation_interval_minutes, must go. This includes the keys that used to give a “moved” message and the top-levelwebapp:section, which issources.http. - Check variables for hyphenated names. A variable now reaches the existing
name:
DK_SINKS__POSTGRES__MAIN_DB__POOL_MAXchangessinks.postgres.main-db. Before, it made a second instancemain_db. If two names in the YAML match one variable (main-dbandmain_db), the load fails: rename one. - Set
schemaof a Postgres connection by that key. In Python code,PostgresConnectionConfig(schema='audit')is the only form; the attribute staysschema_name. - Config models refuse unknown keywords when you build one in code.
DrakkarConfig(**other.model_dump())fails with a Postgres connection, because the dump keys itschema_name. Usedrakkar.configmeta.dump_by_yaml_key.
Connections, sources, sinks and the DLQ keys¶
These are the details of step 2. Do them in order. An old key fails the load, so the load error tells you what is left.
- Move the root
kafka:section toconnections.kafka.main. Every key keeps its name. Every config with the Kafka source on needs this entry, even an empty one (main: {}), because the source and the DLQ namemainby default. - Give each Kafka sink or DLQ that has its own
brokersa connection of its own, and name it withconnection. Move itsbrokersandsecurityto that entry. A sink’s or the DLQ’sclient_configstays where it is. It is now merged after the connection’s, so a sink or DLQ with nobrokersgains the properties ofconnections.kafka.mainand wins on a key that both set. - Move each
dsn,uriandurlof a Postgres, Mongo or Redis sink to an entry underconnections.postgres,connections.mongoorconnections.redis, and name the entry withconnectionon the sink. Sinks that used one server can share one entry. A Postgres connection entry also holdsschema,manage_schemaand its ownpool_minandpool_max, for the autodiscovery tables only. A sink’spool_minandpool_maxstay on the sink. - Rename the other keys of these sections with the table, and write each duration or size with a unit.
- Check the two new DLQ keys.
dlq.enabledis on by default. Withdlq.enabled: falseadlqoutcome followsdlq.on_send_failure, sostallholds the offset.dlq.provideraccepts onlykafka. - If a handler changes
sinks.circuit_breakerorsinks.delivery_timeout_secondsinon_startup, setsinks.defaultsin the config file instead. Each sink’s policy is resolved when the worker is constructed. A change ofsinks.defaultsor of a sink’son_failure,max_retries,delivery_timeout,breaker_failures,breaker_cooldownordepends_oninon_startupis logged ason_startup_config_change_ignoredand does nothing. A sink added inon_startupstill gets its policy from the config it was added to. - Check tools that read
worker_config.kafka_brokers. It holds the brokers of the source’s connection, and''on a worker with the Kafka source off.
In code, these names changed: KafkaConfig is KafkaConnectionConfig,
CircuitBreakerConfig is gone, and KafkaSink, PostgresSink, MongoSink and
RedisSink take the connection as their third argument.
The DLQ record and the failure policy¶
A DLQ record is now the failed source message itself: the original key and
value, byte for byte, its own headers, then dk- headers that say where and
why it failed (see The DLQ record). The JSON
document with original_payloads is gone. Every sink also declares what
happens when its delivery fails (see Failure policy).
Do these steps in order.
- Drain or archive the old DLQ topic first. Records written by an older
worker are JSON documents with no headers; records written by this release
are the original messages with
dk-headers. The new replay tool never republishes an old record: it skips every record without adk-record-versionheader and counts it asskipped_old_format. Replay the old records with the tool of the older release before you upgrade, copy them away, or delete them; or move the new workers to a newdlq.topic. Old records left in the topic stay there until its retention removes them. - Change every consumer of the DLQ topic. A tool that parsed the JSON
document must read the record instead: the value is the original message
value (it may not be JSON or UTF-8), the failure facts are headers
(
dk-stage,dk-error,dk-sink,dk-attempts,dk-source-topic,dk-source-partition,dk-source-offset, …). One record is one source message, not a list of payloads. - Code that calls
read_dlq_entriesnow getsDLQEntry(key, value, headers, partition, offset)records, not decoded JSON objects.DLQMessageandParseFailurePayloadare removed; a parse failure is a record withdk-stage: parse. - Use the new replay tool.
scripts/replay_dlq.pyrepublishes the key, the value and the source headers of each record, and takes--stage. Its summary line hasskipped_old_formatinstead ofskipped_invalid, and its report lines namedlq_partition=anddlq_offset=. - Check
sinks.http.<name>.max_retries. It is now the shared retry budget of every sink: the default is 2 (it was 3, and unused), and a value above 10 fails the load withsinks.http.<name>.max_retries must be a whole number from 0 to 10. - Review your
on_delivery_errorhook.- The hook is called after every failed attempt, with
attempt,retries_leftanddeclared_policy.RETRYis honoured up to the sink’smax_retries(it was a fixed 3 attempts); then the declaredon_failureapplies. - The default hook returns the sink’s declared
on_failure(dlqunless you setskip), as before for a sink you did not configure. - A hook that raises no longer stops the delivery: the worker logs
delivery_error_hook_failedand applies the declaredon_failure. It no longer reachesdlq.on_send_failure. The HTTP source follows the same rule (it sent such a request to the DLQ before). - With the circuit open, the hook is not called even when the worker has
no DLQ; the declared
on_failuredecides.
- The hook is called after every failed attempt, with
- Know what “the message is done” means. After the first DLQ record of
a message, no later result of that message is delivered, also to sinks that
did not fail, and
on_message_completestill runs but its result is not delivered. A sink that may lose its payloads without stopping the message should declareon_failure: skip. - Window results cannot reach the DLQ. A failed delivery of an
on_window_completeresult went to the DLQ before (as the payload JSON). A window result has no source message, soon_failure: dlqnow acts asskipthere and logswindow_delivery_not_dlq. A handler that needs the DLQ for an aggregate delivers it fromon_message_completeinstead, or setson_failure: skipon that sink knowingly. - The HTTP response summary. In the per-type
sinkssummary of an HTTP request, the error markersdlq_unconfiguredanddlq_send_failed: ...are gone. A sink that did not start reports<type>/<name>: not started, and a sink that failed with no DLQ record reports<type>/<name>: failed, no DLQ record.dlqcounts only when the request’s DLQ record was written. - Update dashboards and alerts.
drakkar_dlq_dropped_payloads_totalnow counts source messages, once each, not payloads. New:drakkar_dlq_records_total{stage}anddrakkar_sink_deliveries_not_started_total{sink_type,sink_name,reason}. The help texts ofdrakkar_sink_dlq_messages_total,drakkar_dlq_dropped_payloads_total,drakkar_dlq_unconfigured_drops_totalanddrakkar_sink_deliveries_skipped_totalchanged. The log eventsdlq_message_sentanddlq_send_failedcarrystage,sinkandvalue_bytesinstead of payload fields.dlq_payload_serialization_fallbackis gone (nothing is serialized any more). The HTTP source’swebapp_on_delivery_error_failedandwebapp_sink_dlq_send_failedare gone: the shareddelivery_error_hook_failed,message_dlq,dlq_send_failedanddlq_failure_payloads_droppedcover those cases. - Protect the DLQ topic like the source topic. It now holds the original messages; see Security.
The flight recorder¶
The recorder is a root section, recorder:, and it does not depend on the UI.
ui.enabled controls only the UI. Do these steps in order.
- Check workers with
ui.enabled: false. They now record. Such a worker used to have no recorder at all. It now writes recorder files intostorage.dir(with the default/tmp/drakkartoo), seals them and runs the archive task, with no memory store. To keep the worker as it was, setrecorder.enabled: false. -
Replace
ui.recorder.persistence. There is no derive rule any more:The old value The new keys unset, with storage.dirsetnothing: recorder.enableddefaults totrue,recorder.providertosqliteunset, with an empty storage.dirrecorder.enabled: false. This is new: withsqlitean emptystorage.dirnow fails the loadnonerecorder.enabled: falsesqliterecorder.provider: sqlitepostgresrecorder.provider: postgres -
Check a Trace search of a worker with the recorder off. With
none, atrace?history=1request used to read the sealed files of the history folder. Withrecorder.enabled: falseit reads no folder and no table: it answers the memory rows. - Rename the keys with the table, and write each duration or size with a unit.
A number with no unit fails the load, except
0. The environment variables follow the YAML paths:DK_UI__RECORDER__MEMORY__WINDOW_SECONDSisDK_RECORDER__MEMORY__WINDOW. - Check the Postgres default.
initial_retentiondefaults to24h; the old key defaulted to 6 hours. It only matters when a worker creates the table: an existing table keeps the value in its comment.drakkar-schemakeeps its own default of 6 hours when you give no--retention-hours. - Rename the keys of every resilience block (
recorder.postgres.resilienceandautodiscover.resilience) with the table. Thebreakerblock is gone:breaker_failuresandbreaker_cooldownsit in the block itself. - Update log queries.
recorder_startedhas noignored_keysfield. It has no memory fields on a worker with no memory store. - Check a process that reads the Postgres table’s comment or the archive messages.
The load errors of the archive now start with
recorder.archive:.
The new layout of a worker with no UI that records into its folder:
storage:
dir: /var/lib/drakkar
shared_dir: /mnt/fleet
ui:
enabled: false
recorder:
sqlite:
rotation_interval: 1h
archive:
retention: 30d
In code, EventRecorder takes a RecorderConfig as its first argument, and the
constructor keywords archive and merged_retention_days are gone: both come from
config.archive. UIConfig.recorder, UIRecorderConfig, UITraceConfig,
SharedConfig, HistoryConfig and BreakerConfig are gone; HistoryArchiveConfig is
RecorderArchiveConfig.
The recorder memory store¶
The recorder keeps its recent events in an in-memory database, and
recorder.enabled with recorder.provider say whether it also writes
recorder files or a Postgres table. See Recent Events in Memory.
- A memory-only worker is queryable. A worker with
storage.dir: ''andrecorder.enabled: false(the oldnone): the History, Trace and Task Detail pages, the memory row of the Databases tab and the memory snapshot download read the memory store. They cover the memory window only (two minutes by default). -
Provider
sqliteneeds a folder. With the recorder on, providersqliteand an emptystorage.dirthe config does not load: -
Stop a worker cleanly before you turn its recorder off. A worker with the recorder off seals nothing, so a recorder file that an earlier
sqliterun left instorage.dirstays there and never reaches the history folder. A clean stop seals and moves the live file first. - Ids no longer start at 1 per file. The recorder gives each row its id
in the process. Ids continue across rotations and start again at 1 after a
restart. A client that polls
/api/v1/eventswithafter_idnow sees new rows right after a rotation. - Give every worker of a cluster the same recorder settings. A worker with the recorder off
does not run the archive, so its cluster task hash differs from the
sqliteworkers and they logperiodic_cluster_mismatch. - Plan RAM. With the default budget of 256 MiB, plan up to about 600 MiB per worker for the store. See RAM to plan.
EventRecorder.reader_dbis gone. Usefile_reader_dbfor the live file, ormemory_storefor the memory store.
The recorder history in Postgres¶
recorder.provider: postgres makes every worker
write its events to one table in Postgres, and the trace with history read
that table. Nothing changes until you set it. See
Recorder History in Postgres.
- Switching a worker from
sqlitetopostgres. Stop the worker cleanly first: a clean stop seals and moves its live file. A file that a worker left behind without a clean stop stays instorage.dir. The sealed files stay in the history folder; merge, file downloads and the archives list still show them, buttrace?history=1on apostgresworker no longer searches them. There is no migration of old files into the table. - Switch a whole cluster at once. A cluster that mixes
postgresandsqliteworkers shows a cluster task mismatch (the archive runs on thesqliteside only), and its history is split between the files and the table. - Declare the connection.
recorder.postgres.connection(defaultmain) must name an entry underconnections.postgres, or the config does not load. - The role must own the events table. The worker creates and drops its
partitions. With an operator-managed schema, add
--recorderto thedrakkar-schemacommand and give the table to the worker role. - The index set is fixed. The table has three indexes and its primary
key. A later
CREATE INDEXon a filled partitioned table builds on every partition under a lock that blocks every writer. A later index change needs a newtable_prefix, or a manualCREATE INDEX CONCURRENTLYon each partition. - Contract v1.26. With
history=1, apostgresworker answers the rows of its cluster from the table, or503 {"detail": "history search failed"}. A UI of this release shows “(the history search failed)”; an older UI shows the same note for a failed history search.
The archive lock and periodic tasks¶
The decorator. @periodic takes interval instead of seconds. Write
@periodic(30) or @periodic(interval=30); @periodic(seconds=30) now
raises TypeError when the handler module is imported. The decorator also
checks the method name: 1 to 64 characters of a-z, 0-9 and _, not
starting with a digit. A method named refreshRates must be renamed. A
worker-scope task with an interval runs as before. See
Periodic Tasks for cron= and scope='cluster'.
The archive keys. The archive pass does not run after each rotation: it runs at archive slots, at the top of each UTC hour by default. The keys are in the table: recorder.archive.interval or cron, recorder.archive.lease and recorder.archive.sweep_after.
The old lock_stale_seconds was both the lease and the sweep age. If you
set it, set sweep_after to the old value and leave lease at its default: the
lease now only says how long the lock of a dead archiver lives.
Roll out with archiving off, or stop the fleet. A 2.4.0 worker takes the
archive lock history/<cluster>/.archive.lock; a worker of this release
takes tasks/<cluster>/history.archive.lock (or the lease of another
election provider). The two cannot see each other’s lock, so a worker of
each kind could archive one window at the same time. Do one of these:
- Stop every worker of the fleet, upgrade, and start them again.
- Or set
recorder.archive.enabled: false(DK_RECORDER__ARCHIVE__ENABLED=false) on every worker for the rolling restart, and turn it back on once every worker runs this release. Due windows wait; nothing is lost, and the next archive slot after you turn it on picks them up.
A 2.4.0 card carries no definition hash, so the new workers count a 2.4.0
peer as unknown and log no warning about it. While archiving is off on every
worker, the new workers also hash the same definitions. When you turn
archiving back on one worker at a time, a worker with it on and a worker
with it off hash different definitions (history.archive is one of them),
so they log periodic_cluster_mismatch and
drakkar_periodic_cluster_mismatch_peers is above zero until the last worker
has archiving on again. That is expected.
Old lock files¶
Nothing reads the old locks any more, and the worker does not delete them. Once no 2.4.0 worker runs, delete:
| Old file or table | What it was |
|---|---|
<storage.shared_dir>/history/<cluster>/.archive.lock |
The archive lock of 2.4.0. |
<storage.shared_dir>/history/<cluster>/.archive.lock.stale.<token> |
A lock set aside by a takeover. The archive pass also deletes these once they are older than recorder.archive.sweep_after. |
Postgres table <schema>.archive_locks |
The archive lease of the postgres election provider in an older build. Drop it with DROP TABLE IF EXISTS <schema>.archive_locks;. The provider now creates task_locks. |
Redis and Consul keys. The redis election provider keeps its leases
under <state_prefix>task-locks:<cluster>/<task>, and the consul provider
under <state_prefix>/task-locks/<cluster>/<task>, with sessions named
drakkar/task-lock/<cluster>/<task>/<token>. A Redis user or a Consul
token limited to the key prefix needs no change (the key prefix is state_prefix now). A lock key of an older
build ends by itself.
The archive scope¶
The archive pass now has two scopes. See The two scopes.
- With
autodiscover.enabledandstorage.shared_dirset, a pass covers the whole cluster, as before. It runs with an election, and it writes<cluster>-<from>__<to>.db.gz. - In every other case, a pass covers only this worker’s files. It runs at the same slots
with no election and no lease, and it writes
<cluster>-<worker>-<from>__<to>.db.gz.history.archiveis then not in the definition hash, and the worker counts nothing indrakkar_periodic_cluster_slots_totalfor it.
What to do:
- Find workers that have
autodiscoveroff, or that have nostorage.shared_dir. Their archive now takes the worker’s own sealed files in<dir>/history/<cluster>/, where<dir>isstorage.shared_dir, elsestorage.dir. To keep the sealed files instead, setrecorder.archive.enabled: false. - If a tool reads the archive folder, let it also accept the name with a worker. The name
does not tell the cluster, because cluster names and worker names can both hold
-. Take the cluster from the folder. Theclusterfield of the archive rows in/api/v1/debug/databasesis now the folder name. - Delete a line such as
recorder: {archive: {enabled: false}}that you added only because the workers have no shared folder. Each worker can now archive its own files.
The own scope needs a stable worker name. A pass finds its files by the worker name.
Sealed files and archives of a retired name stay until an operator deletes them. Set the
variable that worker.name_env names (default WORKER_ID) to a name that does not change
across restarts. A worker with no name uses its host name, which changes when a Deployment
recreates its pod, and it logs archive_own_scope_unstable_worker_name at startup in this
scope. Its sealed files of an earlier host name are never archived by the own scope.
Archives that stay in the folder after a change of scope: a pass deletes only the archives of its own scope. If a worker changes scope, delete its old archives by hand once you no longer need them. Their sealed files are already gone.
Log events and metrics: recorder_archive_pass_abandoned has a second detail text for
the own scope, the pass ends after the window in progress. The help texts of
drakkar_recorder_archive_bytes, drakkar_recorder_archive_files and
drakkar_recorder_archive_failures_total changed.
In code: archive_task_runs is archive_scope, which answers cluster, worker or
None. PeriodicRoster.runs_archive is PeriodicRoster.archive_scope. run_archive_pass
takes only_worker, and needs fence or only_worker: with neither it raises ValueError.
archive_file_name takes worker.
Own folders and worker names¶
Each worker keeps its own files in <storage.dir>/<sanitized cluster>/<worker>/ instead
of directly in storage.dir. See The own folder.
The file names and the shared folder do not change.
- Files of the flat layout are not found again. A backlog file, a leftover
recorder file (
<storage.dir>/<worker>-<timestamp>.db), the cache file (<worker>-cache.db) and the watchdog file of an earlier release stay where they are. Stop every worker cleanly before the upgrade: a clean stop seals and moves its recorder files. Then move the remaining recorder files of a worker into its new own folder (the next start seals them as leftovers), or delete them. Delete the old cache and watchdog files: the cache starts empty and is filled again. - The worker name must be 1 to 128 letters, digits,
_or-. A name with a dot, a slash or a space (for example an FQDN inWORKER_ID) fails the start with<source>: '<name>' must be 1 to 128 letters, digits, '_' or '-'; use '<safe form>', where<source>isworker.name,the variable <NAME>orthe worker_id argument. Use the safe form the message gives. Before, such names were changed to_only in card keys, so two names could share one card. - The generated name is the host name. With no configured name, the worker uses its
host name made safe (in Kubernetes: the pod name), or
drakkar-<8 hex>when the host name is empty or a localhost name such aslocalhost.localdomain. It was a value that changed at every start. - A cluster name can no longer be
fleet,history,merged,tasksorworkers(in any letter case, after sanitizing). Such a name fails the load. storage.dirmust be a local filesystem. The own folder carries an owner lock (flock), and SQLite’s WAL mode needs local file locks. Put the network mount instorage.shared_dir.- A second process with the same worker name does not start. On one host the owner
lock refuses it (
storage.dir: the folder <own folder> is in use by another process; ...). Withautodiscoveron, a worker that finds a live card of its name with another instance does not start (fleet_worker_name_in_use). See The same-name check. After a quick restart of a killed worker the check waits about one heartbeat. - Orphan folders are sealed by another worker of the cluster when
autodiscoveris on and the registry shows the name is not online; withautodiscoveroff they are only logged (recorder_orphan_folder_found). See Orphan folders.
Renamed log event: recorder_storage_dir_world_writable is now storage_folder_unsafe
(category lifecycle). It checks storage.dir, the cluster folder and the own folder, for any
recorder provider, and also names a folder owned by another user.
New log events: fleet_worker_name_probe_waiting, fleet_worker_name_in_use,
fleet_worker_name_probe_skipped, recorder_orphan_folder_sealed,
recorder_orphan_folder_found, recorder_orphan_folder_failed,
recorder_orphan_folder_clock_ahead. recorder_leftover_sealed carries orphan_worker
for a file of an orphan folder. New metric: drakkar_recorder_orphan_failures_total.
In code: DrakkarApp(worker_id=...) follows the same name rule. EventRecorder
takes sibling_dir and worker_online; its storage_dir is the own folder.
DrakkarApp.own_storage_dir gives that folder.
Backpressure in tasks and bytes¶
Before this release the poll loop added queued messages and in-flight tasks
into one number and paused at max_executors x backpressure_high_multiplier
(128 by default). One message with a fan-out of 1000 tasks passed it, and one
window of 100 messages could hold 100 000 tasks with all their stdin.
Now there are two stages (see Backpressure):
- Window admission. A partition loop takes a new
arrange()window only while the pending tasks are belowexecutor.max_pending_tasks(default2000) and the pending bytes are belowexecutor.max_pending_bytes(default1GiB). The pending bytes are the task stdin, the stdout and stderr of each task from its end until itson_task_complete(oron_error) and its sink delivery end, and the output kept foron_message_completeandon_window_complete. The window size adapts to the free room after a warm-up of one-message windows (the first 3 windows of each partition). The limits are soft: a window reserves its estimate when it is taken, so with a steady message shape the task limit is passed by about one message; after the warm-up a sudden jump in tasks per message can pass it by that jump. The byte limit can also be passed by the output of the pending tasks, because a window reserves stdin only and output exists only when a task ends.executor.max_stdoutandexecutor.max_stderrbound each output (see Backpressure). - Kafka fetch. The fetch pauses when the queues of the live partitions
hold
sources.kafka.max_queued_messagesmessages (default1000) and resumes at half of it.
What to do and what to expect:
- Delete
executor.backpressure_high_multiplierandexecutor.backpressure_low_multiplier. Sizeexecutor.max_pending_bytesto about a quarter of the container memory, and keepsources.kafka.max_queued_messagesat leastsources.kafka.max_poll_records(the load fails otherwise). - Queued messages are not arranged at stop or revoke. Before, the
partition loop arranged every queued message at a stop. Now the messages
that are not in a window are dropped; their offsets were never registered,
so the final commit stays below them and the next owner reads them again.
Only in-flight work drains, so a stop is shorter.
drakkar_queued_messages_dropped_at_stop_totalcounts them. - A dead partition is paused. A partition whose loop died twice is paused in Kafka and stays paused until a restart or revoke; its queue no longer counts toward the pause.
- New metrics:
drakkar_pending_tasks,drakkar_pending_bytes,drakkar_window_admission_wait_seconds_total{limit},drakkar_window_messagesanddrakkar_queued_messages_dropped_at_stop_total. The help text ofdrakkar_backpressure_activechanged. task.stdinisNonein the message and window hooks (see the handler changes).
Task run time¶
duration (on ExecutorResult, in the task_completed / task_failed
events and in the timeline bars) and drakkar_executor_duration_seconds now
run from the spawn to the process exit, and the exit time is read off the
event loop (see
Task run time and the exit notice).
Before, they ended when the busy event loop got round to the exit, so:
- The values can drop after the upgrade. On a busy worker the old values
included the time the loop took to handle the exit. Check alerts and
dashboards on
drakkar_executor_duration_seconds: a lower value is the task’s real run time, not a faster binary. - A task whose descendant holds the output pipes ends when the pipes
close. A child that starts a background process and exits is timed until
that process closes its stdout and stderr (more than 50 ms after the exit),
and counted on
drakkar_executor_exit_watch_fallbacks_total{reason="descendant_held_pipes"}. - Each worker starts one more thread,
drakkar-exit-watcher, which waits for task subprocesses to exit. It costs about 2 to 3 % of one core at 1200 spawns per second on Linux. When the host cannot watch, tasks are timed on the loop as before and counted ondrakkar_executor_exit_watch_fallbacks_total{reason}; the worker logsexit_watcher_startedorexit_watcher_offat startup. - New metadata keys in
task_completed/task_failed:run_started_at(the spawn time; the bar starts there) andexit_notice_ms(from the exit to the moment the worker handled it, a loop-stall indicator, also on the histogramdrakkar_executor_exit_notice_seconds). - The optional hook
task_run_seconds(result)lets a handler report the run time its binary measured; it sets the bar length andreported_run_seconds, and the metrics keep the framework measure. See task_run_seconds.
Autodiscover¶
The worker registry and the election of cluster tasks are one optional
feature, autodiscover, with one provider. It is off by default. A config that
still uses the root sections fleet or periodic fails the load.
What to do:
- If your workers use the workers list, the cache exchange or a cluster task,
turn the feature on:
autodiscover.enabled: trueandautodiscover.provider. A worker with it off publishes no card, reads no peers, runs no election and pulls no cache rows, and the workers list shows only this worker. - Choose one provider. You can no longer run the registry on one provider and the election on another. If your two providers differed, move both to the one whose service every worker reaches.
- With
filesystem, setstorage.shared_dir. It no longer falls back tostorage.dir:autodiscover.provider filesystem needs storage.shared_dirfails the load. Setstorage.shared_dirto the folder you used before, and the card files and locks stay where they are. - A handler with
@periodic(..., scope='cluster')needs the feature on, or the worker does not start. Turn the feature on, or give the taskscope='worker'. - An empty
cluster.namewith the feature on logscluster_name_emptyonce at startup. It changes nothing else: the lock scope staysdefault. - Move the keys with the table. As environment variables,
DK_FLEET__REGISTRY__*andDK_PERIODIC__ELECTION__*becomeDK_AUTODISCOVER__*, andDK_FLEET__CACHE_EXCHANGE__*becomesDK_CACHE__EXCHANGE__*.
What stays the same: the fleet_workers and task_locks tables, the Redis
keys, the Consul paths, the card, the lock body, and the metrics and their labels
feature="registry" and feature="election". A cluster keeps its cards and leases
through this change when it keeps its provider and its folder or connection.
Messages and events:
- A provider name outside the four now fails the load, with or without
enabled:autodiscover.provider must be one of consul, filesystem, postgres, redis, got '<v>'. - The log events
periodic_cluster_check_offandfleet_registry_disabled_no_dirare gone. Both states now stop the worker with a message. - With
autodiscoveroff, an enabledcache.exchangelogscache_exchange_off_no_autodiscoveronce, and the peer route answers as it does for a switched-off exchange.
The API server and the UI¶
The HTTP server is its own section, api. The ui section holds only what
the UI needs on that server. Move the keys with the table.
The environment variables follow the paths: DK_UI__PORT is DK_API__PORT,
DK_UI__PROBE_ENABLED is DK_UI__PROBE__ENABLED, and so on.
What a worker serves:
| Route | Needs |
|---|---|
/healthz, /readyz, /api/v1/peer/cache/changes |
api.enabled |
everything else: /ws, /api/v1/*, /api-docs, /docs, the pages |
api.enabled and ui.enabled |
With ui.enabled: false the worker fetches no bundle and the routes of the second
row answer 404. To run with no listener at all, set api.enabled: false and
ui.enabled: false. The probes are then gone, and the worker logs
ui_disabled_no_probes.
What can stop a config from loading:
api.enabled: falsewith the UI on:ui.enabled needs api.enabled; set ui.enabled to false, or set api.enabled to true.api.enabled: falsewith autodiscover on:autodiscover.enabled needs api.enabled: peers reach a worker through its API.
What changed for a worker with the UI off:
- A deployment that set
ui.enabled: falseso that no port opens must now also setapi.enabled: false. - The registry now runs on such a worker, so it publishes a card and appears in the
workers list of its peers. The card’s
features.uiisfalse, and the UI leaves that worker out of its fan-out. - The log event
fleet_registry_disabled_no_uiis gone.
In handler or test code: drakkar.uiserver.UIServer is APIServer, and
DrakkarApp.ui_url is api_url. SideEffectingEndpoint.config_key of the probe is
ui.probe.enabled.
The Databases tab has four views now (Files, Slice, Postgres and
Autodiscover), keeps its state in the address, and reads another worker only
when you pick it in the worker picker. It adds the slice download of a time
range, gzip downloads, the cache snapshot, and the delete of a merge result
behind the new key ui.delete_enabled (off by default). The startup warning
of a UI without a token names the delete route when the key is on. See
The Databases View.
Names, executor, threads, cache and the rest¶
The worker and cluster names are sections of their own, the thread pools are one
section, and every duration and size takes a unit. Change each old path with the
table. A value in seconds, milliseconds, minutes or bytes gets a unit: 120 becomes
2m, 500 (ms) becomes 500ms, 1048576 (bytes) becomes 1MiB.
The environment variables follow the paths: DK_WORKER_NAME_ENV is
DK_WORKER__NAME_ENV, DK_CLUSTER_NAME is DK_CLUSTER__NAME, DK_IO__MAX_THREADS is
DK_THREADS__IO, DK_UI__LOG_MIN_DURATION_MS is DK_LOGGING__MIN_TASK_DURATION, and so
on. An environment value takes the same text as the YAML value: DK_EXECUTOR__TASK_TIMEOUT=5m.
What changed in the behaviour:
worker.nameis new. The worker name is the value of the variable thatworker.name_envnames when that variable is set and not empty, elseworker.name, else the host name made safe (see Own folders and worker names). A worker withworker.nameset has a stable name, so the own archive scope does not logarchive_own_scope_unstable_worker_namefor it.cluster.name_envwins overcluster.namewhen its variable is set and not empty, as before.threads.io: 0andthreads.offload: 0fail the load withthreads.io must be null or from 1 to 512andthreads.offload must be null or from 1 to 32. Writenull, or leave the key out, to keep the derived size.cache.max_memory_entries: 0means no cap and logscache_max_memory_entries_unboundedat load;nullfails the load.runtime_health.stack_probe_enabledturns the stack probe on. A positive interval alone does nothing.ui.timeline.max_agetakes whole minutes from1mto24h;90sfails withmust be a whole number of minutes, got '90s'.- The slow-task log line (
slow_task_completed,slow_task_failed) followslogging.min_task_duration.
The summary line at startup has a new form:
[w-1/search] sources=[kafka:input-events/drakkar-workers/100poll] exec=4w/100win retries=3/120s api=8080 ui=on storage=/tmp/drakkar recorder=sqlite autodiscover=off cache=off metrics=9090 dlq=on sinks=[none] log=INFO
ui=on:<port>is now two tokens:api=<port>(orapi=off) andui=onorui=off.recorder=is always present:sqlite,postgresoroff.fleet=<provider>andelection=<provider>are one token,autodiscover=<provider>orautodiscover=off.- The cache token shows
/max=<n>only for a bounded memory cache. dlq=followsdlq.enabled:off, the configured topic,onfor the topic derived from the Kafka source, orunconfiguredwhen the DLQ is on but has no topic (an HTTP-only worker with nodlq.topic).
Update any log query or alert that parses the summary line.
In handler or test code: drakkar.config.IOConfig and OffloadConfig are one
ThreadsConfig, and OffloadPool takes the pool size (threads.offload, or None)
instead of a config model. DrakkarConfig.fleet_summary and election_summary are gone.
WorkerConfig and ClusterConfig hold the names.
Log events, metrics and smaller changes¶
- The offline limit.
autodiscover.offline_afterdefaults to1m; in 2.4.0 the limit defaulted to30seconds. A value you set explicitly keeps its meaning, but it must be at least10sand at least twiceheartbeat. A worker with the old default and a worker with the new one call the same peer offline at different times, so set the value on every worker. - Provider calls follow one set of rules: a time limit per attempt, retries with doubling
waits, and a circuit breaker (
autodiscover.resilience). An operation makes up to three attempts by default; setmax_retries: 0for one. -
Log events that were replaced:
Old log event Now fleet_registry_publish_failed,fleet_registry_list_failed,fleet_registry_withdraw_failedprovider_call_failedwithfeature="registry"andopset topublish,listorwithdraw. At most once a minute per operation;suppressedsays how many failures it stands for.fleet_registry_start_failedprovider_call_failedwithop="start". The worker does not replace a provider that fails to start: it tries the start again at the next heartbeat.recorder_archive_lock_taken_overperiodic_lock_taken_over, in categoryperiodic. Fieldsprovider,scope(such asmain/history.archive),previous_worker,previous_instance,age_seconds.recorder_archive_lock_put_back_failedperiodic_lock_put_back_failed, in categoryperiodic. Fieldsscope,folder,error.fleet_registry_disabled_no_ui,fleet_registry_disabled_no_dir,periodic_cluster_check_offGone. The states they described now stop the worker with a message, or are the normal state of a worker with autodiscover off.
fleet_registry_stop_failed means that the registry’s own stop raised; a provider whose
stop fails shows as provider_call_failed with op="stop". recorder_started has no
ignored_keys field. recorder_archive_fenced carries provider and reason
(taken_over or unconfirmed). ui_disabled_no_probes follows api.enabled.
- Metrics. drakkar_fleet_registry_errors_total counts operations that failed after their
retries (one count per operation) and loop iterations that raised; its op label has the
values start and stop too. drakkar_provider_calls_total,
drakkar_provider_call_duration_seconds and drakkar_provider_breaker_open carry the
label feature (registry, election or recorder). drakkar_task_speed,
drakkar_throughput and drakkar_task_rate do not exist: delete dashboards and alerts on them.
The DLQ metrics changed with the DLQ record; see that section.
New: drakkar_recorder_postgres_partitions_dropped_total{reason}.
- Config errors do not print the input of the failed section. A load error names the key
and the rule, but it adds no cut of the section, so a wrong connections block cannot
print a connection string.
- The lock body has a provider key, "provider":"filesystem" for the filesystem
provider. The registry card has features.ui (a boolean) and features.periodic.
- Task events have no cost and speed keys in task_completed metadata and
recent-tasks rows. There is no throughput frame on /ws and no
worker_state.throughput column.
- The redis package must be 7.2 or later. The redis providers and the Redis sink use it.
Installing py-drakkar brings a matching version; check it only when you pin redis
yourself.
- Contract v1.28. GET /api/v1/identity has capabilities, and the Worker rows of
GET /api/v1/workers have ui_enabled.
6. Handler and code changes¶
A handler and the code around it change in these places. Python names; the config changes are in the table.
- Plugins are not supported. The entry-point groups
drakkar.sinks,drakkar.registry_providersanddrakkar.election_providersare not read.sinks.custom,fleet.registry.plugin_optionsandperiodic.election.plugin_optionsare not config keys, andCustomPayload,CollectResult.custom,drakkar.sinks.registryandresolve_custom_sinkdo not exist. A handler that returnsCustomPayloadmust write the data through one of the built-in sinks (kafka,postgres,mongo,http,redis,filesystem) instead: pick the payload class of the sink that fits (for examplePostgresPayload(op='statement', ...)with a named statement, orHttpPayload), and move the sink’s settings intosinks.<type>.<name>. The providers arefilesystem,postgres,redisandconsul. periodic.tasksis removed. Delete the section and anyDK_PERIODIC__TASKS__*variable. To change the schedule or the lease of a task, change the arguments of its@periodicdecorator:interval,cronandlease_seconds(these keep their numbers). To stop a task, do not declare it.@periodictakesintervalinstead ofseconds:@periodic(30)or@periodic(interval=30)works,@periodic(seconds=30)raisesTypeErrorwhen the handler module is imported. A method name must be 1 to 64 characters ofa-z,0-9and_, not starting with a digit. A task withscope='cluster'needsautodiscover; without it the worker does not start (periodic task '<name>' has scope cluster, but autodiscover is off; ...).- The throughput feature is removed. Delete
throughput.cost_labelandthroughput.min_cost, and every reader ofcost,speedand thethroughputframe. Thecost_labelrole of the timeline labels does not exist. on_delivery_errorandon_error. The hook is called after every failed attempt, withattempt,retries_leftanddeclared_policy; see the DLQ record for the rules.ErrorAction.DLQwrites the execute record at once;executor.on_failureapplies when anon_errorhook spendsexecutor.max_retrieswithRETRYor raises.- Config classes.
KafkaConfigisKafkaConnectionConfig,CircuitBreakerConfigandBreakerConfigare gone,IOConfigandOffloadConfigareThreadsConfig,HistoryArchiveConfigisRecorderArchiveConfig, andUIRecorderConfig,UITraceConfig,SharedConfigandHistoryConfigare gone (RecorderConfigand its blocks replace them).PostgresConnectionConfig(schema='audit')is the only form of its schema key (the attribute staysschema_name). Models refuse unknown keywords, soDrakkarConfig(**other.model_dump())fails with a Postgres connection; usedrakkar.configmeta.dump_by_yaml_key. A config object holds seconds and bytes as numbers, and a unit text is accepted at construction (task_timeout='5m'). - Sinks.
KafkaSink,PostgresSink,MongoSinkandRedisSinktake the connection as their third argument.DrakkarApp.ui_urlisapi_url, anddrakkar.uiserver.UIServerisAPIServer.SideEffectingEndpoint.config_keyof the probe isui.probe.enabled. - Recorder.
EventRecordertakes aRecorderConfigas its first argument; the constructor keywordsarchiveandmerged_retention_daysare gone, both come fromconfig.archive.EventRecorder.reader_dbis gone: usefile_reader_dbfor the live file ormemory_storefor the memory store.archive_task_runsisarchive_scope, andPeriodicRoster.runs_archiveisPeriodicRoster.archive_scope.run_archive_passtakesonly_workerand needs afenceoronly_worker.archive_file_nametakesworker.OffloadPooltakes the pool size (threads.offload, orNone). - DLQ code.
read_dlq_entriesyieldsDLQEntry(key, value, headers, partition, offset).DLQMessageandParseFailurePayloadare removed; a parse failure is a record withdk-stage: parse. The summary of the replay tool hasskipped_old_formatinstead ofskipped_invalid. - Handler startup. A change of
sinks.defaults, or of a sink’son_failure,max_retries,delivery_timeout,breaker_failures,breaker_cooldownordepends_on, inon_startupis logged ason_startup_config_change_ignoredand does nothing; set them in the config file. A change ofsources.kafka.enabled,sources.http.enabledorstorage.dirinon_startupis ignored the same way. task.stdinis freed after a task’s last outcome. The framework setstask.stdin = Noneafteron_task_completeand its delivery, or afteron_errorwith no retry.arrange(),on_error, the retry run andon_task_completestill see it;on_message_complete,on_window_completeandon_http_request_completeseeNone(ongroup.tasksand onresult.task). A hook that read the stdin there must keep what it needs intask.metadatainstead.
7. Check the result¶
- Start one worker. If a key is still old, the load fails with one message that lists every unknown key. If a consumer names a connection that is not declared, or a feature lacks what it needs, the message names the key to change (the rules). Repeat until it starts.
-
Read the startup line
drakkar_starting. Its summary shows the new form:[w-1/search] sources=[kafka:input-events/drakkar-workers/100poll] exec=4w/100win retries=3/120s api=8080 ui=on storage=/var/lib/drakkar shared=/mnt/fleet recorder=sqlite autodiscover=filesystem cache=off metrics=9090 dlq=on sinks=[none] log=INFOapi=<port|off>andui=<on|off>are two tokens;recorder=is always present (sqlite,postgresoroff);autodiscover=<provider|off>replacesfleet=andelection=;dlq=isoff, the topic,onfor the derived topic, orunconfiguredwhen the DLQ is on with no topic. Update any log query that parses the line. 3. Open/api/v1/identityof a worker with the UI on:capabilitiesshows the recorder provider, the memory window, autodiscover and the cache exchange as the worker runs them. 4. Start the other workers. With autodiscover on, the workers list shows every peer. With the cache on,drakkar_fleet_peer_requests_total{outcome="ok"}grows once a peer has newclusterorglobalrows. 5. Wait for one rotation (recorder.sqlite.rotation_interval, default1h), or stop one worker cleanly.<storage.shared_dir>/history/<cluster>/(<storage.dir>/history/<cluster>/with no shared folder) then holds a sealed recorder file and its meta file. If it stays empty, checkdrakkar_recorder_unsealed_filesandrecorder_seal_failed.
8. Files and tables to delete¶
The worker does not delete files of earlier releases. Once no worker of the old release runs, delete:
| Old file or table | What it was |
|---|---|
<shared.dir>/history/<cluster>/.archive.lock and .archive.lock.stale.<token> |
The archive lock of 2.4.0. |
Postgres table <schema>.archive_locks |
The archive lease of an older election provider. DROP TABLE IF EXISTS <schema>.archive_locks;. The provider creates task_locks. |
<storage.dir>/<worker>-<timestamp>.db of a worker whose recorder is now off |
Left by an earlier sqlite run that did not stop cleanly; stop a worker cleanly before you turn its recorder off. |
| Sealed files and archives of a retired worker name, in the own archive scope | The own scope matches files by the worker name; see the archive scope. |
<storage.dir>/<worker>-cache.db (with -wal and -shm), <storage.dir>/<worker>.watchdog and <storage.dir>/<worker>-<timestamp>.db |
Own files of the flat layout. Move a recorder file into the worker’s own folder to have it sealed, or delete it; see Own folders and worker names. |
To 2.4.0 from an older release¶
Release 2.4.0 moved the settings for files, archives, worker discovery and cache
exchange into four sections: storage, shared, history and fleet. Some old keys
moved, a few were removed. The old keys are not read any more: a config that still uses
one fails to load with a message that lists every old key it found. This guide ends at
the 2.4.0 layout. Then do the guide above: its
table lists the 2.4.0 keys (shared.dir, history.archive.*,
fleet.*) with their final places.
Follow steps 1 to 8 in order. Plan the move to 2.4.0 with all workers stopped: a worker of 2.4.0 does not read the files an older release wrote, and an older and a newer worker cannot run side by side.
Step 1. List the keys you use today¶
Search your YAML files and your environment (Kubernetes manifests,
.env files, CI variables) for these keys. As environment variables they
are DK_ plus the YAML path with __ between the levels.
| YAML path | Environment variable |
|---|---|
ui.recorder.db_dir |
DK_UI__RECORDER__DB_DIR |
ui.recorder.archive_enabled |
DK_UI__RECORDER__ARCHIVE_ENABLED |
ui.recorder.archive_window_hours |
DK_UI__RECORDER__ARCHIVE_WINDOW_HOURS |
ui.recorder.archive_retention_days |
DK_UI__RECORDER__ARCHIVE_RETENTION_DAYS |
ui.recorder.dbstats_warm_interval_seconds |
DK_UI__RECORDER__DBSTATS_WARM_INTERVAL_SECONDS |
ui.recorder.dbstats_inline_scan_limit |
DK_UI__RECORDER__DBSTATS_INLINE_SCAN_LIMIT |
ui.workers_offline_after_seconds |
DK_UI__WORKERS_OFFLINE_AFTER_SECONDS |
cache.db_dir |
DK_CACHE__DB_DIR |
cache.peer_sync.enabled |
DK_CACHE__PEER_SYNC__ENABLED |
cache.peer_sync.interval_seconds |
DK_CACHE__PEER_SYNC__INTERVAL_SECONDS |
cache.peer_sync.batch_size |
DK_CACHE__PEER_SYNC__BATCH_SIZE |
cache.peer_sync.timeout_seconds |
DK_CACHE__PEER_SYNC__TIMEOUT_SECONDS |
cache.peer_sync.cycle_deadline_seconds |
DK_CACHE__PEER_SYNC__CYCLE_DEADLINE_SECONDS |
Step 2. Choose a layout¶
- One host. All workers run on one machine (or you run one worker).
Set only
storage.dir. Workers of one host can share it: each file name carries the worker name. - A fleet across hosts. Give every worker its own
storage.diron a local disk (for example a per-pod volume), and mount one shared folder on every worker asshared.dir(for example aReadWriteManyvolume). Each worker writes its live files only tostorage.dir. The shared folder holds the worker registry, the history, the archives and the merge results. A finished recorder file is sealed and moved fromstorage.dirinto<shared.dir>/history/<cluster>/in the background.
shared.dir empty means “the same folder as storage.dir”.
The cache file is no longer shared. Each worker keeps
<storage.dir>/<worker>-cache.db to itself, and workers pull each other’s
cluster and global cache rows over HTTP, from the URL on each
registry card. So storage.dir does not need to be shared for
the cache any more, but every worker must reach the UI port of its peers.
Step 3. Rename the moved keys¶
| Old YAML path | New YAML path | Old environment variable | New environment variable |
|---|---|---|---|
ui.recorder.db_dir |
storage.dir (and shared.dir for a fleet across hosts) |
DK_UI__RECORDER__DB_DIR |
DK_STORAGE__DIR (DK_SHARED__DIR) |
ui.recorder.archive_enabled |
history.archive.enabled |
DK_UI__RECORDER__ARCHIVE_ENABLED |
DK_HISTORY__ARCHIVE__ENABLED |
ui.recorder.archive_window_hours |
history.archive.window_hours |
DK_UI__RECORDER__ARCHIVE_WINDOW_HOURS |
DK_HISTORY__ARCHIVE__WINDOW_HOURS |
ui.recorder.archive_retention_days |
history.archive.retention_days |
DK_UI__RECORDER__ARCHIVE_RETENTION_DAYS |
DK_HISTORY__ARCHIVE__RETENTION_DAYS |
ui.workers_offline_after_seconds |
fleet.registry.offline_after_seconds |
DK_UI__WORKERS_OFFLINE_AFTER_SECONDS |
DK_FLEET__REGISTRY__OFFLINE_AFTER_SECONDS |
cache.peer_sync.enabled |
fleet.cache_exchange.enabled |
DK_CACHE__PEER_SYNC__ENABLED |
DK_FLEET__CACHE_EXCHANGE__ENABLED |
cache.peer_sync.interval_seconds |
fleet.cache_exchange.interval_seconds |
DK_CACHE__PEER_SYNC__INTERVAL_SECONDS |
DK_FLEET__CACHE_EXCHANGE__INTERVAL_SECONDS |
cache.peer_sync.batch_size |
fleet.cache_exchange.page_size |
DK_CACHE__PEER_SYNC__BATCH_SIZE |
DK_FLEET__CACHE_EXCHANGE__PAGE_SIZE |
cache.peer_sync.timeout_seconds |
fleet.cache_exchange.timeout_seconds |
DK_CACHE__PEER_SYNC__TIMEOUT_SECONDS |
DK_FLEET__CACHE_EXCHANGE__TIMEOUT_SECONDS |
cache.peer_sync.cycle_deadline_seconds |
fleet.cache_exchange.cycle_deadline_seconds |
DK_CACHE__PEER_SYNC__CYCLE_DEADLINE_SECONDS |
DK_FLEET__CACHE_EXCHANGE__CYCLE_DEADLINE_SECONDS |
fleet.registry.offline_after_seconds has a new default in this release:
60 seconds, not 30. See the guide above.
Two rules changed together with the keys:
history.archive.retention_daysmust now cover the due delay plus one window:retention_days * 24 >= due_after_hours + window_hours(or be0). The default 30 days covers the defaults (48 + 24 hours).page_sizeaccepts 1 to 1000.
Step 4. Delete the removed keys¶
| Removed key | Why |
|---|---|
cache.db_dir |
The cache file lives in storage.dir. |
ui.recorder.dbstats_warm_interval_seconds |
Database statistics are no longer cached in a shared file. |
ui.recorder.dbstats_inline_scan_limit |
Same as above. |
Step 5. Review the new keys¶
These keys are new. Their defaults work for most deployments.
| Key | Default | What it does |
|---|---|---|
storage.dir |
/tmp/drakkar |
This worker’s own files. The worker creates the folder with mode 0700 when it is missing. '' = memory-only (recorder persistence none). |
shared.dir |
'' |
The folder all workers see. '' = storage.dir. |
history.archive.due_after_hours |
48 |
A window is archived this many hours after it ends. |
history.archive.lock_stale_seconds |
7200 |
An archive lock or work file older than this belongs to a dead archiver. The guide above replaces it with recorder.archive.lease and recorder.archive.sweep_after. |
history.merged_retention_days |
32 |
UI merge results older than this are deleted. 0 = never. |
fleet.registry.provider |
filesystem |
How workers find each other: filesystem, postgres, redis or consul. Needs ui.enabled. |
fleet.registry.heartbeat_seconds |
10 |
How often a worker publishes its card. |
fleet.registry.refresh_seconds |
15 |
How often a worker reads the other cards. |
fleet.registry.prune_after_seconds |
86400 |
Cards older than this are deleted. |
fleet.registry.resilience.timeout_seconds |
5 |
Time limit for one attempt of a registry operation. The resilience block also holds retries and a circuit breaker; see Fleet registry. |
fleet.cache_exchange.max_concurrent_peers |
4 |
Peers pulled from in parallel. |
ui.trace.history_max_files |
256 |
Most history files one trace request reads. |
ui.trace.history_max_seconds |
10 |
Time limit for one trace request over history. |
See Configuration for every field, and Fleet registry for how workers find each other.
Two existing keys changed what they cover:
ui.allowed_ws_originsalso decides the cross-origin reads that the UI sends to every worker of the cluster (trace, label trace, databases list). Withui.auth_tokenset, list the origin of every worker here, for example["http://10.0.3.17:8080", "http://10.0.3.18:8080"]. Otherwise the UI of one worker cannot read the others and lists them as unreachable. See Cross-origin reads.ui.auth_tokendoes not protect the new routes under/api/v1/peer/: workers call them on each other without a token. Anyone who can reach the UI port can read theclusterandglobalcache rows of a worker that serves the cache exchange. See The public peer route.
Step 6. Kubernetes example¶
Before:
env:
- name: DK_UI__RECORDER__DB_DIR
value: /var/lib/drakkar
- name: DK_CACHE__PEER_SYNC__INTERVAL_SECONDS
value: "30"
volumeMounts:
- name: recorder
mountPath: /var/lib/drakkar
After, for a fleet across hosts (a per-pod volume for own files, one
ReadWriteMany volume for the fleet):
env:
- name: DK_STORAGE__DIR
value: /var/lib/drakkar
- name: DK_SHARED__DIR
value: /mnt/fleet
- name: DK_FLEET__CACHE_EXCHANGE__INTERVAL_SECONDS
value: "30"
volumeMounts:
- name: own-files # emptyDir or a per-pod PVC
mountPath: /var/lib/drakkar
- name: fleet # ReadWriteMany PVC, the same on every pod
mountPath: /mnt/fleet
Step 7. Check the result¶
-
Start one worker. If a key is still old, the load fails with one message that lists every unknown key, for example:
-
Read the startup line
drakkar_starting. Its summary showsstorage=<folder>,shared=<folder>when the shared folder differs, andfleet=<provider>(fleet=offwhen the UI is off or no folder resolves). When the election provider (periodic.election.provider) is notfilesystem, it also showselection=<provider>afterfleet=. - Start the other workers. The workers list in the UI shows every peer.
With the cache on,
drakkar_fleet_peer_requests_total{outcome="ok"}grows on each worker once a peer has newclusterorglobalrows. Other outcomes mean that a peer could not be reached at the URL on its card, or answered with an error; the log eventfleet_peer_request_failednames the peer and the URL. - Wait for one rotation (
ui.recorder.rotation_interval_hours, default 1 hour), or stop one worker cleanly. Then look in<shared.dir>/history/<cluster>/(<storage.dir>/history/<cluster>/whenshared.diris empty). It holds a sealed recorder file<worker>-<YYYY-MM-DD__HH_MM_SS>.dband its meta file<worker>-<YYYY-MM-DD__HH_MM_SS>.db.meta.json.<cluster>is the cluster name with every character outside[a-zA-Z0-9_-]replaced by_, ordefaultwhen the cluster name is empty. If the folder stays empty, checkdrakkar_recorder_unsealed_filesand the log eventrecorder_seal_failed. See Sealing.
Step 8. Old files¶
Upgrade with all workers stopped. The new release does not read the files
an older release wrote and does not migrate them: after the upgrade the
history folders start empty. Delete the old folder, or point storage.dir
and shared.dir at empty folders. A rolling upgrade from the older release
is not supported.
The worker does not delete the old files. Delete them yourself:
| Old file | What it was |
|---|---|
<worker>-<YYYY-MM-DD__HH_MM_SS>.db (and its -wal, -shm) |
Rotated recorder files. |
<worker>-live.db |
Link to the live recorder file. Workers no longer open each other’s live files. |
<worker>-cache.db (a link) and <worker>-cache.db.actual (and its -wal, -shm) |
The old cache link and cache file. The cache file is now a plain <worker>-cache.db, private to its worker. Delete both before the first start: the worker does not remove them, and an old link with that name is followed to the old .actual file. |
.dbstats.db |
Statistics cache of the Databases page. Sealed files now carry a meta file. |
.archive-<cluster>.lock |
The old archive lock. Release 2.4.0 kept the lock in history/<cluster>/.archive.lock, and this release keeps it in tasks/<cluster>/history.archive.lock; see Old lock files. |
<cluster>-<from>__<to>.db.gz in storage.dir |
Old archives. The archive pass now works only inside <shared.dir>/history/<cluster>/. |
merged-*.db in storage.dir |
Old UI merge results. New ones go to <shared.dir>/merged/. |
Old recorder files with the worker’s own name
An old rotated file named <worker>-<YYYY-MM-DD__HH_MM_SS>.db matches
the leftover rule for that worker name.
If it is still in storage.dir when that worker starts, the worker
seals it and moves it into the history folder like a file of its own.
Delete the old files before the first start if you do not want them in
the history.