Skip to content

Commit ddcdf64

Browse files
committed
chore: rename to WarehouseEx
1 parent 675d2fa commit ddcdf64

27 files changed

+161
-183
lines changed

.github/workflows/ex-publish.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
if: github.event_name == 'push'
3838
env:
3939
HEX_API_KEY: ${{ secrets.HEX_AUTH_TOKEN }}
40-
LOGFLARE_EX_PRERELEASE_VERSION: dev.${{env.timestamp}}.${{ env.short_sha }}
40+
WAREHOUSE_EX_PRERELEASE_VERSION: dev.${{env.timestamp}}.${{ env.short_sha }}
4141
- run: mix hex.publish --yes
4242
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
4343
env:

ex/.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ erl_crash.dump
2020
*.ez
2121

2222
# Ignore package tarball (built via "mix hex.build").
23-
logflare_ex-*.tar
23+
warehouse_ex-*.tar
2424

2525
# Temporary files, for example, from tests.
2626
/tmp/

ex/README.md

+2-24
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,15 @@
1-
# LogflareEx
2-
3-
**TODO: Add description**
1+
# WarehouseEx
42

53
## Installation
64

7-
If [available in Hex](https://hex.pm/docs/publish), the package can be installed
8-
by adding `logflare_ex` to your list of dependencies in `mix.exs`:
9-
105
```elixir
116
def deps do
127
[
13-
{:logflare_ex, "~> 0.1.0"}
8+
{:warehouse_ex, "~> 0.2.0"}
149
]
1510
end
1611
```
1712

18-
And add in to `application.ex`:
19-
```elixir
20-
def start(_type, _args) do
21-
children = [
22-
{Finch, name: LogflareEx.Finch}
23-
]
24-
25-
opts = [strategy: :one_for_one, name: LogflareApiClient.Supervisor]
26-
Supervisor.start_link(children, opts)
27-
end
28-
end
29-
```
30-
3113
## Benchmarks
3214

3315
### Jason vs Bertex
@@ -63,7 +45,3 @@ jason encode large 57.26 - 10.73x slower +15.84 ms
6345
jason decode large 47.24 - 13.01x slower +19.54 ms
6446
```
6547

66-
Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)
67-
and published on [HexDocs](https://hexdocs.pm). Once published, the docs can
68-
be found at [https://hexdocs.pm/logflare_ex](https://hexdocs.pm/logflare_ex).
69-

ex/config/config.exs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import Config
1717
# metadata: [:user_id]
1818
#
1919

20-
config :logflare_ex,
20+
config :warehouse_ex,
2121
api_url: "https://api.logflare.app",
2222
api_key: "some-key"
2323

ex/config/dev.exs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Config
22

3-
config :logflare_ex,
3+
config :warehouse_ex,
44
api_url: "https://api.logflare.app",
55
api_key: "some-key",
66
env: :test

ex/config/test.exs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Config
22

3-
config :logflare_ex,
3+
config :warehouse_ex,
44
env: :test,
55
api_url: "https://localhost:4006"

ex/lib/application.ex

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
1-
defmodule LogflareEx.Application do
1+
defmodule WarehouseEx.Application do
22
@moduledoc false
33
use Application
44

55
@impl true
66
def start(_type, _args) do
7-
env = Application.get_env(:logflare_ex, :env)
7+
env = Application.get_env(:warehouse_ex, :env)
88

99
children = get_children(env)
1010

1111
# See https://hexdocs.pm/elixir/Supervisor.html
1212
# for other strategies and supported options
13-
opts = [strategy: :one_for_one, name: LogflareEx.Supervisor]
13+
opts = [strategy: :one_for_one, name: WarehouseEx.Supervisor]
1414
Supervisor.start_link(children, opts)
1515
end
1616

1717
defp get_children(:test) do
1818
[
19-
LogflareEx.Repo,
20-
{Registry, keys: :unique, name: LogflareEx.BatcherRegistry},
21-
{Finch, name: LogflareEx.Finch}
19+
WarehouseEx.Repo,
20+
{Registry, keys: :unique, name: WarehouseEx.BatcherRegistry},
21+
{Finch, name: WarehouseEx.Finch}
2222
]
2323
end
2424

2525
defp get_children(_) do
2626
[
27-
LogflareEx.Repo,
28-
{DynamicSupervisor, name: LogflareEx.BatcherSup},
29-
{Registry, keys: :unique, name: LogflareEx.BatcherRegistry},
30-
{Finch, name: LogflareEx.Finch}
27+
WarehouseEx.Repo,
28+
{DynamicSupervisor, name: WarehouseEx.BatcherSup},
29+
{Registry, keys: :unique, name: WarehouseEx.BatcherRegistry},
30+
{Finch, name: WarehouseEx.Finch}
3131
]
3232
end
3333
end

ex/lib/batched_event.ex

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
defmodule LogflareEx.BatchedEvent do
1+
defmodule WarehouseEx.BatchedEvent do
22
@moduledoc false
33
use TypedEctoSchema
44

ex/lib/batcher.ex

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
defmodule LogflareEx.Batcher do
1+
defmodule WarehouseEx.Batcher do
22
@moduledoc """
3-
Batching cache is an Etso repo, `LogflareEx.Repo`, and stores all events to be sent to the Logflare service.
3+
Batching cache is an Etso repo, `WarehouseEx.Repo`, and stores all events to be sent to the Logflare service.
44
55
There are 2 states that an event can be in:
66
- pending
@@ -11,10 +11,10 @@ defmodule LogflareEx.Batcher do
1111
use GenServer
1212

1313
import Ecto.Query
14-
alias LogflareEx.BatchedEvent
15-
alias LogflareEx.BatcherRegistry
16-
alias LogflareEx.Client
17-
alias LogflareEx.Repo
14+
alias WarehouseEx.BatchedEvent
15+
alias WarehouseEx.BatcherRegistry
16+
alias WarehouseEx.Client
17+
alias WarehouseEx.Repo
1818

1919
# API
2020

@@ -142,14 +142,14 @@ defmodule LogflareEx.Batcher do
142142
end
143143

144144
@doc """
145-
Returns the via for each partitioned Batcher. Accepts a `source_token` or `source_name` filter or a `%LogflareEx.Client{}` struct.
145+
Returns the via for each partitioned Batcher. Accepts a `source_token` or `source_name` filter or a `%WarehouseEx.Client{}` struct.
146146
147147
### Example
148148
149149
```elixir
150150
via(source_name: "my source")
151151
via(source_token: "some-uuid")
152-
via(%LogflareEx.Client{...})
152+
via(%WarehouseEx.Client{...})
153153
```
154154
"""
155155
@spec via(Client.t() | kw_filter()) :: identifier()
@@ -222,7 +222,7 @@ defmodule LogflareEx.Batcher do
222222

223223
# Task to send batch
224224
Task.start_link(fn ->
225-
LogflareEx.send_events(state.client, batch)
225+
WarehouseEx.send_events(state.client, batch)
226226
Repo.delete_all(from(e in BatchedEvent, where: e.id in ^event_ids))
227227
end)
228228

ex/lib/batcher_sup.ex

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
defmodule LogflareEx.BatcherSup do
1+
defmodule WarehouseEx.BatcherSup do
22
# Automatically defines child_spec/1
33
use DynamicSupervisor
4-
alias LogflareEx.Batcher
5-
alias LogflareEx.Client
4+
alias WarehouseEx.Batcher
5+
alias WarehouseEx.Client
66
require Logger
77

88
def start_link(_init_arg) do

ex/lib/logflare_ex.ex

+17-17
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
defmodule LogflareEx do
2-
alias LogflareEx.Client
3-
alias LogflareEx.Batcher
4-
alias LogflareEx.BatchedEvent
5-
alias LogflareEx.Repo
6-
alias LogflareEx.BatcherSup
1+
defmodule WarehouseEx do
2+
alias WarehouseEx.Client
3+
alias WarehouseEx.Batcher
4+
alias WarehouseEx.BatchedEvent
5+
alias WarehouseEx.Repo
6+
alias WarehouseEx.BatcherSup
77

88
@moduledoc """
9-
Documentation for `LogflareEx`.
9+
Documentation for `WarehouseEx`.
1010
"""
1111

1212
@doc """
1313
Creates a client for interacting with Logflare.
1414
15-
See `LogflareEx.Client`.
15+
See `WarehouseEx.Client`.
1616
"""
1717

1818
defdelegate client(opts), to: __MODULE__.Client, as: :new
@@ -37,19 +37,19 @@ defmodule LogflareEx do
3737
### Example
3838
3939
```elixir
40-
iex> client = LogflareEx.client()
41-
%LogflareEx.Client{...}
40+
iex> client = WarehouseEx.client()
41+
%WarehouseEx.Client{...}
4242
4343
# singular event
44-
iex> LogflareEx.send_event(client, %{my: "event"})
44+
iex> WarehouseEx.send_event(client, %{my: "event"})
4545
{:ok, %{"message"=> "Logged!}}
4646
4747
# multiple events
48-
iex> LogflareEx.send_events(client, [%{my: "event"}, ...])
48+
iex> WarehouseEx.send_events(client, [%{my: "event"}, ...])
4949
{:ok, %{"message"=> "Logged!}}
5050
5151
# a tesla result will be returned on error
52-
iex> client |> LogflareEx.send_event(%{my: "event"})
52+
iex> client |> WarehouseEx.send_event(%{my: "event"})
5353
{:error, %Tesla.Env{...}}
5454
5555
```
@@ -110,15 +110,15 @@ defmodule LogflareEx do
110110
111111
```elixir
112112
# create a client
113-
iex> client = LogflareEx.client()
114-
%LogflareEx.Client{...}
113+
iex> client = WarehouseEx.client()
114+
%WarehouseEx.Client{...}
115115
116116
# singular event
117-
iex> LogflareEx.send_batched_event(client, %{...})
117+
iex> WarehouseEx.send_batched_event(client, %{...})
118118
:ok
119119
120120
# list of events
121-
iex> LogflareEx.send_batched_event(client, [%{...}, ...])
121+
iex> WarehouseEx.send_batched_event(client, [%{...}, ...])
122122
:ok
123123
```
124124
"""

ex/lib/logflare_ex/client.ex

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
defmodule LogflareEx.Client do
1+
defmodule WarehouseEx.Client do
22
@moduledoc """
3-
A `LogflareEx.Client` contains all configuration used for making API requests, whether batched or not.
3+
A `WarehouseEx.Client` contains all configuration used for making API requests, whether batched or not.
44
55
### Application-level Configuration
66
77
Application-wide configuration can be set in `config.exs`:
88
99
```elixir
10-
config :logflare_ex,
10+
config :warehouse_ex,
1111
api_key: "...",
1212
source_token: "..."
1313
```
1414
1515
### Runtime Configuration
1616
17-
All configuration options can be overridden at runtime. This is through the use of the `LogflareEx.Client` struct.
17+
All configuration options can be overridden at runtime. This is through the use of the `WarehouseEx.Client` struct.
1818
19-
To create a new client with a custom configuration, use `LogflareEx.client/1`:
19+
To create a new client with a custom configuration, use `WarehouseEx.client/1`:
2020
2121
```elixir
2222
# To create a client from the application-level configuration.
23-
iex> default_client = LogflareEx.client()
24-
%LogflareEx.Client{...}
23+
iex> default_client = WarehouseEx.client()
24+
%WarehouseEx.Client{...}
2525
2626
# To create a client with runtime overrides
27-
iex> client = LogflareEx.client(source_token: "...")
28-
%LogflareEx.Client{...}
27+
iex> client = WarehouseEx.client(source_token: "...")
28+
%WarehouseEx.Client{...}
2929
3030
# use the runtime client
31-
iex> LogflareEx.send_batched_event(client, %{...})
31+
iex> WarehouseEx.send_batched_event(client, %{...})
3232
:ok
3333
```
3434
@@ -37,17 +37,17 @@ defmodule LogflareEx.Client do
3737
For every configuration, either `:source_token` or `:source_name` must be provided.
3838
3939
- `:api_key`: **Required**. Public API key.
40-
- `:api_url`: Custom Logflare endpoint, for self-hosting. Defaults to `https//api.logflare.app`.
40+
- `:api_url`: Custom server endpoint, for self-hosting. Defaults to `https//api.logflare.app`.
4141
- `:source_token`: Source UUID. Mutually exclusive with `:source_name`
4242
- `:source_name`: Source name. Mutually exclusive with `:source_token`
4343
- `:on_error`: mfa callback for handling API errors. Must be 1 arity.
4444
- `:on_prepare_payload`: mfa callback or anonymous function for preparing the final payload before sending to API. Must be 1 arity.
45-
- `:auto_flush`: Used for batching. Enables automatic flushing. If disabled, `LogflareEx.flush/1` must be called.
45+
- `:auto_flush`: Used for batching. Enables automatic flushing. If disabled, `WarehouseEx.flush/1` must be called.
4646
- `:flush_interval`: Used for batching. Flushes cached events at the provided interval.
4747
- `:batch_size`: Used for batching. It is the maximum number of events send per API request.
4848
4949
"""
50-
@default_tesla_adapter {Tesla.Adapter.Finch, name: LogflareEx.Finch, receive_timeout: 30_000}
50+
@default_tesla_adapter {Tesla.Adapter.Finch, name: WarehouseEx.Finch, receive_timeout: 30_000}
5151
@default_batch_size 250
5252
@default_flush_interval 1_500
5353

@@ -116,7 +116,7 @@ defmodule LogflareEx.Client do
116116
end
117117

118118
def get_config_value(key) do
119-
Application.get_env(:logflare_ex, key)
119+
Application.get_env(:warehouse_ex, key)
120120
end
121121

122122
def validate_client(%__MODULE__{source_name: nil, source_token: nil}),

0 commit comments

Comments
 (0)