diff --git a/lib/wanderer_app/character/tracker.ex b/lib/wanderer_app/character/tracker.ex index f8d64261..bdba32e5 100644 --- a/lib/wanderer_app/character/tracker.ex +++ b/lib/wanderer_app/character/tracker.ex @@ -188,7 +188,6 @@ defmodule WandererApp.Character.Tracker do _ -> # Monitor cache for potential evictions before ESI call - log_cache_stats("character_online_check", character_id, "online_forbidden") case WandererApp.Esi.get_character_online(eve_id, access_token: access_token, @@ -681,7 +680,6 @@ defmodule WandererApp.Character.Tracker do _ -> # Monitor cache for potential evictions before ESI call - log_cache_stats("character_location_check", character_id, "location_forbidden") case WandererApp.Esi.get_character_location(eve_id, access_token: access_token, @@ -1382,50 +1380,6 @@ defmodule WandererApp.Character.Tracker do end end - # Add cache monitoring for eviction detection - defp log_cache_stats(operation, character_id, cache_key) do - try do - # Check if critical cache entries are missing (could indicate eviction) - critical_keys = [ - "character:#{character_id}:last_online_time", - "character:#{character_id}:online_forbidden", - "character:#{character_id}:location_forbidden", - "character:#{character_id}:ship_forbidden" - ] - - missing_keys = - Enum.filter(critical_keys, fn key -> - not WandererApp.Cache.has_key?(key) - end) - - # Alert if multiple cache keys are missing - if length(missing_keys) > 2 do - Logger.warning("CACHE_EVICTION_SUSPECTED: Multiple critical cache keys missing", - operation: operation, - character_id: character_id, - cache_key: cache_key, - missing_keys: missing_keys, - missing_count: length(missing_keys) - ) - - # Emit telemetry - :telemetry.execute( - [:wanderer_app, :cache, :eviction_suspected], - %{ - missing_count: length(missing_keys) - }, - %{ - operation: operation, - character_id: character_id - } - ) - end - rescue - # Don't fail character tracking if cache monitoring fails - _ -> :ok - end - end - # Telemetry handler for database pool monitoring def handle_pool_query(_event_name, measurements, metadata, _config) do queue_time = measurements[:queue_time] diff --git a/lib/wanderer_app/esi/api_client.ex b/lib/wanderer_app/esi/api_client.ex index 19307f0b..43ba2598 100644 --- a/lib/wanderer_app/esi/api_client.ex +++ b/lib/wanderer_app/esi/api_client.ex @@ -792,7 +792,10 @@ defmodule WandererApp.Esi.ApiClient do expires_at_datetime = DateTime.from_unix!(expires_at) time_since_expiry = DateTime.diff(DateTime.utc_now(), expires_at_datetime, :second) - Logger.info("TOKEN_REFRESH_SUCCESS: Character token refreshed successfully", + Logger.debug( + fn -> + "TOKEN_REFRESH_SUCCESS: Character token refreshed successfully" + end, character_id: character_id, time_since_expiry_seconds: time_since_expiry, new_expires_at: token.expires_at diff --git a/lib/wanderer_app/kills/client.ex b/lib/wanderer_app/kills/client.ex index 3c0c7e49..3602ed2e 100644 --- a/lib/wanderer_app/kills/client.ex +++ b/lib/wanderer_app/kills/client.ex @@ -112,7 +112,10 @@ defmodule WandererApp.Kills.Client do end def handle_info(:connect, state) do - Logger.info("[Client] Initiating connection attempt (retry count: #{state.retry_count})") + Logger.debug(fn -> + "[Client] Initiating connection attempt (retry count: #{state.retry_count})" + end) + state = cancel_retry(state) new_state = attempt_connection(%{state | connecting: true}) {:noreply, new_state} @@ -214,9 +217,9 @@ defmodule WandererApp.Kills.Client do state :needs_reconnect -> - Logger.warning( + Logger.debug(fn -> "[Client] Connection unhealthy, triggering reconnect (retry count: #{state.retry_count})" - ) + end) # Don't reset retry count during health check failures if state.connected or state.connecting do @@ -228,9 +231,9 @@ defmodule WandererApp.Kills.Client do end :needs_reconnect_with_timestamp -> - Logger.warning( + Logger.debug(fn -> "[Client] Health check triggering reconnect (retry count: #{state.retry_count})" - ) + end) new_state = %{state | last_health_reconnect_attempt: System.system_time(:millisecond)} @@ -552,9 +555,9 @@ defmodule WandererApp.Kills.Client do # Check if we haven't received a message in the configured timeout System.system_time(:millisecond) - last_msg_time > @message_timeout -> - Logger.warning( + Logger.debug(fn -> "[Client] Health check: No messages received for 15+ minutes, reconnecting" - ) + end) :needs_reconnect diff --git a/priv/posts/2025/05-07-systems-connections-api.md b/priv/posts/2025/05-07-systems-connections-api.md index 5db6e718..abd6a5ef 100644 --- a/priv/posts/2025/05-07-systems-connections-api.md +++ b/priv/posts/2025/05-07-systems-connections-api.md @@ -1,7 +1,7 @@ %{ title: "Guide: Systems and Connections API", author: "Wanderer Team", - cover_image_uri: "/images/news/03-06-systems/api-endpoints.png", + cover_image_uri: "/images/news/05-07-systems/api-endpoints.png", tags: ~w(api map systems connections documentation), description: "Detailed guide for Wanderer's systems and connections API endpoints, including batch operations, updates, and deletions." } diff --git a/priv/posts/2025/07-15-api-modernization.md b/priv/posts/2025/07-15-api-modernization.md index 87668c3e..03e01719 100644 --- a/priv/posts/2025/07-15-api-modernization.md +++ b/priv/posts/2025/07-15-api-modernization.md @@ -1,7 +1,7 @@ %{ title: "API Modernization: JSON:API v1 and Enhanced Developer Experience", author: "Wanderer Team", -cover_image_uri: "/images/news/01-15-api-modernization/api-hero.png", +cover_image_uri: "/images/news/07-15-api-modernization/api-hero.png", tags: ~w(api json-api v1 modernization developer-experience backwards-compatibility ash-framework), description: "Introducing Wanderer's new JSON:API v1 endpoints with enhanced developer experience, comprehensive versioning, and enterprise-grade security - all while maintaining 100% backward compatibility." }