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: source.service_name for setting the service name on backends #2166

Merged
merged 5 commits into from
Aug 7, 2024
Merged
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
4 changes: 3 additions & 1 deletion docs/docs.logflare.com/docs/backends/datadog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@ The following values are required when creating a webhook backend:

Implementation is based on the [webhook backend](/backends/webhook).

Events will be gzipped and batch with a maximum of 250 events per request. The source name will be set as the service name.
The entire event body will be set to the `data` key of the events sent to Datadog.

Events will be gzipped and batch with a maximum of 250 events per request. The service name of the source will be used as the `ddservice`. If not set, it will default to the source name.
7 changes: 4 additions & 3 deletions lib/logflare/backends/adaptor/datadog_adaptor.ex
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,10 @@ defmodule Logflare.Backends.Adaptor.DatadogAdaptor do
%Logflare.LogEvent{
le
| body: %{
message: formatted_ts <> " " <> Jason.encode!(le.body),
ddsource: "Logflare by Supabase",
service: le.source.name
"message" => formatted_ts <> " " <> (le.body["message"] || le.body["event_message"]),
"ddsource" => "Supabase",
"service" => le.source.service_name || le.source.name,
"data" => le.body
}
}
end
Expand Down
4 changes: 4 additions & 0 deletions lib/logflare/sources/source.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ defmodule Logflare.Source do
@derive {Jason.Encoder,
only: [
:name,
:service_name,
:token,
:id,
:favorite,
Expand Down Expand Up @@ -104,6 +105,7 @@ defmodule Logflare.Source do

schema "sources" do
field(:name, :string)
field(:service_name, :string)
field(:token, Ecto.UUID.Atom, autogenerate: true)
field(:public_token, :string)
field(:favorite, :boolean, default: false)
Expand Down Expand Up @@ -159,6 +161,7 @@ defmodule Logflare.Source do
source
|> cast(attrs, [
:name,
:service_name,
:token,
:public_token,
:favorite,
Expand Down Expand Up @@ -186,6 +189,7 @@ defmodule Logflare.Source do
source
|> cast(attrs, [
:name,
:service_name,
:token,
:public_token,
:favorite,
Expand Down
196 changes: 0 additions & 196 deletions lib/logflare_web/templates/source/dashboard.html.eex

This file was deleted.

Loading
Loading