Skip to content

feat: Add JiraClient and OpenTelemetry URL helpers#53

Open
Jez-A wants to merge 6 commits intomasterfrom
auto_escalation_infra
Open

feat: Add JiraClient and OpenTelemetry URL helpers#53
Jez-A wants to merge 6 commits intomasterfrom
auto_escalation_infra

Conversation

@Jez-A
Copy link

@Jez-A Jez-A commented Mar 3, 2026

Summary

This is a port of the Jira client we currently have in Opsbox: https://github.com/Intellection/opsbox/blob/master/lib/opsbox/jira_client.rb
We're also adding the OTEL URL helpers.

PR: #52 Adds the public entry point to handling errors.

PR: #54 adds the ADFBuilder which builds Atlassian Document Format (ADF) maps for Jira issue descriptions and comments.

The planned merge order is 53 (this PR) then 54, then 52.

Changes

  • Adds Zexbox.JiraClient: Req-based HTTP client for the Jira Cloud REST API v3 (search, create issue, transition, add comment)
  • Adds Zexbox.OpenTelemetry: reads the current OTEL span/baggage to produce Datadog session, Grafana Tempo, and Kibana Discover URLs — returns nil gracefully when OTEL is unconfigured
  • Adds :req, :jason, and :opentelemetry_api dependencies

These two modules are the infrastructure layer for the AutoEscalation feature (see follow-up PRs).

Test plan

  • mix test test/zexbox/jira_client_test.exs — 10 tests covering all four public JiraClient functions
  • mix test — full suite green

🤖 Generated with Claude Code

Adds two new utility modules required by the AutoEscalation feature:

- Zexbox.JiraClient: Req-based client for the Jira Cloud REST API v3.
  Supports search, create, transition, and add_comment operations.
  Authenticates via JIRA_USER_EMAIL_ADDRESS / JIRA_API_TOKEN env vars
  or :jira_email / :jira_api_token application config.

- Zexbox.OpenTelemetry: Reads the current process OTEL context (baggage
  and active span) to produce Datadog session, Grafana Tempo trace, and
  Kibana Discover URLs. Returns nil gracefully when OTEL is unconfigured.

Adds :req, :jason, and :opentelemetry_api dependencies to mix.exs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Jez-A and others added 3 commits March 3, 2026 14:59
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…uests

search_latest_issues was using GET with query params, which means the
response body was not guaranteed to be JSON-decoded by Req (Req only
auto-decodes based on the response Content-Type, not the request method).

Two changes:
- search_latest_issues now uses POST /rest/api/3/search/jql with a JSON
  body — the preferred Jira v3 approach. This also allows fields to be
  sent as a proper JSON array rather than a comma-separated string.
- build_client adds Accept: application/json to every request so the
  remaining GET (transitions fetch) also explicitly signals JSON intent
  and Req's decode_body step has a clear content-type to act on.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replaces keyword list opts (Keyword.fetch!/get) with typed positional
arguments throughout, consistent with the rest of the repo's style:

  search_latest_issues(jql, project_key \\ nil)
  create_issue(project_key, summary, description, issuetype, priority, custom_fields \\ %{})
  transition_issue(issue_key, status_name)
  add_comment(issue_key, comment)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
```
"""

@production_tempo_uid "een1tos42jnk0d"
Copy link
Author

Choose a reason for hiding this comment

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

@@ -0,0 +1,148 @@
defmodule Zexbox.OpenTelemetry do
Copy link
Author

Choose a reason for hiding this comment

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

Jez-A and others added 2 commits March 3, 2026 16:03
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant