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

feat!: replace the influx trace client with the local trace client #1279

Merged
merged 30 commits into from
Apr 8, 2024

Conversation

evan-forbes
Copy link
Member

@evan-forbes evan-forbes commented Apr 2, 2024

Description

eventually closes #1278

super breaking for the config

@evan-forbes evan-forbes added the WS: Big Blonks 🔭 Improving consensus critical gossiping protocols label Apr 2, 2024
@evan-forbes evan-forbes self-assigned this Apr 2, 2024
@evan-forbes evan-forbes marked this pull request as draft April 2, 2024 03:38
pkg/trace/local_client.go Outdated Show resolved Hide resolved
@cmwaters
Copy link
Contributor

cmwaters commented Apr 2, 2024

Are we planning on deprecating support for influx in favour of this?

config/config.go Outdated Show resolved Hide resolved
pkg/trace/local_client.go Outdated Show resolved Hide resolved
pkg/trace/local_client.go Outdated Show resolved Hide resolved
config/config.go Outdated Show resolved Hide resolved
mempool/v1/reactor.go Show resolved Hide resolved
pkg/trace/local_client.go Outdated Show resolved Hide resolved
pkg/trace/schema/consensus.go Outdated Show resolved Hide resolved
@evan-forbes evan-forbes changed the title WIP: feat!: local trace client feat!: replace the influx trace client with the local trace client Apr 3, 2024
@evan-forbes
Copy link
Member Author

config-e2e

@evan-forbes evan-forbes marked this pull request as ready for review April 3, 2024 20:37
Comment on lines 131 to 134
eventJSON, err := json.Marshal(event)
if err != nil {
return fmt.Errorf("failed to marshal event: %v", err)
}
Copy link
Member Author

Choose a reason for hiding this comment

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

thought about using csv, as that should be faster and create significantly smaller files, however the std lib csv is kinda meh tbh and I didn't want to introduce a new dep. if we're ok with using https://github.com/jszwec/csvutil , then I'm totally down.

@staheri14
Copy link
Contributor

Could you please include some guidelines on how to utilize the new tracing feature? Alternatively, if this feature is not yet operational within the current PR, an overview of the modifications made would be highly appreciated.

config/toml.go Outdated Show resolved Hide resolved
mempool/cat/reactor.go Outdated Show resolved Hide resolved
mempool/v1/reactor.go Show resolved Hide resolved
consensus/reactor.go Show resolved Hide resolved
consensus/reactor.go Show resolved Hide resolved
@evan-forbes
Copy link
Member Author

evan-forbes commented Apr 4, 2024

As I mentioned, if we only want trace data over the span of a height, this entire thing could reside in memory

true good point, however for 100MB block parts we can send and receive a combined 50_000 block parts. Still definitely doable, but noticable. We've observed in the past, for example in #1145, that we can see different problematic patterns at different heights. We might be able to recreate those scenarios in specific tests, however I think having the ability to trace everything gives us the most freedom in finding those weird edge cases

Copy link
Contributor

@staheri14 staheri14 left a comment

Choose a reason for hiding this comment

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

I've managed to review about half of the PR so far, and here are my comments based on what I've seen up to this point. Looks good in general.

config/config.go Outdated Show resolved Hide resolved
config/config.go Outdated Show resolved Hide resolved
config/config.go Outdated Show resolved Hide resolved
config/config.go Outdated Show resolved Hide resolved
config/toml.go Outdated Show resolved Hide resolved
config/toml.go Outdated Show resolved Hide resolved
pkg/trace/tracer.go Show resolved Hide resolved
pkg/trace/local_client.go Outdated Show resolved Hide resolved
pkg/trace/local_client.go Outdated Show resolved Hide resolved
pkg/trace/local_client.go Outdated Show resolved Hide resolved
## Description

Adds the pull based portion of the file server along with a simple
client.
Copy link
Contributor

@cmwaters cmwaters left a comment

Choose a reason for hiding this comment

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

lgtm (looks like there is one failing test)

Comment on lines +1273 to 1275
if cfg.TraceBufferSize < 0 {
return fmt.Errorf("trace buffer size must be greater than 0")
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can it be 0? Do we not want <=

Copy link
Member Author

Choose a reason for hiding this comment

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

technically speaking, 0 could work although ofc that's a bad idea. The reasoning for switching here was so that a value of 0 won't fail for when the default value isn't used in some tests, and that I wasn't sure where to stop. While 0 is not reccomended, neither is 1. combining those two things resulted in just switching this to 0

Copy link
Contributor

@staheri14 staheri14 left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for updating the README. I conducted a test, which allowed me to gather locally traced data. Also, I reviewed some of this data using the DecodeFile function. Left some non-blocking comments.

// V1VersionFieldValue is a tracing field value for the version of
// the mempool. This value is used by the "version" field key.
V1VersionFieldValue = "v1"
// MemPoolTx describes the schema for the "mempool_tx" table.
Copy link
Contributor

Choose a reason for hiding this comment

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

[nit]

Suggested change
// MemPoolTx describes the schema for the "mempool_tx" table.
// MempoolTx describes the schema for the "mempool_tx" table.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll grab this in a followup, thanks

# The list of tables that are updated when tracing. All available tables and
# their schema can be found in the pkg/trace/schema package. It is represented as a
# comma separate string. For example: "consensus_round_state,mempool_tx".
tracing_tables = "consensus_round_state,mempool_tx"
Copy link
Contributor

Choose a reason for hiding this comment

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

[nit] Based on my testing, this field automatically gets populated with the names of all available tables hence, I suppose there is no need for modifications unless there's a specific desire to exclude certain tables from the tracing process. If that's the case, it would indeed be helpful to clarify that it is possible to selectively skip tracing specific tables.

Copy link
Member Author

@evan-forbes evan-forbes Apr 8, 2024

Choose a reason for hiding this comment

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

I think I'm having some author blindness here 😅, so I'll defer to you on this. are you refering to the readme, or do you think the first sentence here doesn't describe that? if its the first sentence, do you think

The list of tables that are updated when tracing. Tables not included below will not be traced.

works better?

@evan-forbes evan-forbes enabled auto-merge (squash) April 8, 2024 22:05
@evan-forbes evan-forbes merged commit 63cefe4 into main Apr 8, 2024
17 of 18 checks passed
@evan-forbes evan-forbes deleted the evan/local-trace-client branch April 8, 2024 22:35
@evan-forbes
Copy link
Member Author

also, thanks @staheri14 for manually trying out the code!!! 😃

evan-forbes added a commit that referenced this pull request Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WS: Big Blonks 🔭 Improving consensus critical gossiping protocols
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create a more performant tracer for a network wide trace
3 participants