-
Notifications
You must be signed in to change notification settings - Fork 918
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
Enable UI Metric Collector #6203
Changes from all commits
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 |
---|---|---|
|
@@ -313,3 +313,7 @@ | |
|
||
# Set the value to true to enable workspace feature | ||
# workspace.enabled: false | ||
|
||
# Set the value to true to enable Ui Metric Collectors in Usage Collector | ||
# This publishes the Application Usage and UI Metrics into the saved object, which can be accessed by /api/stats?extended=true&legacy=true&exclude_usage=false | ||
# usageCollection.uiMetric.enabled: false | ||
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. Do you have a chance to try this feature flag? I saw that warning in the local.
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. Thanks @Flyingliuhub for spotting the error. This issue is not related to my current change rather can also be found in the current main branch. I have found the root cause of the issue and have included a fix with this PR. How to reproduce this issue?
Root Cause: It was currently trying to find index field within kibana section of config however this information is present within opensearchDashboards section of config. Changing the path has helped to resolve the issue. Config: Why was it not noticed till now? 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. @LDrago27 can you create a new issue for this? 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. Sure. #6376 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,20 +38,20 @@ interface AnalyicsReporterConfig { | |
} | ||
|
||
export function createReporter(config: AnalyicsReporterConfig): Reporter { | ||
const { localStorage, debug } = config; | ||
const { localStorage, debug, fetch } = config; | ||
|
||
return new Reporter({ | ||
debug, | ||
storage: localStorage, | ||
// async http(report) { | ||
// const response = await fetch.post('/api/ui_metric/report', { | ||
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. @ashwin-pc Do you know the reason why it was commented out previously? Is it related to a performance issue? 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. I tried to hunt down he history here, but it looks like anything that seemed to send telemetry data was commented out during the fork out of caution and this was one of those. @kavilla can provide more context here but I doubt this had anything to do with performance since this does not add any significant overhead to the node server or its heap. If you can point me to any resources about that performance issue, we can try reproducing it to make sure that performance isnt impacted because of it. But otherwise i hope to merge this in sooner so that we can use the bake time to weed out any performance issues earlier on (if any) 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. Collecting telemetry won't cause a load issue. Actually, when there are too many UI activities/requests to update the saved object, that can cause a significant load to OpenSearch How about conduct some performance tests to collect baseline data so we could inform the customer about the performance impact (not OSD, but the target OpenSearch). We don't need too many tests; as minimal set, 1 concurrent user and 10 concurrent users, with each user potentially generating 1 UI event per second. Understand that we might not have a performance test setup as part of CI. However, could we at least run some one-time tests to understand the baseline. Another approach is to make it experimental (reminding users to enable it on the production environment at their own risk) if they want to enjoy this benefit. As long as we don't introduce one-way door decisions, it is controllable behind a feature flag, and then it is up to the user to make the call. 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. @seraphjiang @ashwin-pc Thanks for bringing up the point. UI metrics generated aren't saved immediately to the saved object, rather are batched in intervals and saved. If you are currently on a single page the metrics are batched in every 90s interval and then saved, however if you switch across pages the metrics gets saved at that the timestamp when the switch takes place. Therefore we have client side batching present. However we don't have any server side batching while we are saving the Ui metrics into the saved object. We will have a subsequent PR to resolve this issue which is currently being tracked by this Issue #6375. In the meanwhile the above changes are being guarded by the feature flag which is disabled by default. |
||
// body: JSON.stringify({ report }), | ||
// }); | ||
async http(report) { | ||
const response = await fetch.post('/api/ui_metric/report', { | ||
body: JSON.stringify({ report }), | ||
}); | ||
|
||
// if (response.status !== 'ok') { | ||
// throw Error('Unable to store report.'); | ||
// } | ||
// return response; | ||
// }, | ||
if (response.status !== 'ok') { | ||
throw Error('Unable to store report.'); | ||
} | ||
return response; | ||
}, | ||
}); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -151,7 +151,7 @@ export function getUsageCollector( | |
type: VEGA_USAGE_TYPE, | ||
isReady: () => true, | ||
fetch: async (callCluster: LegacyAPICaller) => { | ||
const { index } = (await config.pipe(first()).toPromise()).kibana; | ||
const { index } = (await config.pipe(first()).toPromise()).opensearchDashboards; | ||
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. nice catch |
||
|
||
return await getStats(callCluster, index, dependencies); | ||
}, | ||
|
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.
Let's call our this might cause permission issue to OpenSearch. turn on with caution
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.
Updated the comments