Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: logflare ex telemetry reporter #1860

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,32 @@ config :logflare_logger_backend,
api_key: System.get_env("LOGFLARE_LOGGER_BACKEND_API_KEY")
)

config :warehouse_ex,
filter_nil_kv_pairs.(
api_url: System.get_env("LOGFLARE_LOGGER_BACKEND_URL"),
api_key: System.get_env("LOGFLARE_LOGGER_BACKEND_API_KEY")
)

config :warehouse_ex,
WarehouseEx.LoggerBackend,
filter_nil_kv_pairs.(source_token: System.get_env("LOGFLARE_LOGGER_BACKEND_SOURCE_ID"))

config :warehouse_ex,
WarehouseEx.TelemetryReporter,
filter_nil_kv_pairs.(
source_token: System.get_env("LOGFLARE_TELEMETRY_REPORTER_SOURCE_TOKEN"),
)

config :logger,
backends:
[
:console,
# if(System.get_env("LOGFLARE_LOGGER_BACKEND_URL") != nil,
# do: LogflareLogger.HttpBackend,
# else: nil
# ),
if(System.get_env("LOGFLARE_LOGGER_BACKEND_URL") != nil,
do: LogflareLogger.HttpBackend,
do: WarehouseEx.LoggerBackend,
else: nil
),
if(System.get_env("LOGFLARE_LOGGER_JSON") == "true", do: LoggerJSON, else: nil)
Expand Down
5 changes: 4 additions & 1 deletion lib/logflare/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,10 @@ defmodule Logflare.Application do
{Task, fn -> startup_tasks() end},

# citrine scheduler for alerts
Logflare.AlertsScheduler
Logflare.AlertsScheduler,

# telemetry reporter
{WarehouseEx.TelemetryReporter, metrics: Logflare.Telemetry.metrics()}
]
end

Expand Down
8 changes: 5 additions & 3 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"test.only": :test,
"test.format": :test,
"test.compile": :test,
"test.security": :test,

Check warning on line 20 in mix.exs

View workflow job for this annotation

GitHub Actions / Checks (Code Quality - Linting, mix lint --only warnings)

~R/.../ is deprecated, use ~r/.../ instead

Check warning on line 20 in mix.exs

View workflow job for this annotation

GitHub Actions / Checks (Code Quality - Formatting, mix test.format)

~R/.../ is deprecated, use ~r/.../ instead

Check warning on line 20 in mix.exs

View workflow job for this annotation

GitHub Actions / Checks (Compilation Warnings, mix test.compile)

~R/.../ is deprecated, use ~r/.../ instead

Check warning on line 20 in mix.exs

View workflow job for this annotation

GitHub Actions / Checks (Tests, mix do ecto.create, ecto.migrate, test)

~R/.../ is deprecated, use ~r/.../ instead
"test.typings": :test,
coveralls: :test,
"coveralls.detail": :test,
Expand Down Expand Up @@ -155,11 +155,11 @@
# Ecto
{:ecto, "~> 3.9", override: true},
{:ecto_sql, "~> 3.9"},
{:typed_ecto_schema, "~> 0.1.0", runtime: false},
{:typed_ecto_schema, "~> 0.4.0", runtime: false},

# Telemetry & logging
{:telemetry, "~> 1.0"},
{:telemetry_metrics, "~> 1.0"},
{:telemetry_metrics, "~> 1.0", override: true},
{:telemetry_poller, "~> 1.1"},
{:logflare_logger_backend, "~> 0.11.4"},
{:logger_json, "~> 5.1"},
Expand Down Expand Up @@ -225,7 +225,9 @@
{:opentelemetry_api, "~> 1.2"},
{:opentelemetry_exporter, "~> 1.6"},
{:opentelemetry_phoenix, "~> 1.1"},
{:opentelemetry_cowboy, "~> 0.2"}
{:opentelemetry_cowboy, "~> 0.2"},

{:logflare_ex, "~> 0.2.0-dev.082a725d"}
]
end

Expand Down
3 changes: 2 additions & 1 deletion mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
"local_cluster": {:hex, :local_cluster, "1.2.1", "8eab3b8a387680f0872eacfb1a8bd5a91cb1d4d61256eec6a655b07ac7030c73", [:mix], [{:global_flags, "~> 1.0", [hex: :global_flags, repo: "hexpm", optional: false]}], "hexpm", "aae80c9bc92c911cb0be085fdeea2a9f5b88f81b6bec2ff1fec244bb0acc232c"},
"logflare_api_client": {:hex, :logflare_api_client, "0.3.5", "c427ebf65a8402d68b056d4a5ef3e1eb3b90c0ad1d0de97d1fe23807e0c1b113", [:mix], [{:bertex, "~> 1.3", [hex: :bertex, repo: "hexpm", optional: false]}, {:finch, "~> 0.10", [hex: :finch, repo: "hexpm", optional: false]}, {:jason, ">= 1.0.0", [hex: :jason, repo: "hexpm", optional: false]}, {:tesla, "~> 1.0", [hex: :tesla, repo: "hexpm", optional: false]}], "hexpm", "16d29abcb80c4f72745cdf943379da02a201504813c3aa12b4d4acb0302b7723"},
"logflare_etso": {:hex, :logflare_etso, "1.1.2", "040bd3e482aaf0ed20080743b7562242ec5079fd88a6f9c8ce5d8298818292e9", [:mix], [{:ecto, "~> 3.8", [hex: :ecto, repo: "hexpm", optional: false]}], "hexpm", "ab96be42900730a49b132891f43a9be1d52e4ad3ee9ed9cb92565c5f87345117"},
"logflare_ex": {:hex, :logflare_ex, "0.2.0-dev.082a725d", "89f2bd85466dcb723d74f5ee800db32d5de059a32cfd8844d09b4637988809b5", [:mix], [{:bertex, "~> 1.3", [hex: :bertex, repo: "hexpm", optional: false]}, {:finch, "~> 0.10", [hex: :finch, repo: "hexpm", optional: false]}, {:jason, ">= 1.0.0", [hex: :jason, repo: "hexpm", optional: false]}, {:logflare_etso, "~> 1.1.2", [hex: :logflare_etso, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: true]}, {:telemetry_metrics, "~> 0.6.1", [hex: :telemetry_metrics, repo: "hexpm", optional: true]}, {:tesla, "~> 1.0", [hex: :tesla, repo: "hexpm", optional: false]}, {:typed_ecto_schema, "~> 0.4.1", [hex: :typed_ecto_schema, repo: "hexpm", optional: false]}, {:typed_struct, "~> 0.3.0", [hex: :typed_struct, repo: "hexpm", optional: false]}], "hexpm", "fd461592ba4ae701adabd30582a970aeb24e62abbd7ad09690b6f4ef38cd7828"},
"logflare_logger_backend": {:hex, :logflare_logger_backend, "0.11.4", "3a5df94e764b7c8ee4bd7b875a480a34a27807128d8459aa59ea63b2b38bddc7", [:mix], [{:bertex, "~> 1.3", [hex: :bertex, repo: "hexpm", optional: false]}, {:logflare_api_client, "~> 0.3.5", [hex: :logflare_api_client, repo: "hexpm", optional: false]}, {:logflare_etso, "~> 1.1.2", [hex: :logflare_etso, repo: "hexpm", optional: false]}, {:typed_struct, "~> 0.3.0", [hex: :typed_struct, repo: "hexpm", optional: false]}], "hexpm", "00998d81b3c481ad93d2bf25e66d1ddb1a01ad77d994e2c1a7638c6da94755c5"},
"logger_json": {:hex, :logger_json, "5.1.2", "7dde5f6dff814aba033f045a3af9408f5459bac72357dc533276b47045371ecf", [:mix], [{:ecto, "~> 2.1 or ~> 3.0", [hex: :ecto, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:phoenix, ">= 1.5.0", [hex: :phoenix, repo: "hexpm", optional: true]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: true]}], "hexpm", "ed42047e5c57a60d0fa1450aef36bc016d0f9a5e6c0807ebb0c03d8895fb6ebc"},
"lqueue": {:hex, :lqueue, "1.2.0", "9cde07d8595a012e61fce9c5b751cb464aff030b0944f915086994b017e694f4", [:mix], [], "hexpm", "cdb983cfc609dff425ae237b722e101f85c763ef1f2bbe363e1f1385f370285d"},
Expand Down Expand Up @@ -151,7 +152,7 @@
"timex": {:hex, :timex, "3.7.11", "bb95cb4eb1d06e27346325de506bcc6c30f9c6dea40d1ebe390b262fad1862d1", [:mix], [{:combine, "~> 0.10", [hex: :combine, repo: "hexpm", optional: false]}, {:gettext, "~> 0.20", [hex: :gettext, repo: "hexpm", optional: false]}, {:tzdata, "~> 1.1", [hex: :tzdata, repo: "hexpm", optional: false]}], "hexpm", "8b9024f7efbabaf9bd7aa04f65cf8dcd7c9818ca5737677c7b76acbc6a94d1aa"},
"tls_certificate_check": {:hex, :tls_certificate_check, "1.22.1", "0f450cc1568a67a65ce5e15df53c53f9a098c3da081c5f126199a72505858dc1", [:rebar3], [{:ssl_verify_fun, "~> 1.1", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm", "3092be0babdc0e14c2e900542351e066c0fa5a9cf4b3597559ad1e67f07938c0"},
"toml": {:hex, :toml, "0.7.0", "fbcd773caa937d0c7a02c301a1feea25612720ac3fa1ccb8bfd9d30d822911de", [:mix], [], "hexpm", "0690246a2478c1defd100b0c9b89b4ea280a22be9a7b313a8a058a2408a2fa70"},
"typed_ecto_schema": {:hex, :typed_ecto_schema, "0.1.1", "220b56d96c3899e6f313b37793bafec09c44a5dd4cd17b4dbd5703ecb75137cc", [:mix], [{:ecto, "~> 3.0", [hex: :ecto, repo: "hexpm", optional: false]}], "hexpm", "44152174ecfc1b08b2c39eb8a7781dd77d56ea326ffa61782339fa0082fa6a51"},
"typed_ecto_schema": {:hex, :typed_ecto_schema, "0.4.1", "a373ca6f693f4de84cde474a67467a9cb9051a8a7f3f615f1e23dc74b75237fa", [:mix], [{:ecto, "~> 3.5", [hex: :ecto, repo: "hexpm", optional: false]}], "hexpm", "85c6962f79d35bf543dd5659c6adc340fd2480cacc6f25d2cc2933ea6e8fcb3b"},
"typed_struct": {:hex, :typed_struct, "0.3.0", "939789e3c1dca39d7170c87f729127469d1315dcf99fee8e152bb774b17e7ff7", [:mix], [], "hexpm", "c50bd5c3a61fe4e198a8504f939be3d3c85903b382bde4865579bc23111d1b6d"},
"tzdata": {:hex, :tzdata, "1.1.1", "20c8043476dfda8504952d00adac41c6eda23912278add38edc140ae0c5bcc46", [:mix], [{:hackney, "~> 1.17", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "a69cec8352eafcd2e198dea28a34113b60fdc6cb57eb5ad65c10292a6ba89787"},
"ueberauth": {:hex, :ueberauth, "0.6.3", "d42ace28b870e8072cf30e32e385579c57b9cc96ec74fa1f30f30da9c14f3cc0", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "afc293d8a1140d6591b53e3eaf415ca92842cb1d32fad3c450c6f045f7f91b60"},
Expand Down
Loading