-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[Reporting] Add context to logging about Space ID handling #80106
Changes from all commits
372ea5d
e293e9d
0f7b13a
d87c014
5fd2a19
cdf6514
c7bd5ca
bfe0775
fac1ddb
e8cbdb5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -195,21 +195,21 @@ export class ReportingCore { | |
return scopedUiSettingsService; | ||
} | ||
|
||
public getSpaceId(request: KibanaRequest): string | undefined { | ||
public getSpaceId(request: KibanaRequest, logger = this.logger): string | undefined { | ||
const spacesService = this.getPluginSetupDeps().spaces?.spacesService; | ||
if (spacesService) { | ||
const spaceId = spacesService?.getSpaceId(request); | ||
|
||
if (spaceId !== DEFAULT_SPACE_ID) { | ||
this.logger.info(`Request uses Space ID: ` + spaceId); | ||
logger.info(`Request uses Space ID: ${spaceId}`); | ||
return spaceId; | ||
} else { | ||
this.logger.info(`Request uses default Space`); | ||
logger.debug(`Request uses default Space`); | ||
} | ||
} | ||
} | ||
|
||
public getFakeRequest(baseRequest: object, spaceId?: string) { | ||
public getFakeRequest(baseRequest: object, spaceId: string | undefined, logger = this.logger) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Even though a logger is always passed in, I wanted to allow So, it might not seem important to keep the private |
||
const fakeRequest = KibanaRequest.from({ | ||
path: '/', | ||
route: { settings: {} }, | ||
|
@@ -221,19 +221,19 @@ export class ReportingCore { | |
const spacesService = this.getPluginSetupDeps().spaces?.spacesService; | ||
if (spacesService) { | ||
if (spaceId && spaceId !== DEFAULT_SPACE_ID) { | ||
this.logger.info(`Generating request for space: ` + spaceId); | ||
logger.info(`Generating request for space: ${spaceId}`); | ||
this.getPluginSetupDeps().basePath.set(fakeRequest, `/s/${spaceId}`); | ||
} | ||
} | ||
|
||
return fakeRequest; | ||
} | ||
|
||
public async getUiSettingsClient(request: KibanaRequest) { | ||
public async getUiSettingsClient(request: KibanaRequest, logger = this.logger) { | ||
const spacesService = this.getPluginSetupDeps().spaces?.spacesService; | ||
const spaceId = this.getSpaceId(request); | ||
const spaceId = this.getSpaceId(request, logger); | ||
if (spacesService && spaceId) { | ||
this.logger.info(`Creating UI Settings Client for space: ${spaceId}`); | ||
logger.info(`Creating UI Settings Client for space: ${spaceId}`); | ||
} | ||
const savedObjectsClient = await this.getSavedObjectsClient(request); | ||
return await this.getUiSettingsServiceFactory(savedObjectsClient); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find it better for this recently added log line to be debug rather than info.