Skip to content

Update dependency semantic_logger to v5.3.0 - #1310

Merged
Taucher2003 merged 1 commit into
mainfrom
renovate/semantic_logger-5.x-lockfile
Nov 28, 2026
Merged

Taucher2003 merged 1 commit into
mainfrom
renovate/semantic_logger-5.x-lockfile

Conversation

@renovate

@renovate renovate Bot commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Note

This PR body was truncated due to platform limits.

This PR contains the following updates:

Package Change Age Adoption Passing Confidence Diffend
semantic_logger (source, changelog) 5.2.0 → 5.3.0 age adoption passing confidence Diff

Release Notes

reidmorrison/semantic_logger (semantic_logger)

v5.3.0

Compare Source

Added
  • The formatters that write a metric with its log entry also write the metric's dimensions:
    :json, :raw, :fluentd, :ecs, :syslog_cee, and :new_relic_logs as a dimensions Hash,
    :loki as a dimensions value in JSON, and :open_telemetry as a
    semantic_logger.dimensions.<key> attribute for each one. So do the appenders that use them,
    such as :elasticsearch, :splunk_http, and :mongodb. They are written only with a metric, as
    Log#dimensions? tells a custom formatter. See
    Metrics in log appenders.
  • Experimental: on Ruby 4.0 and later, code running in a Ractor other than the main one can log, and
    the main Ractor writes its entries to the appenders. Before, any log call from such a Ractor raised
    Ractor::IsolationError. See
    Log from Ractors.
  • SemanticLogger.context returns a frozen snapshot of the current tags, named tags, and silence
    level, and SemanticLogger.with_context(context) { ... } applies it in another thread or fiber,
    such as a thread pool's worker or an Async task. Tags belong to the fiber that set them, so these
    hand them over explicitly. See
    Hand tags to another thread or fiber.
  • SemanticLogger.backtrace_cleaner= sets a backtrace cleaner, such as Rails.backtrace_cleaner,
    that leaves out or shortens the lines of each exception's backtrace, and of each exception that
    caused it, before they are logged. A cleaner is any object that responds to #clean, as
    ActiveSupport::BacktraceCleaner does, or to #call, such as a Proc. The text formatters
    (:default, :color, :pattern, :syslog) and the JSON formatters (:json, :fluentd) use
    it, and so do the appenders that use :json by default (:http, :elasticsearch_http, :tcp,
    :udp, :kafka, :rabbitmq, :cloudwatch_logs). The others, including :raw and the
    formatters written for a particular service, write the full backtrace, and appenders that send the
    exception to an error service are not affected. The new backtrace_cleaner formatter option
    chooses for one appender: true for the application's cleaner, false for the full backtrace,
    or a cleaner of its own. When a cleaner leaves out every line, or raises, the full backtrace is
    logged, and an error it raises is reported to the internal logger. Nothing changes until a
    cleaner is set. See
    Cleaning backtraces.
  • Log#backtrace_of(exception, cleaner:) returns an exception's backtrace as a cleaner cleans it,
    cached on the entry, and Log#backtrace_to_s accepts cleaner:, for custom formatters.
  • SemanticLogger.sensitive_keys= names the keys, such as passwords and access tokens, whose values
    are replaced with [FILTERED] in every log entry before any appender writes it (discussion #​272).
    It takes an Array of Symbols and Strings, which match any key whose name contains them, ignoring
    case, as in Rails' config.filter_parameters, and Regexps; or a Regexp; or an
    ActiveSupport::ParameterFilter, or any object that responds to #filter_param; or a Proc. Keys
    are matched by name, as written and in snake_case, so that :_key also matches "X-Api-Key",
    "apiKey", and "APIKey". The payload, named tags, the context that on_log subscribers add,
    and metric dimensions are redacted at any depth, inside Hashes, Arrays, Sets, Structs, Data,
    OpenStructs, and ActionController::Parameters, once per entry on the thread that writes the
    entries, so every appender, including error services and appenders of your own, writes the
    redacted entry. The application's own Hashes are never changed, and an entry with no sensitive key
    is written as it is, unless it holds a structure that holds itself or is nested more than 32
    levels deep. When an entry cannot be redacted, the field is replaced with
    {redaction_failed: "ErrorClass"} and the error is reported to the internal logger. The message,
    tags, and exception are not redacted, and on_log subscribers and logger filters receive the
    entry as it was logged. Nothing changes until sensitive keys are set. See
    Redacting sensitive data.
  • SemanticLogger.call_site_level= records where each entry at or above that level was logged: the
    file, line, and method of the code that made the log call, in Log#call_site. Unlike
    backtrace_level it reads only the stack frames up to that code, so it adds about 1.5 µs to a log
    call however deep the stack is, where a backtrace adds 16 µs or more. It is off (nil) by default.
    With it on, the text formatters show the method after the file name and line number, :json and
    the other formatters built on :raw add a method field, :pattern has a %{method} directive,
    :ecs writes log.origin.function, :new_relic_logs writes method.name, and :open_telemetry
    writes code.function.name. When a log call supplies a backtrace:, its first line is the call
    site. SemanticLogger.call_site_skip_paths= skips the frames of an application's own logging
    helpers, so that entries record the code that called them. See
    Recording where each entry was logged.
    Resolves discussion #​219.
  • A log call, or a measure_* call, can pass call_site: to say where the entry was logged, as a
    Thread::Backtrace::Location or a SemanticLogger::CallSite, or call_site: false for an entry
    with no such code, which records none without reading the stack for it. For code that logs on
    behalf of other code, such as a log subscriber. It is only recorded at or above call_site_level.
    See
    Recording where each entry was logged.
  • A custom appender whose #batch is all or nothing can now say, from the new
    #fails_any_batch?(exception), that a message error would fail any batch, whatever it holds, such
    as a request refused for its credentials. A batch that fails with such an error is then discarded at
    once, rather than split up and each part written again to find the entries at fault. It returns
    false by default, so that every batch is split as before. See
    Custom appenders.
  • The :loki formatter's structured_metadata: option writes the process id, the thread name, or
    both, as the structured metadata pid and thread, instead of as stream labels, so that a
    process restart or a new thread no longer adds a Loki stream. A query can still filter on them,
    as in {application="shop"} | thread="worker-1". A payload key of that name is then written as
    payload_pid or payload_thread, and a named tag or context key as the label pid_2 or
    thread_2. It needs a Loki that accepts structured metadata, with schema v13 and
    allow_structured_metadata, on by default since Loki 3.0. Set it with
    add_appender(appender: :loki, formatter: {loki: {structured_metadata: [:pid, :thread]}}, ...).
    The default is still to write them as labels; v6 changes it (see Deprecated). See
    pid and thread as structured metadata.
  • The :splunk_http appender can be added with batch: true, to send many entries in each request to
    Splunk's HTTP Event Collector, as event objects stacked one after the other, each one what it sends
    for that entry on its own, with its index: and source_type:. Before, with its default formatter,
    every batch failed, so nothing was written. When the collector rejects a batch at one of its
    entries, such as with "Invalid data format", it has already indexed those before it: that entry is
    discarded, and only the entries after it are sent again, so that none is indexed twice. Batching
    needs a formatter that formats each entry as exactly one event object, as the default formatter
    does. It is still not batched by default. See Splunk HTTP.
  • A custom appender whose destination stores a batch in order, up to the first message it rejects,
    can say which one from #rejected_entry(exception): the messages before it are counted as written,
    it is discarded, and only those after it are written again, rather than the batch split up and
    written again in parts. See
    Custom appenders.
  • Log#capture(key, value) and Log#captured(key) keep an object with a log entry for an
    appender's own use, such as state of the logging thread captured by an on_log subscriber, where
    formatters do not write it, unlike Log#set_context. See
    Helper methods.
Changed
  • A deprecation warning now names the line of the application that used what is deprecated, such as
    where it added a deprecated appender, and starts with SemanticLogger: , as in
    config/initializers/logging.rb:12: warning: SemanticLogger: .... Before, it named no line. As
    before, Ruby only shows it while Warning[:deprecated] is true. See
    Seeing deprecation warnings.
  • The :open_telemetry appender no longer sends metric-only entries, which have a metric but no
    message and no exception, by default. It sent each one as a log record with no body, never as an
    OpenTelemetry metric; they are meant for the metric subscribers. Add the appender with
    metrics: true to keep sending them. See the
    v5.3 upgrade notes.
  • The :statsd and :new_relic metric subscribers record a metric that has dimensions under its
    name alone, leaving out the dimensions, which neither the statsd-ruby client nor the New Relic
    agent's metric API accepts. Before, they left such a metric out altogether. The :statsd
    subscriber now also takes the options of every subscriber, such as level: and filter:, as the
    other metric subscribers do. See the
    v5.3 upgrade notes.
  • The #logger of an appender added with logger: or appender: :open_telemetry returns its
    internal logger, the one it reports its own problems to, as for every other appender, and
    #logger= replaces that internal logger. Before, they returned and replaced the logger that the
    appender writes to; a logger: appender's is now #wrapped_logger, which the appender returned
    by add_appender(logger: ..., async: true) also answers. See the
    v5.3 upgrade notes.
  • log_exception: :partial, the default for measure_* blocks, now also adds each exception that
    caused the logged one to the message, as -- Cause: Class: message, so that it names the same
    exceptions as log_exception: :full. A cause's message is left out when it is empty, is its class
    name, or is already in the message, as when the exception that wraps it copied it into its own:
    -- Exception: ActionDispatch::Http::MimeNegotiation::InvalidType: "foo/bar" is not a valid MIME type -- Cause: Mime::Type::InvalidMimeType. Before, the causes were left out. See the
    v5.3 upgrade notes.
  • The :http appender, and the appenders derived from it, such as :loki, :splunk_http,
    :elasticsearch_http, and metric: :signalfx, close their connection when they are closed, such
    as when removed with SemanticLogger.remove_appender, or by SemanticLogger.close. Before, it was
    left open. One that is added again opens a new connection for its next request, and keeps it for
    the requests that follow.
  • SemanticLogger.remove_appender waits, as SemanticLogger.flush does, until the log messages
    already logged are written to the other appenders, and those are flushed, before it closes the
    appender. Before, it closed the appender at once, while the processor could still be writing a
    message to it, such as on the socket of a :tcp appender, or the connection of an :http
    appender, which could then open a new connection that was left open. Called on the processor's own
    thread, such as by an appender as it writes, it still closes the appender at once. Called on the
    thread of an appender added with async: true or in batches, such as by that appender as it
    writes, removing itself or another appender, it does not wait, since the processor's thread may be
    waiting for that thread: it returns true at once, and the processor's thread, once it has written
    the messages logged before, closes the appender between writes, then removes it. See
    Adding and removing appenders.
  • Log#each_exception accepts the exception to start from, for custom formatters and appenders that
    walk the causes of an exception the entry does not keep.
  • A call_site key of a logged Hash is now the call_site: argument when its value is false, a
    Thread::Backtrace::Location, or a well-formed SemanticLogger::CallSite, and is no longer logged
    in the payload. A nil value counts as not supplied, as for the other arguments, and is not logged
    either. Other values, such as a String, are still logged in the payload.
  • SemanticLogger.host=, application=, and environment= store a frozen copy of the value
    supplied, so that code in a Ractor can read it, and the default host name is frozen too.
    The value supplied is left as it is.
  • The :open_telemetry appender sends the message as the body of each log record, as documented,
    instead of a map of the whole log entry. The named tags become attributes of their own alongside
    the payload, and the entry's own fields become attributes: the exception as exception.type,
    exception.message, and exception.stacktrace, the file and line as code.file.path and
    code.line.number, plus thread.name, process.pid, semantic_logger.name,
    semantic_logger.tags, semantic_logger.duration_ms, semantic_logger.metric, and
    semantic_logger.metric_amount. The host, application, and environment are no longer sent, since
    OpenTelemetry reports them in its resource (OTEL_SERVICE_NAME, OTEL_RESOURCE_ATTRIBUTES).
    The formatter now returns the keyword arguments for the OpenTelemetry Logger#on_emit, so a
    custom formatter for this appender must do the same. See the
    v5.3 upgrade notes. Resolves #​428.
  • The :elasticsearch and :opensearch appenders send again the entries of a bulk request that the
    server rejected with status 429 because its write queue was full, which are likely to be indexed a
    little later. Before, they were reported to the internal logger and discarded with the entries that
    failed for any other reason. Only those entries are sent again, so that none is indexed twice, up to
    3 times, after waiting 0.2, 0.4, then 0.8 seconds. That holds up the thread that writes the entries
    for waits of at most 1.4 seconds for a request, plus up to 3 more bulk requests. The entries still
    not indexed are reported and discarded, as before. See
    Elasticsearch and the
    v5.3 upgrade notes.
  • An appender added with async: true or in batches sends an entry or batch that its destination
    could not take again once it has backed off, rather than discarding it, when the appender says that
    the write wrote nothing and is worth trying again. Once the destination has answered it with a
    failure after it was sent again 3 times, it is discarded, and the thread carries on with the next
    one; a write that never reached the destination, such as one that could not connect, is not
    counted, so an outage loses no entries until the thread gives up after async_max_retries. The
    :http, :elasticsearch_http, :splunk_http, and :loki appenders, and the :signalfx metric
    subscriber, say so for a 408, 429, or 503, such as a 503 while Loki restarts, and for a request
    they could not send because they could not connect. A 500, 502, or 504, and a request that failed
    once it was sent, such as one whose answer timed out, are still discarded. A custom appender says
    so from the new #wrote_nothing?(exception), and that the write never reached the destination
    from #not_sent?(exception), both of which return false by default.
    A flush or close, including the flush at exit, no longer waits out the back-offs during an outage:
    submitting one ends the back-off under way, and until it has run, an entry or batch that fails is
    discarded, counted as failed, without backing off, and so are the entries queued after it, ahead
    of the flush or close (see below). Before, a flush with 5 entries queued during an outage waited
    1 + 2 + 3 + 4 + 5 seconds. See
    Retry a failing appender
    and the v5.3 upgrade notes.
  • During an outage of the destination of an appender added with async: true or in batches, the
    process exits within seconds, rather than hours. A flush or close, including the flush at exit,
    now discards the entries queued ahead of it once a write fails because of the destination, counted
    as failed, rather than send each one in turn, which against a server that does not answer took
    up to its open_timeout each. At exit, each such appender is also told that the process is
    exiting before the flush, directly rather than through the main queue, so that it stops backing off
    and sending again what failed even while the thread that writes to every appender is held up
    handing it an entry. A destination that takes the entries still gets every one of them. See
    Retry a failing appender
    and the v5.3 upgrade notes.
  • During an outage of the destination of an appender added without async: true, and not in
    batches, such as a plain :http, :splunk_http, :tcp, or :udp, the process exits within
    seconds too. Such an appender has no queue of its own, and the thread that writes to every
    appender does not back off when it fails, so the flush at exit waited while each queued entry
    failed in turn, up to the read_timeout or open_timeout of an HTTP based appender each. Now,
    once its write fails because of its destination while the process exits, rather than the content
    of the entry, it is given no more entries for the rest of the flush at exit, and the number it was
    not given is reported to the internal logger at the flush, which then still flushes it, so that it
    delivers the entries it already accepted, such as those that the producer of a :kafka appender
    holds. The other appenders still get every entry. See
    Retry a failing appender
    and the v5.3 upgrade notes.
Deprecated
  • Building the :loki formatter without structured_metadata:, as adding the :loki appender does
    unless it is given formatter: {loki: {structured_metadata: ...}}. It still writes pid and
    thread as stream labels, but v6 writes them as structured metadata by default, so it now reports
    a deprecation warning. Pass structured_metadata: [] to keep them as labels, or
    structured_metadata: [:pid, :thread] to write them as structured metadata. See the
    v5.3 upgrade notes.
  • Adding the :kafka, :rabbitmq, or :udp appender without metrics:. They still send
    metric-only entries by default, which have a metric but no message and no exception, but v6 leaves
    them out by default, as the other log appenders do, so they now report a deprecation warning. Pass
    metrics: true to keep sending them, or metrics: false to leave them out. See the
    v5.3 upgrade notes.
  • Giving add_appender a formatter block, or the options of an appender, such as level:,
    formatter:, or filter:, with an appender or metric subscriber instance, such as
    add_appender(appender: my_appender, level: :warn). The instance was created with its own options,
    so they were ignored without a word. They still are, but add_appender now reports a deprecation
    warning that names them, and v6 raises ArgumentError for them. Set them on the instance itself.
    An option given as nil sets nothing, and is not reported. The options of add_appender itself,
    such as async: and batch:, still apply to an instance. See the
    v5.3 upgrade notes.
  • Giving add_appender more than one destination, such as
    add_appender(file_name: "log/app.log", io: $stdout). It added only the first of file_name:,
    io:, logger:, appender:, and metric:, and ignored the others without a word, so nothing
    was written to $stdout. It still does, but now reports a deprecation warning that names the
    destination it uses and those it ignores, and v6 raises ArgumentError for them. Call
    add_appender once for each destination. A destination given as nil is not reported. See the
    v5.3 upgrade notes.
  • A negative metric_amount on a log call or a measure_* call with a metric:, such as
    logger.info(metric: "cart/items", metric_amount: -1). It is still logged and sent to the
    metric subscribers as before, but v6 counts a metric only upward and drops a negative amount, so it
    now reports a deprecation warning, once per process, at the line of the first such call. Count
    what goes down as a metric of its own, such as cart/items_removed. See
    Negative metric amounts.
Removed
  • logger_measure_method, an experiment that SemanticLogger::Loggable added to each class, and
    that was never part of the documented API. To log how long a method takes, wrap its body in a
    measure_* block, and pass metric: to keep the metric it logged, such as
    logger.measure_info("#run", metric: "MyClass/run") { ... }. To trace it, use OpenTelemetry's
    tracer.in_span, or the method tracer of an APM agent. See the
    v5.3 upgrade notes.
Fixed
  • The reports of the log messages dropped or discarded by the thread that writes to every appender,
    or by an appender added with async: true or in batches, made at most once every
    dropped_message_report_seconds, are timed with the monotonic clock. Before, when the system clock
    stepped back, as NTP can, the next report was held back until the clock had caught up again, for
    as long as it had stepped back.
  • SemanticLogger.flush, SemanticLogger.close, and SemanticLogger.clear_appenders! return
    false at once, without flushing, when called on the thread of an appender added with
    async: true or in batches, such as by a custom appender as it writes, and the first such call is
    reported to the internal logger. Before, they waited forever, since the processor's thread waited
    for that thread to flush its appender, and once the processor's queue was full, so did every
    thread that logged. See Flushing.
  • A message logged on the thread of an appender added with async: true or in batches, such as by a
    library that the appender calls as it writes, is dropped at once, and counted as dropped, when it
    finds the processor's queue full while that appender's own queue is full too, or a flush or close
    of that appender is waiting, whoever asked for it. Before, it could wait forever: the processor's
    thread, which makes room, can itself be waiting for room on that appender's full queue, or for that
    appender to flush, and then so did every thread that logged.
  • add_appender raises ArgumentError when it would batch an appender whose formatter cannot
    format a batch, such as formatter: :default or a Proc given to :http, :loki, or
    metric: :signalfx with batch: true, and now also a formatter block (see the entry on blocks
    below), and says what to do instead. Before, it added the appender, but every batch failed
    on the appender's worker thread, which backed off and tried again, so nothing was ever written,
    and once its queue was full, logging blocked, unless it was added with non_blocking: true. The
    error names the formatter. A custom appender whose #batch formats each entry with format_log
    is batched with any formatter, as before, and one that cannot be batched in some configuration can
    say why from #batch_refusal. When add_appender fails after creating the appender, such as for
    one that it cannot batch, it closes the appender. See the
    v5.3 upgrade notes.
  • add_appender(appender: :elasticsearch_http, batch: true) raises ArgumentError, and says to use
    the :elasticsearch appender, which sends its entries in bulk requests, to send them in batches.
    Before, it posted each batch as a JSON array to the url's own path, such as /, which
    Elasticsearch rejects, since it indexes a batch only through its bulk API, so nothing was ever
    indexed. A custom appender can refuse to be batched in the same way, with a reason of its own, by
    returning it from #batch_refusal. See the
    v5.3 upgrade notes.
  • The :statsd metric subscriber records metrics as soon as it is added. Before, it created its
    Statsd client only when reopened, such as after a fork, so in a process that did not fork, such as
    a single Puma or Sidekiq process, every metric failed with NoMethodError and was reported to the
    internal logger instead. A url: that is not udp://, or whose host cannot be resolved, now raises
    as the subscriber is added, as for the :udp appender, and an IPv6 address such as
    udp://[::1]:8125 is now accepted. Reopening it, such as after a fork, now reconnects its client,
    which closes the socket the client had, instead of leaving it open, and leaves the client as it
    was when the host cannot be resolved.
  • add_appender(metric: ...) with a value that is neither a Symbol nor a SemanticLogger::Subscriber
    now names that value in its ArgumentError. Before, the message named the appender: option
    in its place, usually as not: nil.
  • A block given to add_appender formats the entries of an appender or metric subscriber named by a
    Symbol, such as add_appender(appender: :tcp, server: "localhost:514") { |log| log.message }, as
    it does for io:, file_name:, and logger:, taking precedence over formatter:. Before, the
    block was ignored, and the appender used its formatter: or its default formatter, so what such an
    appender sends changes. With batch: true, :http, :loki, and metric: :signalfx raise
    ArgumentError for such a block (see above). Remove the block to keep the output of v5.2. See the
    v5.3 upgrade notes.
  • The :elasticsearch and :opensearch appenders accept metrics: true, to also index metric-only
    entries: a metric without a message or an exception. Before, metrics: was passed on to the
    Elasticsearch or OpenSearch client, and those appenders always left metric-only entries out.
  • The measure_* and benchmark_* methods, and measure and benchmark, keep a dimensions:
    option, such as metric: "supplier/add_user", dimensions: {supplier: "acme"}, with a block or
    with duration:. Before, the entry had no dimensions, so the :signalfx metric subscriber could
    not break the metric down by them, and the structured formatters did not write them. A
    dimensions: value that is not a Hash is ignored, as the other measure options ignore a value
    that is not valid for them. SignalFx now sends such a metric under its own name, as it sends any
    metric with dimensions, instead of as Application.average and Application.counter, and
    without the named tags listed in its own dimensions: option, which it only adds to a metric
    without dimensions, so put those values in the metric's dimensions:. SignalFx also treats empty
    dimensions, such as dimensions: {} or {supplier: nil}.compact, as none, as Log#dimensions?
    does, on a log call too. Before, a metric logged with them was sent under its own name, and a
    duration without a count, without the class and action taken from its name, or the named tags
    listed in the subscriber's dimensions: option. See the
    v5.3 upgrade notes.
  • The :loki formatter writes a metric's metric_value as a String, such as "3", and leaves it out
    for a metric without an amount. Loki accepts only Strings in structured metadata, and rejected the
    whole push with 400 Bad Request for a number or null, so every entry with a metric was lost,
    and with batch: true so was every other entry in its batch. The appender reported each
    rejection to the internal logger. The metric_value and the duration are written as LogQL reads
    numbers, to compare or unwrap them: an Integer as it is, and any other number as a decimal, such
    as "1.5". A Rational duration was written as 5/2, which made every query that unwrapped it
    fail. The exception_name of an exception whose class is anonymous, and the exception_message
    of one whose #message returns nil, which were null too, are now Strings: the name as the text
    formatters write it, such as #<Class:0x000...>, and an empty message.
  • The :loki formatter writes a payload key named like one of its own structured metadata fields,
    metric, metric_value, dimensions, duration, duration_human, exception_name,
    exception_message, or stack_trace, with a payload_ prefix, as in payload_duration, as
    :logfmt and :open_telemetry prefix theirs with payload.. It wrote the payload's value and its
    own under the same name, and Loki keeps only the last, so the payload's value was lost. A payload
    key that Loki stores under one of those names, such as metric.value, metric__value, or one
    with an invisible character, replaced the formatter's value instead, so that a query that
    unwraps metric_value failed. The key is prefixed whether or not the entry has that field, so
    that each of these names always holds the formatter's value. It is written under the name Loki
    stores it as, such as payload_metric_value for metric.value, and with the prefix again when
    another payload key has that name once Loki has stored it, as in payload_payload_metric_value,
    so that Loki keeps the value of each prefixed key. A key that is exactly one of these names gets
    the name with one prefix, whatever the order of the keys. See
    Upgrading to v5.3
    and Grafana Loki.
  • The :loki formatter no longer loses an entry, with every other entry pushed with it, for a named
    tag or context key that Loki does not accept as a label name, such as request-id, 1st, or an
    empty key, or for a payload key without an ASCII letter or digit, such as an empty key, -, or
    the _ that jQuery adds to the parameters of a request it keeps from being cached. Loki rejected
    the push with 400 Bad Request ("couldn't parse labels") or 500 ("label name is empty"). Such a
    label name is now written as Loki writes the names of structured metadata: each run of characters
    other than ASCII letters and digits replaced with one _, and key_ before a name that would
    start with a digit, or is empty. So request-id is written as request_id, and 1st as
    key_1st. When another label already has that name with another value, as Loki stores it, a
    number is added, as in request_id_2, so that both are kept. Such a payload key is written with
    the payload_ prefix, as Loki stores it, so an empty key as payload_, and with the prefix again
    when another key has that name, so that Loki keeps the value of each. A named tag that is nil, and a nil host, are left out,
    instead of being written as the label null.
  • The :loki formatter keeps both values of a named tag or context key that has the name of another
    label. Loki keeps one value of a label, so a named tag such as host, level, or pid replaced
    the formatter's own label, and an :info entry tagged level: "warn" was stored as level="warn".
    A context key replaced a named tag of the same name, and so did a named tag given both as a Symbol
    and as a String. Now the formatter's own labels, the named tags, and the context are written under
    their own names, in that order, then each one whose name Loki does not accept under the name that
    replaces it, when no label has that name yet, and then each of the rest, with the first number
    added that no other label has, as in host_2, so that the number is never another label's name,
    whatever the order of the keys. It is written once when the label of that name, or of a numbered
    name before it, has the same value, as Loki stores it. The stream's label names are now Strings,
    so a subclass of the formatter that reads, replaces, or deletes a label in stream[:stream] uses a
    String key, such as "host". A label that a subclass writes under a Symbol, as v5.2 did, is
    written under its name as a String, numbered when a label written before it has that name. See
    Upgrading to v5.3
    and Grafana Loki.
  • The :loki formatter no longer loses an entry, with every other entry pushed with it, for a stream
    with more than 15 labels, such as an entry with ten named tags, a label name longer than 1024
    bytes, or a label value longer than 2048 bytes, such as many tags. Loki rejected the push with
    400 Bad Request. Such a label is now written to the structured metadata instead, as a String,
    where a query can still filter on it: the labels after the 15th in the order the formatter writes
    them (its own, then the named tags and the context under their own names, then those whose names
    were taken or replaced), and any label with a longer name or value.
    The new formatter options max_label_names_per_series, max_label_name_length, and
    max_label_value_length set these limits for a Loki that raises them, as in
    formatter: {loki: {max_label_names_per_series: 30}}. See
    Loki's label limits.
  • The :open_telemetry appender, and an appender added with logger:, work with async: true.
    Before, the worker thread stopped as it started, with NoMethodError (undefined method 'trace'),
    so the appender wrote nothing, and unless it was added with non_blocking: true, every log call
    blocked once its queue was full. With a logger: that has a trace method, the worker thread
    wrote its own messages to that logger instead. Their #logger returned the logger they write to,
    rather than the internal logger that every appender reports its own problems to, which the worker
    thread uses; it now returns the internal logger (see Changed). The :open_telemetry appender also
    reports a failure to flush or shut down to its internal logger, as the other appenders do, rather
    than to SemanticLogger::Processor.logger, so that the report names the appender. The worker
    thread of any appender run with async: true or in batches now also keeps running when the
    appender's internal logger cannot take the thread's own messages, such as a Ruby Logger returned
    by a custom appender's own #logger, which has no trace method and takes no exception. Such a
    logger now gets each of those reports that it can take, with the exception, if there is one, added
    to the message. Before, it got none of the reports with an exception, such as a discarded message,
    a restart, or the thread stopping. See the
    v5.3 upgrade notes.
  • SemanticLogger.reopen(force: true) in a process that has not forked, such as after a log
    rotation, no longer loses track of the thread that writes the log entries, or of the thread of
    an appender added with async: true or in batches. Before, the thread it replaced, as it ended,
    cleared the new one, so that SemanticLogger.flush returned false without waiting for the
    queued entries, and entries still queued at exit could be lost.
  • The :kafka appender keeps its required_acks: after it is flushed, such as with
    SemanticLogger.flush. Before, a flush replaced the appender's producer with one built without
    it, so ruby-kafka's default of :all, which waits for every in-sync replica to acknowledge each
    delivery, replaced the appender's default of 1, or the value given.
  • The LoadError raised when the :kafka appender is added without the ruby-kafka gem names
    Kafka. It said that the gem is required for logging to Elasticsearch.
  • Reopening the :kafka appender in the same process, such as with
    SemanticLogger.reopen(force: true), no longer leaves the producer it replaces running, with its
    two threads, and its connections open. The next time the appender logs, it starts a thread that
    shuts that producer down, which delivers the entries it still holds, and closes its client.
    Flushing or closing the appender waits for that thread, or shuts the producer down itself.
    Neither reopening nor logging waits for the delivery, so that reopening still works in a signal
    trap, where ruby-kafka cannot shut down a producer, and the thread that writes to every appender
    does not stop while Kafka cannot be reached. Since the new producer delivers meanwhile, the
    entries of the one it replaced can reach Kafka after newer ones. An error shutting that producer
    down is reported to the internal logger, rather than raised. After a fork, the child still leaves
    the producer and client it inherited alone, since shutting them down there would send the
    parent's undelivered entries a second time, over the parent's own connections. When the appender
    cannot build a new producer, such as after setting a negative delivery_threshold, flushing it
    now keeps the producer it has, which still delivers, rather than the one it had just shut down,
    and reopening it in the same process keeps both its client and producer. In a forked child it
    then has none, and logging to it raises IOError until a reopen builds one. Flushing the appender
    after closing it no longer raises NoMethodError, and logging to it raises IOError instead.
  • The :udp appender sends to an IPv6 address written in brackets, as a URL writes it, such as
    server: "[::1]:8088". Before, it split the server at every colon, and its socket was IPv4 only,
    so it could not be given an IPv6 address. A host name with an IPv4 address still uses it. A
    server: that is not "host:port", such as one without a port, or an IPv6 address without
    brackets, now raises ArgumentError, which names the form to use, as the appender is added.
    Before, a missing port was taken as port 0.
  • When the :udp appender is reopened, such as after a fork, and cannot connect to its server, such
    as for a host name that no longer resolves, it keeps the socket it had, which still sends to the
    address it connected to. It raises the error as before, which SemanticLogger.reopen reports to
    the internal logger. Before, it closed that socket first, and kept a new one that was not
    connected, so every entry after it failed with Errno::EDESTADDRREQ until the next reopen.
  • The :udp appender sends to a host name that has only IPv6 addresses, over IPv6. Before, its
    socket was IPv4 only, so adding it raised SocketError, since the name has no IPv4 address. A
    name with both is still sent to over IPv4, whichever address the resolver returns first, unless
    it cannot connect over IPv4, such as on a host with no IPv4 route, when it now uses IPv6 instead
    of raising. It looks up a name's IPv6 addresses only when the resolver answers that the name has
    no IPv4 address, or when it cannot connect to any of them, so that a resolver that does not answer
    for them does not delay it otherwise. When looking up the IPv4 addresses fails for another reason,
    such as a resolver that does not answer in time, it raises that SocketError at once, as before,
    rather than sending over IPv6 to a name that may have IPv4 addresses. On Ruby 3.2 and JRuby, whose
    SocketError does not say why a lookup failed, it looks up the IPv6 addresses after any failure.
    When it cannot connect to any address, it raises the error from the first one it tried, an IPv4
    address when the name has one. A name that does not resolve raises SocketError as before.
  • log_exception: :partial, the default for measure_* blocks, no longer raises
    Encoding::CompatibilityError when the log message and the exception's message are in
    incompatible encodings, such as a UTF-8 message with accented letters and a binary exception message
    that holds bytes outside ASCII. Before, the log call raised, and a measure_* block raised that
    error in place of its own exception. Now, when joining the message, the exception's class name, and
    its message would raise, or would make an ASCII message binary, they are converted to valid UTF-8
    first: binary text is read as the UTF-8 it usually holds, and invalid bytes are dropped. Text in
    another encoding, such as ISO-8859-1, otherwise stays in it.
  • A log call no longer raises Encoding::CompatibilityError when the String that a block returns is
    in an encoding incompatible with the message, such as logger.info("Café") { response.body }
    with a binary body that holds bytes outside ASCII, or when the second argument is such a String,
    as in logger.info("Café", response.body). Before, the error was raised into the application.
    Now they are joined the way log_exception: :partial joins the message and the exception's
    message. So a binary String added to an ASCII message is now read as UTF-8 too, and the message
    stays UTF-8, without the String's bytes that are not valid UTF-8, rather than becoming binary.
  • :default, :color, and :pattern without escape_control_chars, and :syslog with
    escape_control_chars: false, no longer lose an entry whose texts are in incompatible encodings,
    such as a UTF-8 message logged with an exception whose message is binary and holds bytes outside
    ASCII, a binary message after a logger name with accented letters, the text of tags or named tags
    in different encodings, or the binary message of an exception that caused the logged one. A UTF-16
    message no longer loses the entry either, and neither does such a cause in the stack trace that
    :loki and :open_telemetry write. Before, formatting raised Encoding::CompatibilityError, and
    the appender reported the error to the internal logger instead of writing the entry. Now a String
    that holds bytes outside ASCII in an encoding other than UTF-8 is converted to UTF-8 before it is
    written, as :one_line, :syslog with its default escaping, and escape_control_chars: true
    already do: binary text is read as the UTF-8 it usually holds, and its invalid bytes are dropped,
    and text in another encoding, such as ISO-8859-1, is converted. So these formatters now always
    write UTF-8, also for an entry whose text is all in one other encoding, which they used to write
    in that encoding. A :pattern or time_format in another encoding is converted to UTF-8 when the
    formatter is built, and the host, application, and environment names that :pattern writes are
    converted too, such as an application name read from the environment where no locale is set.
    See Upgrading to v5.3.
  • :one_line now also removes the Unicode next line (U+0085), line separator (U+2028), and
    paragraph separator (U+2029) from every text field, or escapes them as \u0085, \u2028, and
    \u2029 with escape_control_chars: true. Editors, browsers, and some log viewers start a new
    line at each, so logged text that held one, such as a user's input, could show an entry over
    two lines. Exception details are also split into lines at them, and joined with a space.
  • With json 2.8.0 through 3.0.x, logging a binary String that holds UTF-8, such as a response body,
    in a payload, tag, named tag, or exception message no longer prints "warning: JSON.generate:
    UTF-8 string passed as BINARY, this will raise an encoding error in json 3.0" to standard error,
    once for each such String every time a JSON based formatter or :logfmt writes the entry,
    including in the appenders that use them, and :graylog. The JSON is unchanged: the String is
    written as UTF-8, as it is with json 3.1. On those json versions Semantic Logger prepends a
    module to Ruby's Warning that drops that one warning when it comes from serializing log data;
    the application's own JSON, including an exception's own #message, still warns. :graylog now
    hands the gelf gem a copy with such Strings converted to UTF-8, since the gem serializes it
    itself, and so does :sentry_ruby.
  • A measure_* block that raises an exception whose #message raises, such as one that reads a
    record that is nil, now re-raises its own exception. Before, with log_exception: :partial (the
    default), the error that #message raised replaced it, without it as the cause, and nothing was
    logged; a log call with log_exception: :partial raised that error too. Now :partial writes the
    message the exception was raised with instead, or its class name when it was raised without one,
    as in Saving -- Exception: OrderError: OrderError, and does the same for each exception that
    caused it.
  • The JSON based formatters (:json, :raw, :fluentd, :ecs, :loki, ...), :logfmt,
    :one_line, :open_telemetry, :syslog, the other text formatters with
    escape_control_chars: true, and :cloudwatch_logs no longer drop the characters of a binary
    String that holds UTF-8, such as a response body, Base64-decoded text, or a C extension's error
    message, or of a US-ASCII String that holds UTF-8, such as a file read or an environment variable

[!IMPORTANT]
✂ PR body was truncated to here.


Configuration

📅 Schedule: (UTC)

  • Branch creation
    • At any time (no schedule defined)
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate Bot added the dependencies This updates dependency files label Nov 28, 2026
@github-actions

Copy link
Copy Markdown

GitLab Pipeline Action

General information

Link to pipeline: https://gitlab.com/code0-tech/development/reticulum/-/pipelines/3125504661

Status: Passed
Duration: 11 minutes

Job summaries

docs:preview

Documentation preview available at https://code0-tech.gitlab.io/-/development/telescopium/-/jobs/18445117844/artifacts/out/index.html

generate-environment

RETICULUM_CONTAINER_VERSION=0.0.0-experimental-3125504661-df0b597624fcc3a66fa227abd4e83b3ca88c6347

@Taucher2003
Taucher2003 merged commit f97b003 into main Nov 28, 2026
3 checks passed
@Taucher2003
Taucher2003 deleted the renovate/semantic_logger-5.x-lockfile branch November 28, 2026 01:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies This updates dependency files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant