Skip to content
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

Result of typeof(this) is presented as "[object Object]" #1725

Closed
philrz opened this issue Jun 25, 2021 · 1 comment · Fixed by #1732
Closed

Result of typeof(this) is presented as "[object Object]" #1725

philrz opened this issue Jun 25, 2021 · 1 comment · Fixed by #1732
Assignees
Milestone

Comments

@philrz
Copy link
Contributor

philrz commented Jun 25, 2021

Repro is with Brim commit 4cb8e61 which uses Zed commit e17ba2f.

Back in the last Brim GA release v0.24.0 and up until right before the merge of #1589, type definitions returned by typeof(.) (now typeof(this) is preferred) were shown in the app. Granted, they were mere strings, but it still provided a starting point for type exploration. An example with the Zeek zed-sample-data in v0.24.0:

Then starting with Brim commit 6078840 (associated with the merge of #1589) this stopped working. At first it started showing the typeof:type, then a short while later at Brim commit f7dabb8 (associated with the merge of #1603) and since then on up to current Brim commit 4cb8e61, it's showing [object Object].

My recollection is that one of the expected follow-ons from #1603 would be to make use of the granular typing information now being returned from the backend to print the type definitions with more structure than they were in the past. Perhaps this is still on the to-do list, and I respect that a comprehensive design & UX might be a significant undertaking. However, in looking toward assembling the next GA Brim release, we've already started encouraging Zed users to look at typeof(this) as part of exploring their data, so users are likely to bump into this after working with Zed at the CLI and then trying the same in the app, and hence would likely see this as a bug/regression.

Short of doing something fancy, is there a low cost way to bring back something minimal for MVP0, e.g., even as minimal as the former string-like presentation?

@philrz
Copy link
Contributor Author

philrz commented Jul 8, 2021

Verified in Brim commit 5ad9404.

Now the type definition is back to looking essentially the way it was before, though I see it now is wrapped in parens.

As noted by @jameskerr in the linked PR, this use of parens seems to match zq's presentation, though I'm not sure if this represents "wrapping" that should have been stripped, similar to how the quotes of the string-typed path values show up in zq output but not in the app. I'll take up this topic separately with the team.

$ zq -z 'count() by _path,typeof(this)' *
{_path:"ntp",typeof:({_path:string,ts:time,uid:bstring,id:{orig_h:ip,orig_p:port=(uint16),resp_h:ip,resp_p:port},version:uint64,mode:uint64,stratum:uint64,poll:duration,precision:duration,root_delay:duration,root_disp:duration,ref_id:bstring,ref_time:time,org_time:time,rec_time:time,xmt_time:time,num_exts:uint64}),count:904 (uint64)} (=0)
{_path:"pe",typeof:({_path:string,ts:time,id:bstring,machine:bstring,compile_ts:time,os:bstring,subsystem:bstring,is_exe:bool,is_64bit:bool,uses_aslr:bool,uses_dep:bool,uses_code_integrity:bool,uses_seh:bool,has_import_table:bool,has_export_table:bool,has_cert_table:bool,has_debug_data:bool,section_names:[bstring]}),count:21} (0)
...

Thanks @jameskerr!

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 a pull request may close this issue.

3 participants