Skip to content

feat: relative timestamp table cell renderer and log events table in sheet #818

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

Merged
merged 38 commits into from
May 12, 2021

Conversation

itssharmasandeep
Copy link
Contributor

@itssharmasandeep itssharmasandeep commented May 4, 2021

Description

Log detail widget and log timestamp table cell renderer components

Testing

Local testing done

Checklist:

Screenshot 2021-05-07 at 7 52 36 PM

@itssharmasandeep itssharmasandeep requested a review from a team as a code owner May 4, 2021 11:22
@codecov
Copy link

codecov bot commented May 4, 2021

Codecov Report

Merging #818 (2b87274) into main (afa5bd7) will increase coverage by 0.02%.
The diff coverage is 87.23%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #818      +/-   ##
==========================================
+ Coverage   85.44%   85.46%   +0.02%     
==========================================
  Files         793      796       +3     
  Lines       16252    16299      +47     
  Branches     1932     1937       +5     
==========================================
+ Hits        13886    13930      +44     
- Misses       2334     2337       +3     
  Partials       32       32              
Impacted Files Coverage Δ
...omponents/log-events/log-events-table.component.ts 77.77% <77.77%> (ø)
...elative-timestamp-table-cell-renderer.component.ts 100.00% <100.00%> (ø)
...s/components/src/table/cells/table-cells.module.ts 100.00% <100.00%> (ø)
...d/components/log-events/log-events-table.module.ts 100.00% <100.00%> (ø)
...ed/components/span-detail/span-detail.component.ts 100.00% <100.00%> (ø)
...hared/components/span-detail/span-detail.module.ts 100.00% <100.00%> (ø)
...able/cells/data-parsers/table-cell-no-op-parser.ts 88.88% <0.00%> (+33.33%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update afa5bd7...2b87274. Read the comment docs.

@github-actions

This comment has been minimized.

import { ObservabilityTableCellType } from '../../observability-table-cell-type';

@Component({
selector: 'ht-log-timestamp-table-cell-renderer',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we decouple this from logs? This is just a general relative timestamp renderer, right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done that!!

import { LogEvent } from '../../waterfall/waterfall/waterfall-chart';

@Model({
type: 'log-detail-data-source'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure this page really needs to be a widget - I wouldn't actively avoid it, and if the work is already done it's fine - but for future pages, we really need to get out of the habit of making complex full-screen widgets.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes sense for this to be a widget so that it can go in as a full page list in the trace level view in Phase 2.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd extend the same argument to those views too though 😉 If I understand the comment/remember the screen, the trace view today is one big widget, and with this it will now have two views - the sequence and the log list, right? When we do that work, I'd make the same argument that the tabs and their contents need not be (but easily could be) dashboards.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@itssharmasandeep This is for the tab view right? don't we fetch all the details beforehand and show the tab as a normal component?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but since we're using table dashboard, so for child template we need data source, right?
Currently I am not fetching anything.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I think my comment got lost. My original comment was about the table itself - if that needed to be a dashboard (and likewise, everything downstream). The dashboards have really... evolved past how they were intended to be used. Here for example, we could just as easily remove the data source and pass the data directly to the widget - it's not providing any value if it's a custom pass through for a custom widget. (just to clarify, we don't need to change this here, but it's something we should be cognizant of as we build new screens).

As far as this data source goes, can we just reuse StaticDataSource since this one's not doing anything but unwrapping which we could do elsewhere? Or if we keep it, it shouldn't extend GraphQlDataSourceModel because it's not querying GQL.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to aaron's point.

@itssharmasandeep For the sheet/tab view, we don't necessarily need a data source/widget for child template. You can just pass any ng-template in it and it would render. For the page view, we can use the static data source like Aaron described above.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shared the details on slack

}

public getLogEventAttributeRecords(attributes: Dictionary<unknown>): ListViewRecord[] {
if (Boolean(attributes)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use isEmpty

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

import { ObservabilityTableCellType } from '../../observability-table-cell-type';

@Component({
selector: 'ht-log-timestamp-table-cell-renderer',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

this.spanStartTime = rowData.spanStartTime as number;
this.timestamp = rowData.timestamp;
this.readableDateTime =
this.timestamp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a cleaner way to do this? whats the goal here? Why do we have a time string as input here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 - please use native/our existing utils like date coercer and TImeDuration. We never should be working with the strings directly. This one, for example we could take the difference and use our duration class.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So currently we're getting a timestamp string which is in nano seconds for example 2021-05-04T12:13:55.543456T

So all this logic is done to show cell value and tooltip in an expected format.

Copy link
Contributor

@aaron-steinfeld aaron-steinfeld May 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nanos shouldn't be relevant at this level - that's why we use the ISO format, so the UI is agnostic to the unit. The timestamp should render the same as all our other timestamps, right? Using the date coercer, then the display date pipe. The new part is the relative offset between the two timestamps (log event time and span start time), which would require taking the difference between the two dates (which were both resolved via date coercer) and using our duration pipe (I'm not 100% sure that duration pipe is up to date for these requirements, but conceptually at least, that's what we should be going for)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated the new look for this in description.
Please do have a look!!

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

RowData
} from './relative-timestamp-table-cell-renderer.component';

describe('log timestamp table cell renderer component', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: relative timestamp

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed!!

import { CoreTableCellRendererType } from '../../types/core-table-cell-renderer-type';
import { TableCellAlignmentType } from '../../types/table-cell-alignment-type';

export interface RowData {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: You can do

export interface RowData extends Dictionary<unknown> {
baseTimestamp: Date | number;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, can the timestamp be string too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess, Date can handle the string, I have tested this, works fine

custom type DateOrNumber is used as type for celldata as well so I didn't want to repeat Date | number so created this type.

extends Dictionary<unknown> part is fixed!!

import { LogEvent } from '../../waterfall/waterfall/waterfall-chart';

@Model({
type: 'log-detail-data-source'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@itssharmasandeep This is for the tab view right? don't we fetch all the details beforehand and show the tab as a normal component?

@github-actions

This comment has been minimized.

Copy link
Contributor

@jake-bassett jake-bassett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM other than the comments about page vs widget, so I'll defer to others on that part.

Base automatically changed from log-icon to main May 6, 2021 16:16
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

import { Observable, of } from 'rxjs';

export const enum LogEventsTableViewType {
Sheet = 'sheet',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do need better name for this. Umm. How about Condensed for the sheet and Detailed for the page? Any other suggestions anyone?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, these names look good to me, Changed!!

if (!isEmpty(attributes)) {
return Object.entries(attributes).map((attribute: [string, unknown]) => ({
key: attribute[0],
value: attribute[1] as string | number
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we do know the type of value -> string | number. Why don't we update the type of attributes and logEvents to reflect this?

  @Input()
  public logEvents: Dictionary<string | number>[] = [];

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, made the changes.
I also don't know why I did it like this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still don't see this change though


public getLogEventAttributeRecords(attributes: Dictionary<unknown>): ListViewRecord[] {
if (!isEmpty(attributes)) {
return Object.entries(attributes).map((attribute: [string, unknown]) => ({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can also do

map( ([key, value]) => ({key: key, value: value}))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, thanks for suggestion!!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still don't see this change though

@github-actions

This comment has been minimized.

this.columnConfigs = this.getTableColumnConfigs();
}

public getLogEventAttributeRecords(attributes: Dictionary<unknown>): ListViewRecord[] {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: missing tests :)


private buildDataSource(): void {
this.dataSource = {
getData: (): Observable<TableDataResponse<TableRow>> =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we can define the type of TableRow returned from this method for clarity.

Copy link
Contributor

@anandtiwary anandtiwary left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Don't have to take care of nit comments in this pr. You can do it separately if you like.

@itssharmasandeep itssharmasandeep changed the title feat: log detail widget and log timestamp table cell renderer components feat: relative timetsmap table cell renderer and log events table in sheet May 12, 2021
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@itssharmasandeep itssharmasandeep changed the title feat: relative timetsmap table cell renderer and log events table in sheet feat: relative timestamp table cell renderer and log events table in sheet May 12, 2021
@itssharmasandeep itssharmasandeep merged commit 6a13521 into main May 12, 2021
@itssharmasandeep itssharmasandeep deleted the log-components branch May 12, 2021 06:34
@github-actions
Copy link

Unit Test Results

    4 files  ±0  252 suites  +2   15m 24s ⏱️ +51s
901 tests +2  901 ✔️ +2  0 💤 ±0  0 ❌ ±0 
907 runs  +2  907 ✔️ +2  0 💤 ±0  0 ❌ ±0 

Results for commit 6a13521. ± Comparison against base commit afa5bd7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants