You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[chore] [exporter/clickhouseexporter] full refactor for ClickHouse component (#40536)
#### Description
This PR intends to reorganize the code of the exporter without making
any user-facing changes to the behavior or config. The goal is to make
it more maintainable and revise all previous changes into one cohesive
component.
Apologies in advance for the many changes, but I wanted this to be
runnable so we can merge it into main. **Let me know if we need to split
anything out, or make any changes.**
Notable changes:
- All `clickhouse-go` database calls now use the library's native Go
interface instead of the `database/sql` interface. This is more
efficient and easier to configure + test. There was a lot of overhead in
converting from `database/sql` to the driver's native structures, so
this has a performance benefit as well as more idiomatic code.
- Files have been reorganized so that code is in a more logical and easy
to find place. (For example, there were some shared functions inside the
`exporter_logs.go` file, even though it was unrelated to logs)
- SQL is no longer written inside the `.go` file, and is now using
`go:embed` to embed it from a directory of files.
- Moved generic code to the `internal` package to simplify the top level
package's exports.
- Optimized insert code for logs/traces to be more CPU efficient (there
were some redundant calls for converting attributes to `map`, wasting
CPU).
See testing section below for notes on test changes.
#### Testing
- Mocked database tests were replaced with full integration tests for
logs, traces, and metrics.
- Integration test share the same test container, ensuring quicker
testing (no more starting several containers for simple query tests)
- Preserved `goleak` checks for integration tests (and unit tests)
- Integration tests were split into multiple files (these are in
`*_integration_test.go` files)
- Unit tests are separate from the integration tests (these are in the
usual `_test.go` files)
- Added tests for new functions/cases
- Removed irrelevant/unhelpful tests
0 commit comments