···3131 `Atex.OAuth.session_active_session_name/0` expose Plug session key atoms
3232- `Atex.IdentityResolver` now has full module and function documentation
3333- `Atex.XRPC.LoginClient` now has a `@moduledoc`
3434+- Optional `:telemetry` instrumentation via `Atex.Telemetry`. Add `{:telemetry, "~> 1.0"}` to
3535+ your deps to receive events from XRPC requests, identity resolution, OAuth flows, and service
3636+ auth validation. See `Atex.Telemetry` for the full event catalogue.
34373538### Fixed
3639
+25-7
lib/atex/identity_resolver.ex
···4747 def resolve(identifier, opts \\ []) do
4848 opts = Keyword.validate!(opts, skip_cache: false)
4949 skip_cache = Keyword.get(opts, :skip_cache)
5050+ identifier_type = if String.starts_with?(identifier, "did:"), do: :did, else: :handle
50515151- cache_result = if skip_cache, do: {:error, :not_found}, else: Cache.get(identifier)
5252+ Atex.Telemetry.span(
5353+ [:atex, :identity_resolver, :resolve],
5454+ %{identifier: identifier, identifier_type: identifier_type},
5555+ fn ->
5656+ cache_result = if skip_cache, do: {:error, :not_found}, else: Cache.get(identifier)
52575353- # If cache fetch succeeds, then the ok tuple will be retuned by the default `with` behaviour
5454- with {:error, :not_found} <- cache_result,
5555- {:ok, identity} <- do_resolve(identifier),
5656- identity <- Cache.insert(identity) do
5757- {:ok, identity}
5858- end
5858+ cache_event = if match?({:ok, _}, cache_result), do: :hit, else: :miss
5959+6060+ Atex.Telemetry.execute(
6161+ [:atex, :identity_resolver, :cache, cache_event],
6262+ %{system_time: System.system_time()},
6363+ %{identifier: identifier}
6464+ )
6565+6666+ # If cache fetch succeeds, then the ok tuple will be retuned by the default `with` behaviour
6767+ result =
6868+ with {:error, :not_found} <- cache_result,
6969+ {:ok, identity} <- do_resolve(identifier),
7070+ identity <- Cache.insert(identity) do
7171+ {:ok, identity}
7272+ end
7373+7474+ {result, %{}}
7575+ end
7676+ )
5977 end
60786179 @spec do_resolve(identity :: String.t()) ::