forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Log Stream] Support date nanos (elastic#170308)
closes elastic#88290 ## 📝 Summary As described in elastic#88290 we need to add `date_nanos` support to the Stream UI page. In this PR the necessary changes have been made all over the Stream UI and the usages of it. ## ✅ Testing⚠️ Testing the Stream UI with old timestamp indices is important to make sure that the behavior is still as before and not affected at all. This can be done by running local env from the PR and simulating all interactions on edge-lit cluster for example, to make sure that the behavior is not changed. For testing the new changes with support of `date_nano`: 1. You can use [the steps here](elastic#88290 (comment)) to create and ingest documents with nano precision. 2. Navigate to the stream UI and the documents should be displayed properly. 3. Sync with the URL state should be changed from timestamp to ISO string date. 4. Changing time ranges should behave as before, as well as Text Highlights. 5. Open the logs flyout and you should see the timestamp in nano seconds. 6. Play around with the minimap, it should behave exactly as before. ### Stream UI: <img width="2556" alt="Screenshot 2023-11-02 at 14 15 49" src="https://github.com/elastic/kibana/assets/11225826/596966cd-0ee0-44ee-ba15-f387f3725f66"> - The stream UI has been affected in many areas: - The logPosition key in the URL should now be in ISO string, but still backward compatible incase the user has bookmarks with timestamps. - The minimap should still behave as before in terms of navigation onClick and also highlighting displayed areas ### Stream UI Flyout: <img width="2556" alt="Screenshot 2023-11-02 at 14 15 23" src="https://github.com/elastic/kibana/assets/11225826/6081533c-3bed-43e1-872d-c83fe78ab436"> - The logs flyout should now display the date in nanos format if the document is ingested using a nano format. ### Anomalies: <img width="1717" alt="Screenshot 2023-11-01 at 10 37 22" src="https://github.com/elastic/kibana/assets/11225826/b6170d76-40a4-44db-85de-d8ae852bc17e"> -Anomalies tab under logs as a navigation to stream UI which should still behave as before passing the filtration and time. ### Categories: <img width="1705" alt="Screenshot 2023-11-01 at 10 38 19" src="https://github.com/elastic/kibana/assets/11225826/c4c19202-d27f-410f-b94d-80507542c775"> -Categories tab under logs as a navigation to stream UI which should still behave as before passing the filtration and time. ### External Links To Stream: - All links to the Stream UI should still work as before: - APM Links for traces, containers, hosts - Infra links in Inventory and Hosts views ## 🎥 Demo https://github.com/elastic/kibana/assets/11225826/9a39bc5a-ba37-49e0-b7f2-e73260fb01f0
- Loading branch information
1 parent
19e43c8
commit ddc07c5
Showing
60 changed files
with
850 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import * as rt from 'io-ts'; | ||
import moment from 'moment'; | ||
import { pipe } from 'fp-ts/lib/pipeable'; | ||
import { chain } from 'fp-ts/lib/Either'; | ||
|
||
const NANO_DATE_PATTERN = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3,9}Z$/; | ||
|
||
export const DateFromStringOrNumber = new rt.Type<string, number | string>( | ||
'DateFromStringOrNumber', | ||
(input): input is string => typeof input === 'string', | ||
(input, context) => { | ||
if (typeof input === 'string') { | ||
return NANO_DATE_PATTERN.test(input) ? rt.success(input) : rt.failure(input, context); | ||
} | ||
return pipe( | ||
rt.number.validate(input, context), | ||
chain((timestamp) => { | ||
const momentValue = moment(timestamp); | ||
return momentValue.isValid() | ||
? rt.success(momentValue.toISOString()) | ||
: rt.failure(timestamp, context); | ||
}) | ||
); | ||
}, | ||
String | ||
); | ||
|
||
export const minimalTimeKeyRT = rt.type({ | ||
time: DateFromStringOrNumber, | ||
tiebreaker: rt.number, | ||
}); | ||
export type MinimalTimeKey = rt.TypeOf<typeof minimalTimeKeyRT>; | ||
|
||
const timeKeyRT = rt.intersection([ | ||
minimalTimeKeyRT, | ||
rt.partial({ | ||
gid: rt.string, | ||
fromAutoReload: rt.boolean, | ||
}), | ||
]); | ||
export type TimeKey = rt.TypeOf<typeof timeKeyRT>; | ||
|
||
export interface UniqueTimeKey extends TimeKey { | ||
gid: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.