Skip to content

feat: Read from replicas in caches#3383

Merged
Ziinc merged 20 commits intoLogflare:mainfrom
ruslandoga:rd/read-from-replicas-in-caches
Apr 22, 2026
Merged

feat: Read from replicas in caches#3383
Ziinc merged 20 commits intoLogflare:mainfrom
ruslandoga:rd/read-from-replicas-in-caches

Conversation

@ruslandoga
Copy link
Copy Markdown
Contributor

@ruslandoga ruslandoga commented Apr 15, 2026

Closes O11Y-1354

@ruslandoga ruslandoga force-pushed the rd/read-from-replicas-in-caches branch 3 times, most recently from 49bb31f to 44c5cb2 Compare April 16, 2026 15:11
@ruslandoga ruslandoga force-pushed the rd/read-from-replicas-in-caches branch from 44c5cb2 to 3ef1610 Compare April 16, 2026 15:30
@ruslandoga ruslandoga marked this pull request as ready for review April 16, 2026 15:32
Comment thread lib/telemetry.ex Outdated
distribution("logflare.repo.query.total_time",
unit: {:native, :millisecond},
tags: [:role],
tag_values: &add_repo_role/1
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is needed at this stage.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's exclude this for now.

Copy link
Copy Markdown
Contributor Author

@ruslandoga ruslandoga Apr 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this role tag from all metrics in 03ac56f

Comment thread config/runtime.exs
Comment thread lib/logflare/repo.ex Outdated
end

defp random_read_replica do
case fetch_read_replicas!() do
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to load balance across all including the primary for first pass at this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added primary to the set of choices in 03ac56f

Comment thread lib/telemetry.ex Outdated
distribution("logflare.repo.query.total_time",
unit: {:native, :millisecond},
tags: [:role],
tag_values: &add_repo_role/1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's exclude this for now.

Comment thread lib/telemetry.ex Outdated
unit: {:native, :millisecond},
tags: [:role],
tag_values: &add_repo_role/1
)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above, let's exclude

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in 03ac56f

@Ziinc
Copy link
Copy Markdown
Contributor

Ziinc commented Apr 20, 2026

Also needs documentation updates for self hosting

@ruslandoga
Copy link
Copy Markdown
Contributor Author

ruslandoga commented Apr 21, 2026

Also needs documentation updates for self hosting

I've added some documentation in 674ee36.

Off-topic: there is no description on that page for most of the other database configuration options like DB_HOSTNAME, DB_PORT, DB_USERNAME, DB_PASSWORD, etc. They only appear in the Docker Compose example. I think maybe those can be added as well for completeness.

@ruslandoga ruslandoga requested a review from Ziinc April 21, 2026 00:52
Comment thread test/logflare/repo_test.exs Outdated
Comment thread test/logflare/repo_test.exs Outdated
@Ziinc
Copy link
Copy Markdown
Contributor

Ziinc commented Apr 22, 2026

@ruslandoga can you add the remaining missing db env vars in a follow up PR? 🙏

@Ziinc Ziinc merged commit a0019bb into Logflare:main Apr 22, 2026
15 checks passed
@ruslandoga ruslandoga deleted the rd/read-from-replicas-in-caches branch April 22, 2026 11:59
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.

2 participants