Skip to content

Add some telemetry to Syslog#3344

Draft
ruslandoga wants to merge 1 commit intoLogflare:mainfrom
ruslandoga:rd/syslog-telemetry
Draft

Add some telemetry to Syslog#3344
ruslandoga wants to merge 1 commit intoLogflare:mainfrom
ruslandoga:rd/syslog-telemetry

Conversation

@ruslandoga
Copy link
Copy Markdown
Contributor

@ruslandoga ruslandoga commented Apr 5, 2026

And maybe we could add some metrics as well, but I'm leaving it out of the PR since I am not seeing metrics for any other backends.

syslog_metrics = [
  distribution("logflare.syslog_pool.connect.duration",
    event_name: "logflare.syslog_pool.connect.stop",
    unit: {:native, :millisecond},
    description: "Syslog pool connection latency"
  ),
  counter("logflare.syslog_pool.connect.error",
    event_name: "logflare.syslog_pool.connect.stop",
    keep: &error_kind?/1,
    tags: [:reason],
    tag_values: &low_cardinality_syslog_reason/1,
    description: "Syslog pool initial connection errors during checkout"
  ),
  counter("logflare.syslog_pool.disconnect",
    tags: [:reason],
    tag_values: &low_cardinality_syslog_reason/1,
    description: "Syslog pool disconnections for established connections"
  ),
  counter("logflare.syslog_pool.reused_connection",
    description: "Syslog pool reused connections"
  )
]

defp error_kind?(%{kind: :error}), do: true
defp error_kind?(_metadata), do: false

defp low_cardinality_syslog_reason(%{reason: reason} = metadata) do
  low_cardinality_reason =
    case reason do
      :timeout -> "timeout"
      :closed -> "closed"
      :econnrefused -> "econnrefused"
      :nxdomain -> "nxdomain"
      _ -> "other"
    end

  %{metadata | reason: low_cardinality_reason}
end

@ruslandoga ruslandoga force-pushed the rd/syslog-telemetry branch from fe8ddca to 800c39d Compare April 6, 2026 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant