Skip to content

Commit

Permalink
Document PAR Telemetry Events (#345)
Browse files Browse the repository at this point in the history
  • Loading branch information
maennchen committed Apr 30, 2024
1 parent 206090e commit e9d6b9b
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
27 changes: 27 additions & 0 deletions lib/oidcc/authorization.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,33 @@
defmodule Oidcc.Authorization do
use TelemetryRegistry

telemetry_event(%{
event: [:oidcc, :par_request, :start],
description: "Emitted at the start of executing a PAR request",
measurements: "%{system_time: non_neg_integer(), monotonic_time: integer()}",
metadata: "%{issuer: :uri_string.uri_string(), client_id: String.t()}"
})

telemetry_event(%{
event: [:oidcc, :par_request, :stop],
description: "Emitted at the end of executing a PAR request",
measurements: "%{duration: integer(), monotonic_time: integer()}",
metadata: "%{issuer: :uri_string.uri_string(), client_id: String.t()}"
})

telemetry_event(%{
event: [:oidcc, :par_request, :exception],
description: "Emitted at the end of executing a PAR request",
measurements: "%{duration: integer(), monotonic_time: integer()}",
metadata: "%{issuer: :uri_string.uri_string(), client_id: String.t()}"
})

@moduledoc """
Functions to start an OpenID Connect Authorization
## Telemetry
#{telemetry_docs()}
"""
@moduledoc since: "3.0.0"

Expand Down
21 changes: 21 additions & 0 deletions src/oidcc_authorization.erl
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,27 @@
| no_supported_code_challenge
| oidcc_http_util:error().

-telemetry_event(#{
event => [oidcc, par_request, start],
description => <<"Emitted at the start of executing a PAR request">>,
measurements => <<"#{system_time => non_neg_integer()}">>,
metadata => <<"#{issuer => uri_string:uri_string(), client_id => binary()}">>
}).

-telemetry_event(#{
event => [oidcc, par_request, stop],
description => <<"Emitted at the end of executing a PAR request">>,
measurements => <<"#{duration => integer(), monotonic_time => integer()}">>,
metadata => <<"#{issuer => uri_string:uri_string(), client_id => binary()}">>
}).

-telemetry_event(#{
event => [oidcc, par_request, exception],
description => <<"Emitted at the end of executing a PAR request">>,
measurements => <<"#{duration => integer(), monotonic_time => integer()}">>,
metadata => <<"#{issuer => uri_string:uri_string(), client_id => binary()}">>
}).

%% @doc
%% Create Auth Redirect URL
%%
Expand Down

0 comments on commit e9d6b9b

Please sign in to comment.