Project

Profile

Help

Story #4689

closed

As a user, Pulp logs have correlation ids in the logs of all services

Added by dkliban@redhat.com about 5 years ago. Updated over 3 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
Start date:
Due date:
% Done:

100%

Estimated time:
Platform Release:
Groomed:
Yes
Sprint Candidate:
Yes
Tags:
Katello
Sprint:
Sprint 87
Quarter:

Description

Motivation

Pulp as a multi-process system needs to make debugging easy. Currently it is hard to:

  1. Identify which log statements are related to a specific API request
  2. Filter out all of those that aren't
  3. Do this across multiple processes

Additionally, there is a use case where an external system wants to provide the correlation id, e.g. Katello wants to submit the correlation ID as part of the request.

Solution

Use django-cid by default, and document that it's available for users to use.

Implementation

Enabling in Pulp itself

  1. Add django-cid as an installed app
  2. Reconfigure the default Django logger config in settings.py to incorporate the CID
  3. Add user documentation identifying the types of things they can additionally configure
  4. Add a test to assert Pulp viewset logs contain an autogenerated CID

Enabling in the App

  1. Add a test to assert content app logs contain an autogenerated CID

Enabling in Tasking System

  1. Create the field on task and set it: Add a field to the Task model called logging_cid. Have the enqueue_with_reservation function set this field when it creates a Task object with the value of get_cid.

  2. Have the CID log on the resource manager itself: Have the _queue_reserved_task method call set_cid() with the value of the new logging_cid from the inner_task. This will enable the correlation ID in the resource_manager logs for that task also.

  3. Have all tasks also use the CID: Have the perform_job call set_cid() with the value of the logging_cid from the task. This will enable the correlation ID in all pulp task logs without them having to change their signatures.

  4. Lastly, expose the logging_cid in the task API for users to see.


Related issues

Related to Pulp - Task #3289: Support for X-Correlation-ID HTTP REST headerCLOSED - WONTFIX

Actions
Related to Pulp - Story #2654: As a User I want Pulp3 to log the first 8 characters of a task id in every log statement emitted from a running taskCLOSED - WONTFIX

Actions
Related to Pulp - Task #7792: Update the gunicorn service file to log correlation idCLOSED - CURRENTRELEASEdaviddavis

Actions

Also available in: Atom PDF