Skip to content

Conversation

@dralley
Copy link
Contributor

@dralley dralley commented Jan 17, 2026

TASK_DIAGNOSTICS and X-Task-Diagnostics can now capture all logs for specific tasks and present those via the profile artifacts mechanism. Because the logs are specific to the task, the logs are linear and not broken up by unrelated logs from other services/workers/tasks.

Assisted By: Claude

closes #7214

@dralley dralley force-pushed the task-logging branch 2 times, most recently from 5d9ca0f to 21eb4d6 Compare January 17, 2026 05:06
@github-actions github-actions bot removed the no-issue label Jan 18, 2026
@dralley dralley force-pushed the task-logging branch 2 times, most recently from f8b12d0 to 5532ddc Compare January 18, 2026 17:51
@github-actions github-actions bot removed the wip label Jan 21, 2026
@dralley dralley marked this pull request as ready for review January 21, 2026 01:44
@dralley
Copy link
Contributor Author

dralley commented Jan 21, 2026

@bmbouter @mdellweg Since last push:

  • DEBUG logging "upgrade" functionality moved to separate feature
    • I can split this off into a separate PR if desired
  • I made sure that the CID was logged, and then undid that, because it's actually pointless to log the CID if none of the non-task context is there to look at anyway. Obviously logs going to the console already have the CID inserted.

@dralley dralley force-pushed the task-logging branch 2 times, most recently from 3b2aafa to 291e7b6 Compare January 21, 2026 04:26
These logs just aren't very helpful, and they're extremely verbose, to
the point where they inflate log size by orders of magnitude and
meaningfully slow execution.
TASK_DIAGNOSTICS and X-Task-Diagnostics can now capture all logs for
specific tasks. Because the logs are specific to the task, the logs
are linear and not broken up by unrelated logs from other
services/workers/tasks.

Assisted By: Claude

closes pulp#7215
Temporarily change the root logger's log level, but make sure that the
console logger is still only logging at INFO level.

closes pulp#7214
@dralley dralley changed the title Add task-specific log capturing to task diagnostics mechanism [PULP-1117] Add task-specific log capturing to task diagnostics mechanism Jan 21, 2026
Copy link
Member

Choose a reason for hiding this comment

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

Not technically related, but let's just silently fix this (it's a separate commit anyway)...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right. I had seen the markdown-header- prefix thing elsewhere, but it turns out it is just unnecessary and actually doesn't work on this particular markdown flavor.

):
"""Create arguments for creation of a new task"""
current_task = Task.current()
profile_options = x_task_diagnostics_var.get(None)
Copy link
Member

Choose a reason for hiding this comment

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

x_task_diagnostics_var is a context var. Wouldn't it make sense to set it up again when entering the task context instead of applying extra logic for subtasks?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Look at "temp commit", is that what you mean? (maybe that code would be moved to contexts.py, but in general principle)

return __memray_diagnostic_decorator


def _logging_decorator(temp_dir, func):
Copy link
Member

Choose a reason for hiding this comment

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

I am still a little concerned that this will capture any logs happening during task execution.
As long as we call a task in a subprocess this will probably work. But we already have (fast, small) tasks "run in the forground" and we might introduce running async tasks concurrently. I don't have an answer for this ready.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You bring up a decent point, I could try to test this with tasks that are forced to run in immediate mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

As a user, I can enable DEBUG logging level for individual tasks

3 participants