Skip to content

Commit

Permalink
[infra] telemetry can be undefined (elastic#175036)
Browse files Browse the repository at this point in the history
## Summary

Closes elastic#175026

Telemetry service can be undefined when source is loaded from non-infra
plugin context

### Testing
- create a metric rule
- fields can be loaded and preview graph is showing in the metric
creation panel
  • Loading branch information
klacabane authored and CoenWarmer committed Feb 15, 2024
1 parent 907120d commit 7dd7d80
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const useSource = ({ sourceId }: { sourceId: string }) => {
const response = await fetchService.fetch<MetricsSourceConfigurationResponse>(API_URL, {
method: 'GET',
});
telemetry.reportPerformanceMetricEvent(
telemetry?.reportPerformanceMetricEvent(
'infra_source_load',
performance.now() - start,
{},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const useHostsView = () => {
}
);
const duration = performance.now() - start;
telemetry.reportPerformanceMetricEvent(
telemetry?.reportPerformanceMetricEvent(
'infra_hosts_table_load',
duration,
{ key1: 'data_load', value1: duration },
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/infra/public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export interface InfraClientStartDeps {
uiActions: UiActionsStart;
unifiedSearch: UnifiedSearchPublicPluginStart;
usageCollection: UsageCollectionStart;
telemetry: ITelemetryClient;
telemetry?: ITelemetryClient;
fieldFormats: FieldFormatsStart;
licensing: LicensingPluginStart;
}
Expand Down

0 comments on commit 7dd7d80

Please sign in to comment.