Skip to content

Feat: Add immich server version log#673

Merged
JW-CH merged 1 commit into
mainfrom
immichserver-versionlog
Jul 12, 2026
Merged

Feat: Add immich server version log#673
JW-CH merged 1 commit into
mainfrom
immichserver-versionlog

Conversation

@JW-CH

@JW-CH JW-CH commented Jul 12, 2026

Copy link
Copy Markdown
Collaborator

This also removes log noise on level info

Summary by CodeRabbit

  • New Features

    • Added startup logging that reports the Immich server version for each configured account.
    • Added a warning when a server is running an unsupported major version.
    • Added warnings when version checks or configuration loading fail.
  • Improvements

    • Reduced HTTP client request logging by default; detailed request logs remain available in Debug mode.

@JW-CH JW-CH added the enhancement New feature or request label Jul 12, 2026
@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The application adds startup-time Immich server version logging for all configured accounts, including per-account failures and warnings for major versions below 3. HttpClient request logs are suppressed unless debug logging is enabled.

Changes

Server version logging

Layer / File(s) Summary
Account version discovery
ImmichFrame.WebApi/Helpers/ImmichServerVersionLogger.cs
Loads configured accounts, queries each Immich server with an API-authenticated client and five-second timeout, then logs versions or lookup warnings.
Startup logging integration
ImmichFrame.WebApi/Program.cs
Adds the helper namespace, filters HttpClient logs based on LOG_LEVEL, and invokes version logging before the application starts.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ApplicationStartup
  participant ImmichServerVersionLogger
  participant IServerSettings
  participant IHttpClientFactory
  participant ImmichServer
  participant ILogger
  ApplicationStartup->>ImmichServerVersionLogger: LogServerVersions
  ImmichServerVersionLogger->>IServerSettings: Load configured accounts
  ImmichServerVersionLogger->>IHttpClientFactory: Create API-authenticated client
  IHttpClientFactory->>ImmichServer: GetServerVersionAsync
  ImmichServer-->>ImmichServerVersionLogger: Return version
  ImmichServerVersionLogger->>ILogger: Log version or warning
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding Immich server version logging.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch immichserver-versionlog

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
ImmichFrame.WebApi/Helpers/ImmichServerVersionLogger.cs (1)

26-51: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Consider parallelizing per-account version checks to reduce startup time.

Accounts are processed sequentially with a 5-second timeout each. With multiple unreachable servers, startup blocks for N × 5 seconds. Since ILogger is thread-safe and IHttpClientFactory.CreateClient supports concurrent calls, wrapping the loop body in Task.WhenAll would cap the total wait at 5 seconds regardless of account count.

♻️ Proposed refactor: parallel execution via Task.WhenAll
             var httpClientFactory = services.GetRequiredService<IHttpClientFactory>();
 
-            foreach (var account in accounts)
-            {
-                try
-                {
-                    var httpClient = httpClientFactory.CreateClient("ImmichApiAccountClient");
-                    httpClient.UseApiKey(account.ApiKey);
-                    var immichApi = new ImmichApi(account.ImmichServerUrl, httpClient);
-
-                    using var cts = new CancellationTokenSource(RequestTimeout);
-                    var version = await immichApi.GetServerVersionAsync(cts.Token);
-
-                    logger.LogInformation("Immich server {Url} is running v{Major}.{Minor}.{Patch}",
-                        account.ImmichServerUrl, version.Major, version.Minor, version.Patch);
-
-                    if (version.Major < 3)
-                    {
-                        logger.LogWarning("Immich server {Url} is running v{Major}.{Minor}.{Patch}, but this version of ImmichFrame requires Immich v3 or newer. Please update your Immich server.",
-                            account.ImmichServerUrl, version.Major, version.Minor, version.Patch);
-                    }
-                }
-                catch (Exception ex)
-                {
-                    logger.LogWarning("Could not determine Immich server version for {Url}: {Message}",
-                        account.ImmichServerUrl, ex.Message);
-                }
-            }
+            var tasks = accounts.Select(async account =>
+            {
+                try
+                {
+                    var httpClient = httpClientFactory.CreateClient("ImmichApiAccountClient");
+                    httpClient.UseApiKey(account.ApiKey);
+                    var immichApi = new ImmichApi(account.ImmichServerUrl, httpClient);
+
+                    using var cts = new CancellationTokenSource(RequestTimeout);
+                    var version = await immichApi.GetServerVersionAsync(cts.Token);
+
+                    logger.LogInformation("Immich server {Url} is running v{Major}.{Minor}.{Patch}",
+                        account.ImmichServerUrl, version.Major, version.Minor, version.Patch);
+
+                    if (version.Major < 3)
+                    {
+                        logger.LogWarning("Immich server {Url} is running v{Major}.{Minor}.{Patch}, but this version of ImmichFrame requires Immich v3 or newer. Please update your Immich server.",
+                            account.ImmichServerUrl, version.Major, version.Minor, version.Patch);
+                    }
+                }
+                catch (Exception ex)
+                {
+                    logger.LogWarning("Could not determine Immich server version for {Url}: {Message}",
+                        account.ImmichServerUrl, ex.Message);
+                }
+            });
+            await Task.WhenAll(tasks);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ImmichFrame.WebApi/Helpers/ImmichServerVersionLogger.cs` around lines 26 -
51, Update the per-account processing in the version-logging method to run
concurrently with Task.WhenAll instead of awaiting each account sequentially.
Move the existing try/catch version-check logic into an async task for each
account, preserving the five-second RequestTimeout, logging, and exception
handling, then await all account tasks together.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@ImmichFrame.WebApi/Helpers/ImmichServerVersionLogger.cs`:
- Around line 26-51: Update the per-account processing in the version-logging
method to run concurrently with Task.WhenAll instead of awaiting each account
sequentially. Move the existing try/catch version-check logic into an async task
for each account, preserving the five-second RequestTimeout, logging, and
exception handling, then await all account tasks together.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5ab25792-fb4b-4ec3-97e8-71623e479021

📥 Commits

Reviewing files that changed from the base of the PR and between bdc6094 and 0d06fc2.

📒 Files selected for processing (2)
  • ImmichFrame.WebApi/Helpers/ImmichServerVersionLogger.cs
  • ImmichFrame.WebApi/Program.cs

@JW-CH JW-CH merged commit 3830d0c into main Jul 12, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant