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

Link frontend to backend requests #5620

Closed

Conversation

justin-stephenson
Copy link
Contributor

Add client ID tracking through responders into the Data provider, logging the client ID where applicable to enable mapping of requests from beginning to end.

@justin-stephenson
Copy link
Contributor Author

This is on me to fix the tests, but the functionally can still be tested in the meantime.

@justin-stephenson
Copy link
Contributor Author

Tests are fixed, @alexey-tikhonov would you mind being assigned as reviewer?

@alexey-tikhonov
Copy link
Member

@alexey-tikhonov would you mind being assigned as reviewer?

I'm not sure I will get to this this week, so I'd prefer to keep it unassigned in case anyone else would like to review.

@@ -89,6 +89,8 @@ bool __wrap_be_is_offline(struct be_ctx *ctx)
#define NAME "test_user"
#define NAME2 "test_user2"
#define REQ_NAME "getpwuid"
#define CID "1"
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi,

the 5th argument of dp_req_send() is an uint32_t not a string.

bye,
Sumit

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@@ -1114,7 +1114,8 @@ struct tevent_req *cache_req_send(TALLOC_CTX *mem_ctx,
}
state->first_iteration = true;

CACHE_REQ_DEBUG(SSSDBG_TRACE_FUNC, cr, "New request '%s'\n", cr->reqname);
CACHE_REQ_DEBUG(SSSDBG_TRACE_FUNC, cr, "New request [CID #%u] '%s'\n",
rctx->client_id_num, cr->reqname);
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi,

this message and other debug messages where the different IDs (here CID and CR number) are linked together are important for processing the flow of the request. If by chance one of those "debug" messages get changed in future, tools processing the logs might break.

Maybe it would be good to protect those messages by defining a dedicated set of macros to print those messages, here e.g. something like SSS_REQ_TRACE_CID_CR(rctx->client_id_num, cr->reqname);.

As a second step the text part of the debug message defined in the new macro can be used by a processing tool to find the message in the logs.

bye,
Sumit

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi, that's a good idea. Were you thinking of something like:

[cache_req_send] (0x0400): CR #2: New request [CID #1] 'Initgroups by name'
[cache_req_send] (0x0400): REQ_TRACE: [CR #2] 'Initgroups by name' linked to [CID #1] '

Or combine them all into the same single log message? Here I will use REQ_TRACE as an identifier which can filter the linking relationship log messages (other will be in the backend)

Copy link
Contributor

Choose a reason for hiding this comment

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

Hi,

my suggestion was more about the source code, so that it is easy to see that it is not an ordinary debug message. But adding a keyword to the log messages might be useful as well.

bye,
Sumit

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed, see this updated commit and 46023c0

Log the Client ID at the initial cache request submission.
Make the client ID and responder name available to log where
the DP request is attached. This will ensure we log the CID,
originating responder name, and DP-internal request ID for
all DP requests.

[dp_attach_req] (0x0400): DP Request [Initgroups #14]: REQ_TRACE: New
request. [sssd.pam CID #1] Flags [0x0001].
@justin-stephenson
Copy link
Contributor Author

Pushed new code addressing review items, the frontend/responder ID tracking changes in this PR may need to be changed or can be removed entirely if the tevent chain ID changes are merged. I'm unsure if I can assume those changes will be merged, or not, at this point.

@sumit-bose
Copy link
Contributor

Hi,

thanks for you patience, I'm fine with the patch, even on its own it might already help to follow individual requests better through the logs of different components. ACK.

bye,
Sumit

@pbrezina pbrezina added the Ready to push Ready to push label Jun 8, 2021
@pbrezina
Copy link
Member

pbrezina commented Jun 8, 2021

Pushed PR: #5620

  • master
    • 4f1a06d - DP: Propagate down the client id and sender name
    • d0e3589 - CACHE_REQ: Log the Client ID of the cache request
    • 7ed8787 - RESPONDER LOGS: Log the Client ID where accessible
    • bee426c - SBUS: Send Client ID across to DP interfaces
    • c917f97 - RESPONDER: Generate incrementing client ID

@pbrezina pbrezina added Pushed and removed Accepted Ready to push Ready to push labels Jun 8, 2021
@pbrezina pbrezina closed this Jun 8, 2021
@justin-stephenson justin-stephenson deleted the client_id_link_reqs branch October 21, 2021 17:21
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.

None yet

4 participants