Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opentelemetry_oban crashes for inline in test #324

Open
mdg opened this issue May 18, 2024 · 0 comments
Open

opentelemetry_oban crashes for inline in test #324

mdg opened this issue May 18, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@mdg
Copy link

mdg commented May 18, 2024

Describe the bug

Oban defaults to running in :inline mode in the test environment. When it does this, it seems to not actually install the job in the db, so the inserted_at field never gets set. Then handle_job_start runs and it tries to call DateTime.to_iso8601 on nil and gets a failure and the tests fail.

Expected behavior

Primary expectation is that it shouldn't crash. Seems like 3 possible options and from my perspective, any of them would be acceptable.

  1. Make it easier / default / better documented for how to disable opentelemetry_oban in testing config
  2. Default to disabling opentelemetry_oban if running in inline mode
  3. Default "oban.job.inserted_at" to be DateTime.utc_now() if job inserted_at is nil

Additional context

My app-specific fix for this was a version of option 1 which seems to work, but took some investigation and iteration to get to it.

    skipped_telemetry = Application.get_env(:appname, :skipped_telemetry, [])
    if not Enum.any?(skipped_telemetry, &(&1 == OpentelemetryOban)) do
      OpentelemetryOban.setup()
    end
@mdg mdg added the bug Something isn't working label May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant