-
Notifications
You must be signed in to change notification settings - Fork 3
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
Summarize report as HTML: the gin is out of the bottle #87
Conversation
Signed-off-by: Rohit Nayak <[email protected]>
Signed-off-by: Rohit Nayak <[email protected]>
…alled json. Change map key from ColumnInformation to a string representation so it can be marshalled. Fix tests. Code for launching summary is WIP Signed-off-by: Rohit Nayak <[email protected]>
Signed-off-by: Rohit Nayak <[email protected]>
Signed-off-by: Rohit Nayak <[email protected]>
Signed-off-by: Rohit Nayak <[email protected]>
Signed-off-by: Rohit Nayak <[email protected]>
Signed-off-by: Rohit Nayak <[email protected]>
Signed-off-by: Rohit Nayak <[email protected]>
Signed-off-by: Rohit Nayak <[email protected]>
Signed-off-by: Rohit Nayak <[email protected]>
06667ee
to
79e718d
Compare
Signed-off-by: Rohit Nayak <[email protected]>
Signed-off-by: Rohit Nayak <[email protected]>
Signed-off-by: Rohit Nayak <[email protected]>
RunE: func(_ *cobra.Command, _ []string) error { | ||
if port > 0 { | ||
if webserverStarted { | ||
return nil | ||
} | ||
webserverStarted = true | ||
go startWebServer(port, ch) | ||
<-ch | ||
} | ||
return nil | ||
}, |
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.
I am not sure I understand why the web server is called in the root command (and thus for all other commands). We could instead do something similar to what we did for the graphs where we only spin up the web server at the end of summarize when the *Summary
object is constructed. That way the logic would be local to summarize and the web server will be created at a time where we already have all the information we wish to render.
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.
However, I don't necessarily think we need to change this in this PR. We can change it in a subsequent PR if we want.
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.
The reason to do it globally is that I was not sure if we wanted to extend the usage of the web server for other purposes, so kept it global. I added the Home/About pages to give a trivial example of what is possible.
I think as we progress we will be persisting state of previous runs and then this website can serve as a way to look at them. Also we should move the graphing to be part of this ...
go/summarize/force-graph.go
Outdated
@@ -40,7 +40,7 @@ type ( | |||
Value int `json:"value"` | |||
Type string `json:"type"` | |||
Curvature float64 `json:"curvature"` | |||
Predicates []string `json:"predicates"` | |||
Predicates []string `json:"Predicates"` |
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.
any reason for this change?
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.
Predicates []string `json:"Predicates"` | |
Predicates []string `json:"predicates"` |
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.
oh, that is probably a Refactor/Rename issue. Will change
func writeToTempFile(summaryJSON []byte) (*os.File, error) { | ||
tmpFile, err := os.CreateTemp("/tmp/", "vt-summary-*.json") | ||
if err != nil { | ||
fmt.Println("Error creating temp file:", err) | ||
return nil, err | ||
} | ||
return s, nil | ||
defer tmpFile.Close() | ||
|
||
_, err = tmpFile.WriteString(string(summaryJSON)) | ||
if err != nil { | ||
fmt.Println("Error writing to temp file:", err) | ||
return nil, err | ||
} | ||
|
||
return tmpFile, err | ||
} |
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.
Yeah I think we could avoid this step by creating and starting the web server directly from here instead of creating temporary files that will be used by the server created beforehand. Moving the logic here will give us more control over what and how we render.
go/transactions/README.md
Outdated
@@ -102,24 +102,24 @@ Each object in the query-signatures array represents a generalized query and inc | |||
* op: The operation type (e.g., "insert", "update", "delete"). | |||
* affected_table: The table affected by the query. | |||
* updated_columns: (Only for update operations) An array of column names that are updated by the query. | |||
* predicates: An array of conditions (also known as predicates) used in the query’s WHERE clause. Each predicate abstracts the condition to focus on the pattern rather than specific values. Not all predicates are included in the query signature; only those that could be used by the planner to select if the transaction is a single shard or a distributed transaction. | |||
* Predicates: An array of conditions (also known as Predicates) used in the query’s WHERE clause. Each predicate abstracts the condition to focus on the pattern rather than specific values. Not all Predicates are included in the query signature; only those that could be used by the planner to select if the transaction is a single shard or a distributed transaction. |
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.
* Predicates: An array of conditions (also known as Predicates) used in the query’s WHERE clause. Each predicate abstracts the condition to focus on the pattern rather than specific values. Not all Predicates are included in the query signature; only those that could be used by the planner to select if the transaction is a single shard or a distributed transaction. | |
* predicates: An array of conditions (also known as predicates) used in the query’s WHERE clause. Each predicate abstracts the condition to focus on the pattern rather than specific values. Not all predicates are included in the query signature; only those that could be used by the planner to select if the transaction is a single shard or a distributed transaction. |
go/transactions/README.md
Outdated
|
||
```json | ||
"predicates": [ | ||
"Predicates": [ |
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.
"Predicates": [ | |
"predicates": [ |
go/transactions/README.md
Outdated
|
||
### Example Explained | ||
|
||
Consider the following predicates array: | ||
Consider the following Predicates array: |
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.
Consider the following Predicates array: | |
Consider the following predicates array: |
go/transactions/README.md
Outdated
* table: The name of the table referenced in the condition. | ||
* col: The column name used in the condition. | ||
* op: A code representing the comparison operator used in the condition. For example: | ||
- 0 might represent the "=" operator. | ||
- Other numbers might represent different operators like <, >, LIKE, etc. | ||
* val: A generalized placeholder value used in the condition. Instead of showing specific values, placeholders are used to indicate where values are compared. Identical placeholders across different predicates suggest that the same variable or parameter is used. -1 is a special value that indicates a unique value used only by this predicate. | ||
* val: A generalized placeholder value used in the condition. Instead of showing specific values, placeholders are used to indicate where values are compared. Identical placeholders across different Predicates suggest that the same variable or parameter is used. -1 is a special value that indicates a unique value used only by this predicate. |
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.
* val: A generalized placeholder value used in the condition. Instead of showing specific values, placeholders are used to indicate where values are compared. Identical placeholders across different Predicates suggest that the same variable or parameter is used. -1 is a special value that indicates a unique value used only by this predicate. | |
* val: A generalized placeholder value used in the condition. Instead of showing specific values, placeholders are used to indicate where values are compared. Identical placeholders across different predicates suggest that the same variable or parameter is used. -1 is a special value that indicates a unique value used only by this predicate. |
go/transactions/README.md
Outdated
|
||
#### Inside Each Predicate | ||
|
||
Each predicate object in the predicates array includes: | ||
Each predicate object in the Predicates array includes: |
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.
Each predicate object in the Predicates array includes: | |
Each predicate object in the predicates array includes: |
go/transactions/README.md
Outdated
@@ -39,7 +39,7 @@ The output JSON file contains an array of transaction patterns, each summarizing | |||
"updated_columns": [ | |||
"apa" | |||
], | |||
"predicates": [ | |||
"Predicates": [ |
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.
"Predicates": [ | |
"predicates": [ |
go/transactions/README.md
Outdated
@@ -60,7 +60,7 @@ The output JSON file contains an array of transaction patterns, each summarizing | |||
"updated_columns": [ | |||
"monkey" | |||
], | |||
"predicates": [ | |||
"Predicates": [ |
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.
"Predicates": [ | |
"predicates": [ |
go/transactions/README.md
Outdated
@@ -138,7 +138,7 @@ Consider the following predicates array: | |||
* The first predicate represents a condition on tblA.foo, using the operator code 0 (e.g., "="), with a generalized value 0. | |||
* The second predicate represents a condition on tblA.id, also using the operator code 0, with a generalized value -1. That means that this value was only used by this predicate and not shared by any other queries in the transaction. | |||
|
|||
This numbering helps identify the relationships between different predicates in the transaction patterns and can be used to help guide choices in sharding strategies. | |||
This numbering helps identify the relationships between different Predicates in the transaction patterns and can be used to help guide choices in sharding strategies. |
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.
This numbering helps identify the relationships between different Predicates in the transaction patterns and can be used to help guide choices in sharding strategies. | |
This numbering helps identify the relationships between different predicates in the transaction patterns and can be used to help guide choices in sharding strategies. |
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.
Only comment is /Predicate/predicate/
otherwise looks good to me! 🙇🏻
Signed-off-by: Rohit Nayak <[email protected]>
Todos:
Future PRs: