feat!: add telemetry error events and stop producer on auth failures (v3.0.0)#14
Merged
Rolf Håvard Blindheim (rhblind) merged 21 commits intomainfrom Apr 14, 2026
Merged
Conversation
Update the receive_messages/3 callback typespec from returning a plain
list to returning {:ok, messages} | {:error, reason :: any}, allowing
the producer to distinguish errors from empty results.
wrap_received_messages now returns {:ok, messages} on success,
{:error, {:http_error, status}} on non-200 HTTP responses, and
{:error, reason} on network errors, matching the Client behaviour typespec.
…p on 401/403
- receive_messages_from_splunk/2 now handles {:ok, msgs} | {:error, ...} return
from the client and emits [:off_broadway_splunk, :receive_messages, :error]
telemetry on errors
- Returns {:stop, :unauthorized, state} on HTTP 401/403, {:error, ...} otherwise
- handle_receive_messages/1 demand>0 clause pattern-matches the new return shape,
retrying on transient errors and stopping the producer on auth failures
- Add two tests: telemetry emission on 404 and producer stop on 401
- Emit [:off_broadway_splunk, :receive_jobs, :error] telemetry for non-200
HTTP responses and network errors from receive_jobs_from_splunk/1
- Convert non-200 responses to {:error, {:http_error, status}} returns
- Stop the producer on 401/403 from the jobs path in both
handle_receive_jobs/1 and the inline fetch in handle_receive_messages/1
- Retry on other errors by rescheduling
- Remove now-unreachable catch-all clauses from update_queue_from_response/2
- Add tests for telemetry emission and producer stop on 401/403
Replace manual changelog format with release-please generated version including bug fixes, documentation updates, CI configuration, style changes, and test improvements.
Consolidate multi-line assert_receive statements for telemetry events into single lines for improved readability and consistency.
These options were deprecated in 2.1.3 in favour of the :jobs option.
Add blank line between variable assignment and case statement for improved readability following Elixir style guidelines.
…ucer - Add terminate/2 callback emitting [:off_broadway_splunk, :producer, :stop] whenever the producer stops via a callback return (e.g. :unauthorized on a 401/403). This gives consumers an observable signal for non-transient failures. Note: fires only for callback-initiated stops, not supervisor shutdown (ProducerStage does not trap exits). - Remove [:off_broadway_splunk, :receive_status, :error] telemetry from SplunkClient.receive_status/2. The producer already emits [:off_broadway_splunk, :receive_jobs, :error] for the same failure, so the client-side emission was a double-event. Moving responsibility to the producer ensures the event is always emitted regardless of which client implementation is used.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #12.
Client.receive_messages/3now returns{:ok, [Message.t()]} | {:error, reason}instead of a bare list. Custom client implementations must wrap their result in{:ok, list}.[:off_broadway_splunk, :receive_status, :error]telemetry on network errors fromreceive_status/2.[:off_broadway_splunk, :receive_jobs, :error]telemetry when the job list fetch fails (non-200 or network error).[:off_broadway_splunk, :receive_messages, :error]telemetry when an event fetch fails (non-200 or network error).{:stop, :unauthorized, state}) on HTTP 401 or 403 from either the jobs or messages path, allowing Broadway's supervisor to restart or leave it stopped.Test plan
mix test)mix credo --strict)receive_messages/3to return{:ok, list}or{:error, reason}