Skip to content

Commit

Permalink
Log the enableDiscovery flag (#10104)
Browse files Browse the repository at this point in the history
* Add the enableRouting flag

* Resolve comments for log format

* Add dummy line

* Remove extra line
  • Loading branch information
tianzhu007 authored Apr 29, 2022
1 parent 1156196 commit 6dcdab1
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ export function create(
// Protocol state
const { sequenceNumber, values, generateToken = false } = request.body;

const enableDiscovery: boolean = request.body.enableDiscovery ?? false;

const createP = storage.createDocument(
tenantId,
id,
Expand All @@ -102,9 +104,8 @@ export function create(
crypto.randomBytes(4).toString("hex"),
ordererUrl,
historianUrl,
values);

const enableDiscovery: boolean = request.body.enableDiscovery ?? false;
values,
enableDiscovery);

// Handle backwards compatibility for older driver versions.
// TODO: remove condition once old drivers are phased out and all clients can handle object response
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export async function getSession(ordererUrl: string,

// The tempSession.isSessionAlive would be updated as whether the session was alive before the request came.
tempSession.isSessionAlive = isSessionAlive;
Lumberjack.info(`Returning the session: ${JSON.stringify(tempSession)}`, lumberjackProperties);
Lumberjack.info(`Returning the session from the discovery: ${JSON.stringify(tempSession)}`,
lumberjackProperties);
return tempSession;
}
3 changes: 2 additions & 1 deletion server/routerlicious/packages/services-core/src/document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ export interface IDocumentStorage {
initialHash: string,
ordererUrl: string,
historianUrl: string,
values: [string, ICommittedProposal][]): Promise<IDocumentDetails>;
values: [string, ICommittedProposal][],
enableDiscovery: boolean): Promise<IDocumentDetails>;
}

export interface IClientSequenceNumber {
Expand Down
6 changes: 4 additions & 2 deletions server/routerlicious/packages/services-shared/src/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ export class DocumentStorage implements IDocumentStorage {
ordererUrl: string,
historianUrl: string,
values: [string, ICommittedProposal][],
enableDiscovery: boolean = false,
): Promise<IDocumentDetails> {
const tenant = await this.tenantManager.getTenant(tenantId, documentId);
const gitManager = tenant.gitManager;
Expand Down Expand Up @@ -197,8 +198,9 @@ export class DocumentStorage implements IDocumentStorage {
isSessionAlive: true,
};

winston.info(`Session: ${JSON.stringify(session)}`, { messageMetaData });
Lumberjack.info(`Session: ${JSON.stringify(session)}`, lumberjackProperties);
const message: string = `Create session with enableDiscovery as ${enableDiscovery}: ${JSON.stringify(session)}`;
winston.info(message, { messageMetaData });
Lumberjack.info(message, lumberjackProperties);

const collection = await this.databaseManager.getDocumentCollection();
const result = await collection.findOrCreate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export class TestDocumentStorage implements IDocumentStorage {
ordererUrl: string,
historianUrl: string,
values: [string, ICommittedProposal][],
enableDiscovery: boolean = false,
): Promise<IDocumentDetails> {
const tenant = await this.tenantManager.getTenant(tenantId, documentId);
const gitManager = tenant.gitManager;
Expand Down

0 comments on commit 6dcdab1

Please sign in to comment.