Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
196c732
Library known as LogHog moves in 😳
martosaur Jul 11, 2025
db121d9
Update mix.exs
martosaur Jul 16, 2025
cc21caa
Mix unlock
martosaur Jul 16, 2025
b05e1c8
Update MIGRATION.md
martosaur Jul 16, 2025
caf96d5
Rename log_hog_test.exs
martosaur Jul 25, 2025
57f3d13
git delete config/integrations.exs
martosaur Aug 20, 2025
bd48499
Implement test infrastructure
martosaur Jul 25, 2025
e229334
Pin LoggerHandlerKit to 0.4.0
martosaur Aug 16, 2025
b6e2b75
Wording
martosaur Aug 16, 2025
11f97df
Merge shared schema earlier
martosaur Aug 16, 2025
b6bccde
Make PostHog.Sender a pool
martosaur Jul 29, 2025
d668b6f
Add a comment
martosaur Aug 16, 2025
a75e48f
Merge pull request #41 from martosaur/am-log-hog-invasion
rafaeelaudibert Aug 21, 2025
88c8a8a
Introduce feature flags higher level functions
martosaur Sep 1, 2025
ed04495
refactor: Use simpler `batch` name
rafaeelaudibert Sep 10, 2025
b88c632
feat: Namespace the new FF code under `PostHog.FeatureFlags`
rafaeelaudibert Sep 10, 2025
708ec6c
fix: Properly use distinct_id and config
rafaeelaudibert Sep 10, 2025
fac3b2a
docs: Explain how to configure local development
rafaeelaudibert Sep 10, 2025
0793ee0
refactor: Move FF tests over to `feature_flags_test.exs`
rafaeelaudibert Sep 10, 2025
8e7434c
Fix type in module name in readme
martosaur Sep 13, 2025
118f23d
Remove unnecessary heredoc and typespec, and function clause
martosaur Sep 13, 2025
a15022f
Format code
martosaur Sep 13, 2025
159d89c
Assign groups to PostHog.FeatureFlags and PostHog tests
martosaur Sep 13, 2025
16a6942
Fix rogue app start-stop log chunks
martosaur Sep 13, 2025
fba026a
Use PostHog types directly
martosaur Sep 13, 2025
74fa53c
Fix FeatureFlags.check!/3 and add tests
martosaur Sep 13, 2025
ad10b3a
Update local development guide
martosaur Sep 13, 2025
020222c
Encode properties on capture
martosaur Sep 14, 2025
50496e6
Add LLM Analytics integrations tests and examples
martosaur Sep 14, 2025
7692a4e
Merge pull request #49 from martosaur/am-properties-encoding
rafaeelaudibert Sep 18, 2025
7793b2d
Merge pull request #47 from martosaur/am-feature-flags
rafaeelaudibert Sep 19, 2025
f081bed
Expose global_properties configuration option
martosaur Sep 22, 2025
864ea43
Move system global properties to module attribute
martosaur Sep 22, 2025
494e665
Add non trivial global properties to the test to make sure they are
martosaur Sep 22, 2025
934a841
Let users export all Logger metadata keys in Error Tracking
martosaur Sep 22, 2025
1661ead
Make Plug integration work for all events, not just errors
martosaur Sep 22, 2025
03e5211
Merge pull request #50 from martosaur/am-global-properties
rafaeelaudibert Sep 25, 2025
72217fd
Merge pull request #52 from martosaur/am-plug-integration-for-all
rafaeelaudibert Sep 25, 2025
0213822
Merge pull request #51 from martosaur/am-all-metadata-support
rafaeelaudibert Sep 25, 2025
475e3db
Add changelog entry and migration guide
martosaur Sep 28, 2025
90a00b4
Use skip_code_autolink instead of skip_undefined_reference_warnings_on
martosaur Sep 28, 2025
040404a
Ensure `file` metadata is converted to binary
martosaur Sep 29, 2025
4d900bc
Merge pull request #55 from martosaur/am-special-treatment-to-file
rafaeelaudibert Sep 30, 2025
7f29b93
feat: Small fixes to markdown docs
rafaeelaudibert Sep 30, 2025
da5d1f6
chore: Stop testing Elixir v1.14
rafaeelaudibert Sep 30, 2025
f6a5086
Merge pull request #54 from martosaur/am-2.0-migration-guide
rafaeelaudibert Sep 30, 2025
db105c9
Merge branch 'master' into v2.0.0-branch
rafaeelaudibert Sep 30, 2025
6cd3287
refactor: Use standard `api_host`
rafaeelaudibert Sep 30, 2025
625591b
Merge pull request #57 from PostHog/move-to-api-host
rafaeelaudibert Sep 30, 2025
5b70472
fix: Include dev.exs
rafaeelaudibert Sep 30, 2025
79d8ccb
fix: Backport Logger.levels/0 for Elixir 1.15.0 compatibility
rafaeelaudibert Sep 30, 2025
3338208
fix: Use `timer`
rafaeelaudibert Sep 30, 2025
cbc5517
fix: Avoid using JSON methods in tests
rafaeelaudibert Sep 30, 2025
2fdb319
fix: Adding missing 2nd parameter
rafaeelaudibert Sep 30, 2025
bebec6d
test: Remove unused var
rafaeelaudibert Sep 30, 2025
c72b95a
Revert "test: Remove unused var"
martosaur Oct 1, 2025
f6c31fc
Revert "fix: Adding missing 2nd parameter"
martosaur Oct 1, 2025
f76893e
Revert "fix: Avoid using JSON methods in tests"
martosaur Oct 1, 2025
243eac6
Revert "fix: Backport Logger.levels/0 for Elixir 1.15.0 compatibility"
martosaur Oct 1, 2025
8f65d95
Set required Elixir version to 1.17
martosaur Oct 1, 2025
d176234
Update CI to only run against supported versions
martosaur Oct 1, 2025
8a6916d
Update changelog
martosaur Oct 1, 2025
c60a330
Make dev.exs tweakable
martosaur Oct 1, 2025
ce5fd06
Merge pull request #58 from martosaur/am-pin-elixir-version
rafaeelaudibert Oct 1, 2025
c05d563
Fix flaky 1.17 test
martosaur Oct 1, 2025
7dade5e
Fix Credo.Check.Readability.ModuleDoc check
martosaur Oct 1, 2025
a4832bf
Regenerate credo config and disable MissedMetadataKeyInLoggerConfig
martosaur Oct 1, 2025
581f46e
Ignore check for apply(Plug.Conn, ...)
martosaur Oct 1, 2025
2ec6fa7
Sort aliases
martosaur Oct 1, 2025
ae761e6
Make Credo.Check.Design.AliasUsage check less sensitive
martosaur Oct 1, 2025
04775a9
Fix Credo.Check.Readability.StringSigils check
martosaur Oct 1, 2025
a664259
Disable Credo.Check.Readability.ParenthesesOnZeroArityDefs
martosaur Oct 1, 2025
6ca2421
Merge pull request #59 from martosaur/am-fix-dev-exs
rafaeelaudibert Oct 1, 2025
9744ad2
Merge pull request #60 from martosaur/am-flaky-1.17-test
rafaeelaudibert Oct 1, 2025
805432b
Merge pull request #61 from martosaur/am-credo
rafaeelaudibert Oct 1, 2025
118563b
Make tests async on 1.18+
martosaur Oct 1, 2025
7b225f6
Merge pull request #62 from martosaur/am-conditional-async
rafaeelaudibert Oct 1, 2025
423b8f8
Fix flaky sender test
martosaur Oct 1, 2025
6a15b5e
Merge pull request #63 from martosaur/am-another-flaky-test
rafaeelaudibert Oct 1, 2025
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
12 changes: 0 additions & 12 deletions .config/credo.exs

This file was deleted.

15 changes: 0 additions & 15 deletions .config/mix_audit.exs

This file was deleted.

217 changes: 217 additions & 0 deletions .credo.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
# This file contains the configuration for Credo and you are probably reading
# this after creating it with `mix credo.gen.config`.
#
# If you find anything wrong or unclear in this file, please report an
# issue on GitHub: https://github.com/rrrene/credo/issues
#
%{
#
# You can have as many configs as you like in the `configs:` field.
configs: [
%{
#
# Run any config using `mix credo -C <name>`. If no config name is given
# "default" is used.
#
name: "default",
#
# These are the files included in the analysis:
files: %{
#
# You can give explicit globs or simply directories.
# In the latter case `**/*.{ex,exs}` will be used.
#
included: [
"lib/",
"src/",
"test/",
"web/",
"apps/*/lib/",
"apps/*/src/",
"apps/*/test/",
"apps/*/web/"
],
excluded: [~r"/_build/", ~r"/deps/", ~r"/node_modules/"]
},
#
# Load and configure plugins here:
#
plugins: [],
#
# If you create your own checks, you must specify the source files for
# them here, so they can be loaded by Credo before running the analysis.
#
requires: [],
#
# If you want to enforce a style guide and need a more traditional linting
# experience, you can change `strict` to `true` below:
#
strict: false,
#
# To modify the timeout for parsing files, change this value:
#
parse_timeout: 5000,
#
# If you want to use uncolored output by default, you can change `color`
# to `false` below:
#
color: true,
#
# You can customize the parameters of any check by adding a second element
# to the tuple.
#
# To disable a check put `false` as second element:
#
# {Credo.Check.Design.DuplicatedCode, false}
#
checks: %{
enabled: [
#
## Consistency Checks
#
{Credo.Check.Consistency.ExceptionNames, []},
{Credo.Check.Consistency.LineEndings, []},
{Credo.Check.Consistency.ParameterPatternMatching, []},
{Credo.Check.Consistency.SpaceAroundOperators, []},
{Credo.Check.Consistency.SpaceInParentheses, []},
{Credo.Check.Consistency.TabsOrSpaces, []},

#
## Design Checks
#
# You can customize the priority of any check
# Priority values are: `low, normal, high, higher`
#
{Credo.Check.Design.AliasUsage,
[priority: :low, if_nested_deeper_than: 2, if_called_more_often_than: 1]},
{Credo.Check.Design.TagFIXME, []},
# You can also customize the exit_status of each check.
# If you don't want TODO comments to cause `mix credo` to fail, just
# set this value to 0 (zero).
#
{Credo.Check.Design.TagTODO, [exit_status: 2]},

#
## Readability Checks
#
{Credo.Check.Readability.AliasOrder, []},
{Credo.Check.Readability.FunctionNames, []},
{Credo.Check.Readability.LargeNumbers, []},
{Credo.Check.Readability.MaxLineLength, [priority: :low, max_length: 120]},
{Credo.Check.Readability.ModuleAttributeNames, []},
{Credo.Check.Readability.ModuleDoc, []},
{Credo.Check.Readability.ModuleNames, []},
{Credo.Check.Readability.ParenthesesInCondition, []},
{Credo.Check.Readability.PipeIntoAnonymousFunctions, []},
{Credo.Check.Readability.PredicateFunctionNames, []},
{Credo.Check.Readability.PreferImplicitTry, []},
{Credo.Check.Readability.RedundantBlankLines, []},
{Credo.Check.Readability.Semicolons, []},
{Credo.Check.Readability.SpaceAfterCommas, []},
{Credo.Check.Readability.StringSigils, []},
{Credo.Check.Readability.TrailingBlankLine, []},
{Credo.Check.Readability.TrailingWhiteSpace, []},
{Credo.Check.Readability.UnnecessaryAliasExpansion, []},
{Credo.Check.Readability.VariableNames, []},
{Credo.Check.Readability.WithSingleClause, []},

#
## Refactoring Opportunities
#
{Credo.Check.Refactor.Apply, []},
{Credo.Check.Refactor.CondStatements, []},
{Credo.Check.Refactor.CyclomaticComplexity, []},
{Credo.Check.Refactor.FilterCount, []},
{Credo.Check.Refactor.FilterFilter, []},
{Credo.Check.Refactor.FunctionArity, []},
{Credo.Check.Refactor.LongQuoteBlocks, []},
{Credo.Check.Refactor.MapJoin, []},
{Credo.Check.Refactor.MatchInCondition, []},
{Credo.Check.Refactor.NegatedConditionsInUnless, []},
{Credo.Check.Refactor.NegatedConditionsWithElse, []},
{Credo.Check.Refactor.Nesting, []},
{Credo.Check.Refactor.RedundantWithClauseResult, []},
{Credo.Check.Refactor.RejectReject, []},
{Credo.Check.Refactor.UnlessWithElse, []},
{Credo.Check.Refactor.WithClauses, []},

#
## Warnings
#
{Credo.Check.Warning.ApplicationConfigInModuleAttribute, []},
{Credo.Check.Warning.BoolOperationOnSameValues, []},
{Credo.Check.Warning.Dbg, []},
{Credo.Check.Warning.ExpensiveEmptyEnumCheck, []},
{Credo.Check.Warning.IExPry, []},
{Credo.Check.Warning.IoInspect, []},
{Credo.Check.Warning.OperationOnSameValues, []},
{Credo.Check.Warning.OperationWithConstantResult, []},
{Credo.Check.Warning.RaiseInsideRescue, []},
{Credo.Check.Warning.SpecWithStruct, []},
{Credo.Check.Warning.UnsafeExec, []},
{Credo.Check.Warning.UnusedEnumOperation, []},
{Credo.Check.Warning.UnusedFileOperation, []},
{Credo.Check.Warning.UnusedKeywordOperation, []},
{Credo.Check.Warning.UnusedListOperation, []},
{Credo.Check.Warning.UnusedPathOperation, []},
{Credo.Check.Warning.UnusedRegexOperation, []},
{Credo.Check.Warning.UnusedStringOperation, []},
{Credo.Check.Warning.UnusedTupleOperation, []},
{Credo.Check.Warning.WrongTestFileExtension, []}
],
disabled: [
#
# Checks scheduled for next check update (opt-in for now)
{Credo.Check.Refactor.UtcNowTruncate, []},

#
# Controversial and experimental checks (opt-in, just move the check to `:enabled`
# and be sure to use `mix credo --strict` to see low priority checks)
#
{Credo.Check.Consistency.MultiAliasImportRequireUse, []},
{Credo.Check.Consistency.UnusedVariableNames, []},
{Credo.Check.Design.DuplicatedCode, []},
{Credo.Check.Design.SkipTestWithoutComment, []},
{Credo.Check.Readability.AliasAs, []},
{Credo.Check.Readability.BlockPipe, []},
{Credo.Check.Readability.ImplTrue, []},
{Credo.Check.Readability.MultiAlias, []},
{Credo.Check.Readability.NestedFunctionCalls, []},
{Credo.Check.Readability.OneArityFunctionInPipe, []},
{Credo.Check.Readability.OnePipePerLine, []},
{Credo.Check.Readability.SeparateAliasRequire, []},
{Credo.Check.Readability.SingleFunctionToBlockPipe, []},
{Credo.Check.Readability.SinglePipe, []},
{Credo.Check.Readability.Specs, []},
{Credo.Check.Readability.StrictModuleLayout, []},
{Credo.Check.Readability.WithCustomTaggedTuple, []},
{Credo.Check.Readability.ParenthesesOnZeroArityDefs, []},
{Credo.Check.Refactor.ABCSize, []},
{Credo.Check.Refactor.AppendSingleItem, []},
{Credo.Check.Refactor.DoubleBooleanNegation, []},
{Credo.Check.Refactor.FilterReject, []},
{Credo.Check.Refactor.IoPuts, []},
{Credo.Check.Refactor.MapMap, []},
{Credo.Check.Refactor.ModuleDependencies, []},
{Credo.Check.Refactor.NegatedIsNil, []},
{Credo.Check.Refactor.PassAsyncInTestCases, []},
{Credo.Check.Refactor.PipeChainStart, []},
{Credo.Check.Refactor.RejectFilter, []},
{Credo.Check.Refactor.VariableRebinding, []},
{Credo.Check.Warning.LazyLogging, []},
{Credo.Check.Warning.LeakyEnvironment, []},
{Credo.Check.Warning.MapGetUnsafePass, []},
{Credo.Check.Warning.MissedMetadataKeyInLoggerConfig, []},
{Credo.Check.Warning.MixEnv, []},
{Credo.Check.Warning.UnsafeToAtom, []}

# {Credo.Check.Refactor.MapInto, []},

#
# Custom checks can be created using `mix credo.gen.check`.
#
]
}
}
]
}
20 changes: 4 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,14 @@ jobs:
# This is a complicated set of strategies, but Elixir has a complicated set of supported versions.
# See https://hexdocs.pm/elixir/compatibility-and-deprecations.html
# See https://hexdocs.pm/elixir/compatibility-and-deprecations.html#between-elixir-and-erlang-otp
#
# NOTE: We're intentionally not including Elixir 1.14.x + OTP 23.x
# because erlef/setup-beam@v1 doesn't support it.
strategy:
matrix:
elixir: ["1.14.x", "1.15.x", "1.16.x", "1.17.x", "1.18.x"]
otp: ["24.x", "25.x", "26.x", "27.x"]
elixir: ["1.17.x", "1.18.x"]
otp: ["25.x", "26.x", "27.x", "28.x"]
exclude:
# Elixir 1.17 and 1.18 don't support OTP 24
# Elixir 1.17 doesn't support OTP 28
- elixir: "1.17.x"
otp: "24.x"
- elixir: "1.18.x"
otp: "24.x"
# Elixir 1.14, 1.15 and 1.16 don't support OTP 27
- elixir: "1.15.x"
otp: "27.x"
- elixir: "1.16.x"
otp: "27.x"
- elixir: "1.14.x"
otp: "27.x"
otp: "28.x"

steps:
- uses: actions/checkout@v3
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ posthog-*.tar

# Ignore .DS_Store
.DS_Store

# Local Config
config/integration.exs
config/dev.override.exs
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
elixir 1.18.3
elixir 1.18.3-otp-27
erlang 27.3.3
22 changes: 21 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
## 2.0.0 - 2025-09-30

### Major Release

`posthog-elixir` was fully reworked. Check [migration guide](MIGRATION.md#v1-v2)
for some tips on how to upgrade.

Huge thanks to community member [@martosaur](https://github.com/martosaur) for contributing this new version.

### What's new

- Elixir v1.17+ required
- Event capture is now offloaded to background workers with automatic batching
- [Context](README.md#context) mechanism for easier property propagation
- [Error Tracking](README.md#error-tracking) support
- New `PostHog.FeatureFlags` module for working with feature flags
- [Test mode](`PostHog.Test`) for easier testing
- Customizable [HTTP client](`PostHog.API.Client`) with Req as the default
- [Plug integration](`PostHog.Integrations.Plug`) for automatically capturing common HTTP properties

## 1.1.0 - 2025-07-01

- Expose `capture/2` `b077aba849126c63f1c7a82b6ad9d21945871a4a`
Expand Down Expand Up @@ -27,7 +47,7 @@
- PostHog now requires you to initialize `Posthog.Application` alongside your supervisor tree. This is required because of our `Cachex` system to properly track your FF usage.
- We'll also include local evaluation in the near term, which will also require a GenServer, therefore, requiring us to use a Supervisor.
- Added `enabled_capture` configuration option to disable PostHog tracking in development/test environments
- `Posthog.capture` now requires `distinct_id` as a required second argument
- `PostHog.capture` now requires `distinct_id` as a required second argument

## 0.4.4 - 2025-04-14

Expand Down
Loading
Loading