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

Improve DNS-SD resolution logging. #32873

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/lib/address_resolve/AddressResolve_DefaultImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ NodeLookupAction NodeLookupHandle::NextAction(System::Clock::Timestamp now)
{
const System::Clock::Timestamp elapsed = now - mRequestStartTime;

ChipLogProgress(Discovery, "Checking node lookup status after %lu ms", static_cast<unsigned long>(elapsed.count()));
ChipLogProgress(Discovery, "Checking node lookup status for " ChipLogFormatPeerId " after %lu ms",
ChipLogValuePeerId(mRequest.GetPeerId()), static_cast<unsigned long>(elapsed.count()));

// We are still within the minimal search time. Wait for more results.
if (elapsed < mRequest.GetMinLookupTime())
Expand Down Expand Up @@ -186,9 +187,11 @@ CHIP_ERROR Resolver::LookupNode(const NodeLookupRequest & request, Impl::NodeLoo
VerifyOrReturnError(mSystemLayer != nullptr, CHIP_ERROR_INCORRECT_STATE);

handle.ResetForLookup(mTimeSource.GetMonotonicTimestamp(), request);
ReturnErrorOnFailure(Dnssd::Resolver::Instance().ResolveNodeId(request.GetPeerId()));
auto & peerId = request.GetPeerId();
ReturnErrorOnFailure(Dnssd::Resolver::Instance().ResolveNodeId(peerId));
mActiveLookups.PushBack(&handle);
ReArmTimer();
ChipLogProgress(Discovery, "Lookup started for " ChipLogFormatPeerId, ChipLogValuePeerId(peerId));
return CHIP_NO_ERROR;
}

Expand Down
4 changes: 1 addition & 3 deletions src/lib/dnssd/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,7 @@ struct ResolvedNodeData
#if CHIP_PROGRESS_LOGGING
// Would be nice to log the interface id, but sorting out how to do so
// across our different InterfaceId implementations is a pain.
ChipLogProgress(Discovery, "Node ID resolved for " ChipLogFormatX64 ":" ChipLogFormatX64,
ChipLogValueX64(operationalData.peerId.GetCompressedFabricId()),
ChipLogValueX64(operationalData.peerId.GetNodeId()));
ChipLogProgress(Discovery, "Node ID resolved for " ChipLogFormatPeerId, ChipLogValuePeerId(operationalData.peerId));
resolutionData.LogDetail();
#endif // CHIP_PROGRESS_LOGGING
}
Expand Down
8 changes: 8 additions & 0 deletions src/lib/support/logging/TextOnlyLogging.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,14 @@ using LogRedirectCallback_t = void (*)(const char * module, uint8_t category, co
#define ChipLogFormatScopedNodeId "<" ChipLogFormatX64 ", %d>"
#define ChipLogValueScopedNodeId(id) ChipLogValueX64((id).GetNodeId()), (id).GetFabricIndex()

/** Logging helpers for PeerId, which is a tuple of <Compressed Fabric Id, NodeId>
*
* This gets logged in the form that's used for the DNS-SD instance name for the
* peer.
*/
#define ChipLogFormatPeerId ChipLogFormatX64 "-" ChipLogFormatX64
#define ChipLogValuePeerId(id) ChipLogValueX64((id).GetCompressedFabricId()), ChipLogValueX64((id).GetNodeId())

/**
* CHIP Logging Implementation internals.
*/
Expand Down
Loading