-
Notifications
You must be signed in to change notification settings - Fork 203
Add new extension yagp hooks collector #1629
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
Open
leborchuk
wants to merge
126
commits into
apache:main
Choose a base branch
from
open-gpdb:mergeYagpHooks
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+7,773
−9
Open
Changes from all commits
Commits
Show all changes
126 commits
Select commit
Hold shift + click to select a range
cff1cf7
Initial commit: completely useless yet
Smyatkin-Maxim 00d0798
Add .gitignore
Smyatkin-Maxim a7c6387
Simple Executor{Start,Finish} logging
Smyatkin-Maxim 8b302a2
Add GRPC into Makefile and some prototype senders
Smyatkin-Maxim 2d9eaea
Make ExecuteStart and ExecuteFinish work (partially)
Smyatkin-Maxim e5a2fd5
Implement QueryInfo generation
Smyatkin-Maxim 69dcbfd
Better protobuf filling code
Smyatkin-Maxim 11dabf1
Fix segfault in plan text generator
Smyatkin-Maxim a7a6db8
Add support of spill info and
Smyatkin-Maxim 92bc2fb
Sync with proto changes + generate normalized query and plan texts
Smyatkin-Maxim 2157ed9
Implement the rest of statistics
Smyatkin-Maxim 933fe68
Use llvm code style
Smyatkin-Maxim 22a602f
Trace events using query_info_collect_hook
Smyatkin-Maxim 0e35522
Fix two segfaults
Smyatkin-Maxim e49a598
Don't call hooks from UTILITY mode and increase grpc timeout
Smyatkin-Maxim 06b6e0b
More improvements to metrics collector
Smyatkin-Maxim f4a5878
Add debian package configuration
Smyatkin-Maxim b5446ab
Try older grpcpp headers for bionic builds
Smyatkin-Maxim 10c3c86
Add missing greenplum nodes to pg_stat_statements
Smyatkin-Maxim c866e5b
Move query stats reporting to ExecutorEnd hook
Smyatkin-Maxim bb6aed4
Change GRPC failure handling
Smyatkin-Maxim 95d4a39
Track CDB metrics and track query nesting
Smyatkin-Maxim 5609141
Change package name
Smyatkin-Maxim 02b53c5
Skip nested and utility statements
Smyatkin-Maxim d640cfc
Slightly rework query skipping
Smyatkin-Maxim 2384337
Get resource groups back into query info
Smyatkin-Maxim 8d2d5ee
Add some configuration parameters
Smyatkin-Maxim f1acf98
Capture query execution system stats instead of whole process lifetime
Smyatkin-Maxim c94dd1d
Don't rethrow errors from metrics collector
Smyatkin-Maxim 61b9273
Add forgotten hooks deinitialization
Smyatkin-Maxim 0070c3f
Misc: use modern style error messages
Smyatkin-Maxim c67de87
Fix EventSender and GrpcConnector in forks
Smyatkin-Maxim abd9f22
Set ya-grpc as a dependency
Smyatkin-Maxim 8944d7e
Fix memory leak in analyze code
Smyatkin-Maxim 396d811
Add motion and workfile stats
Smyatkin-Maxim fc43eb5
Mute all PG-related signals in reconnection thread
Smyatkin-Maxim 5fd6f36
Move debian configuration to teamcity
Smyatkin-Maxim ce93949
Move logs from psql to log file
Smyatkin-Maxim af25547
Some hardening around memory
Smyatkin-Maxim 446c58a
Remove thread unsafe logging
Smyatkin-Maxim 1299852
Dirty hack: make queryid eq planid
Smyatkin-Maxim 0562fea
Remove dead code and catch thread exception
Smyatkin-Maxim 8412300
Add GUC to filter specific users
Smyatkin-Maxim da46c27
Several fixes to user filtering
Smyatkin-Maxim 7840dcb
Minor naming improvement
Smyatkin-Maxim 5287681
Add server-side message queueing
Smyatkin-Maxim 55a0eca
Moving to protobuf, part 1: remove GRPC
Smyatkin-Maxim b1a2c12
Add clang-format
Smyatkin-Maxim 4f84185
Moving to protobuf, part2: initial implementation
Smyatkin-Maxim 5ea67ec
Use deprecated protobuf API for bionic compatibility
Smyatkin-Maxim 424b3bd
Replace message queue with incremental message
Smyatkin-Maxim 960d549
Fix bug with missing query statuses
Smyatkin-Maxim 585097e
Add runtime statistics on UDS messages
Smyatkin-Maxim f8cddb0
Move query msg cleanup to the right place
Smyatkin-Maxim 6ffe3e1
Finalize query msg in DONE hook
Smyatkin-Maxim fee9b00
Fix some memory leaks
Smyatkin-Maxim 2a9128a
Enable honest query_id collection
Smyatkin-Maxim f0b5e4b
Get resource group from current session
Smyatkin-Maxim 831a83d
Added support for nested queries
Smyatkin-Maxim b7c57a6
Trim long text fields
Smyatkin-Maxim 945118f
Report error messages for failed queries
Smyatkin-Maxim 45014d9
Don't track the CANCELLING event
Smyatkin-Maxim ff28f14
Properly send runtime metrics on CANCEL/ERROR
Smyatkin-Maxim 0f0b821
Allow anyone to disable report_nested_queries
Smyatkin-Maxim 5254e40
Diff stats between executor start and end
Smyatkin-Maxim 6979f95
Fix try/catch block when calling cpp code
Smyatkin-Maxim 9bee734
Don't normalize trimmed plans
Smyatkin-Maxim b7e496f
Clean up forgotten text fields
Smyatkin-Maxim 6a99e3f
[MDB-31938] Send nested queries only from master
Smyatkin-Maxim cdd2a5c
[MDB-31936] Add slice info
Smyatkin-Maxim b76c43b
Send nested queries summary stats from segments
Smyatkin-Maxim f8bcb85
[Refactoring] Split EventSender into submodules
Smyatkin-Maxim 99aa17f
Ignore EXPLAIN VERBOSE errors
Smyatkin-Maxim 3dbafff
Add support for per-slice interconnect statistics
Smyatkin-Maxim a0f4c33
Don't rely on IC hook for compilation
Smyatkin-Maxim 85f2f32
fix: propagate ignored users on update
NJrslv 0005ad0
propagate ignored users only when executor starts
NJrslv d3963c8
refactor
NJrslv c7d827f
fix ub in strcpy
NJrslv 2b993d3
Add EXPLAIN ANALYZE metrics collection
NJrslv d9666d7
correct expand var
NJrslv ed603e0
parallel makefile & move link flags (#8)
NJrslv 55f691f
fix mem leak
NJrslv 45638c3
add safe cpp wrappers around pg funcs
NJrslv 304d36a
log actual err msg & templatize code & make free noexcept
NJrslv 6d5769f
change namespace name to avoid conflicts with gpos
NJrslv 83b8b16
move template to .cpp
NJrslv 45aced6
add metrics desc
NJrslv 869c5ea
clear
NJrslv d6173b0
Fix missing states (utility statements included) (#16)
NJrslv cdf9ff5
fix cpp & pg memleak
NJrslv 5af0b20
report bug queries at the end of extension (#19)
NJrslv 647c2aa
fix defs & trim spaces (#21)
NJrslv 30218a5
Add PG alike tests (#20)
NJrslv 89b89aa
send analyze in text & enable it (#22)
NJrslv 208366d
clean (#23)
NJrslv 661caff
report utility stmt (#24)
NJrslv c808eba
Trim utf8 (#25)
NJrslv b4c9cbd
[yagp_hooks_collector] Port workfile stats from gpdb
NJrslv 97b876f
[yagp_hooks_collector] Port YagpQueryState from gpdb
NJrslv f1eea80
[yagp_hooks_collector] Use updated names and func's interfaces
NJrslv cd90491
[yagp_hooks_collector] Del redundant funcs
NJrslv 8eace77
[yagp_hooks_collector] Change test functions to SRF
NJrslv 9c4029e
[yagp_hooks_collector] Change test out for part tbl
NJrslv 577ad15
[yagp_hooks_collector] Add CI test and with option
NJrslv 5b9fd6c
[yagp_hooks_collector] Change greenplum_path.sh to cloudberry-env.sh
NJrslv 6c2f8bd
[yagp_hooks_collector] Add comments for func args
NJrslv 211b33e
[yagp_hooks_collector] Correct tokens from gram.y
NJrslv 19a5811
[yagp_hooks_collector] Add consistent filtering
NJrslv 7605825
[yagp_hooks_collector] Add submit & done hooks
NJrslv d17e3e3
[yagp_hooks_collector] Add test for UDS sending
NJrslv fb8688d
[yagp_hooks_collector] Correct add of bytes sent
NJrslv 1befa6d
[yagp_hooks_collector] Refactor
NJrslv fd7b874
[yagp_hooks_collector] Make gen of norm plan/query noexcept
NJrslv 8fe91a1
[yagp_hooks_collector] Fix warnings and error them
NJrslv 2184c9f
[yagp_hooks_collector] Add licence
NJrslv 291fea9
[yagp_hooks_collector] Fix null edata access (#22)
NJrslv c446926
Move hooks collector files to the gpcontrib
392cde8
Merge branch 'main' into mergeYagpHooks
leborchuk 4e3f37e
Merge branch 'main' into mergeYagpHooks
leborchuk 6e5fe07
[gp_stats_collector] Rename yagp_hooks_collector to gp_stats_collector
NJrslv f603afb
[gp_stats_collector] Restore erroneously deleted line
NJrslv 105247a
[gp_stats_collector] Restore .gitignore
NJrslv 56ddf24
[gp_stats_collector] Delete gmon.out
NJrslv f851971
[gp_stats_collector] Simplify Makefile
NJrslv b2028b4
[gp_stats_collector] Add -Wno-unused-but-set-variable to PG_CXXFLAGS …
NJrslv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -73,4 +73,4 @@ lib*.pc | |
| /compile_commands.json | ||
| /tmp_install/ | ||
| /.cache/ | ||
| /install/ | ||
| /install/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| BasedOnStyle: LLVM | ||
| SortIncludes: false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| *.o | ||
| *.so | ||
| src/protos/ | ||
| .vscode | ||
| compile_commands.json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| MODULE_big = gp_stats_collector | ||
| EXTENSION = gp_stats_collector | ||
| DATA = $(wildcard *--*.sql) | ||
| REGRESS = gpsc_cursors gpsc_dist gpsc_select gpsc_utf8_trim gpsc_utility gpsc_guc_cache gpsc_uds gpsc_locale | ||
|
|
||
| PROTO_BASES = gpsc_plan gpsc_metrics gpsc_set_service | ||
| PROTO_OBJS = $(patsubst %,src/protos/%.pb.o,$(PROTO_BASES)) | ||
|
|
||
| C_OBJS = $(patsubst %.c,%.o,$(wildcard src/*.c src/*/*.c)) | ||
| CPP_OBJS = $(patsubst %.cpp,%.o,$(wildcard src/*.cpp src/*/*.cpp)) | ||
| OBJS = $(C_OBJS) $(CPP_OBJS) $(PROTO_OBJS) | ||
|
|
||
| PG_CXXFLAGS += -Werror -Wall -Wno-unused-but-set-variable -std=c++17 -Isrc/protos -Isrc -Iinclude -DGPBUILD | ||
| SHLIB_LINK += -lprotobuf -lstdc++ | ||
| EXTRA_CLEAN = src/protos | ||
|
|
||
| ifdef USE_PGXS | ||
| PG_CONFIG = pg_config | ||
| PGXS := $(shell $(PG_CONFIG) --pgxs) | ||
| include $(PGXS) | ||
| else | ||
| subdir = gpcontrib/gp_stats_collector | ||
| top_builddir = ../.. | ||
| include $(top_builddir)/src/Makefile.global | ||
| include $(top_srcdir)/contrib/contrib-global.mk | ||
| endif | ||
|
|
||
| src/protos/.done: $(wildcard protos/*.proto) | ||
| @mkdir -p src/protos | ||
| protoc -I /usr/include -I /usr/local/include -I . --cpp_out=src $^ | ||
| for f in src/protos/*.pb.cc; do mv "$$f" "$${f%.cc}.cpp"; done | ||
| touch $@ | ||
|
|
||
| src/protos/%.pb.cpp src/protos/%.pb.h: src/protos/.done ; | ||
| $(CPP_OBJS): src/protos/.done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| <!-- | ||
| Licensed to the Apache Software Foundation (ASF) under one | ||
| or more contributor license agreements. See the NOTICE file | ||
| distributed with this work for additional information | ||
| regarding copyright ownership. The ASF licenses this file | ||
| to you under the Apache License, Version 2.0 (the | ||
| "License"); you may not use this file except in compliance | ||
| with the License. You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, | ||
| software distributed under the License is distributed on an | ||
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| KIND, either express or implied. See the License for the | ||
| specific language governing permissions and limitations | ||
| under the License. | ||
| --> | ||
|
|
||
| ## GP Stats Collector | ||
|
|
||
| An extension for collecting query execution metrics and reporting them to an external agent. | ||
|
|
||
| ### Collected Statistics | ||
|
|
||
| #### 1. Query Lifecycle | ||
| - **What:** Captures query text, normalized query text, timestamps (submit, start, end, done), and user/database info. | ||
| - **GUC:** `gpsc.enable`. | ||
|
|
||
| #### 2. `EXPLAIN` data | ||
| - **What:** Triggers generation of the `EXPLAIN (TEXT, COSTS, VERBOSE)` and captures it. | ||
| - **GUC:** `gpsc.enable`. | ||
|
|
||
| #### 3. `EXPLAIN ANALYZE` data | ||
| - **What:** Triggers generation of the `EXPLAIN (TEXT, ANALYZE, BUFFERS, TIMING, VERBOSE)` and captures it. | ||
| - **GUCs:** `gpsc.enable`, `gpsc.min_analyze_time`, `gpsc.enable_cdbstats`(ANALYZE), `gpsc.enable_analyze`(BUFFERS, TIMING, VERBOSE). | ||
|
|
||
| #### 4. Other Metrics | ||
| - **What:** Captures Instrument, System, Network, Interconnect, Spill metrics. | ||
| - **GUC:** `gpsc.enable`. | ||
|
|
||
| ### General Configuration | ||
| - **Nested Queries:** When `gpsc.report_nested_queries` is `false`, only top-level queries are reported from the coordinator and segments, when `true`, both top-level and nested queries are reported from the coordinator, from segments collected as aggregates. | ||
| - **Data Destination:** All collected data is sent to a Unix Domain Socket. Configure the path with `gpsc.uds_path`. | ||
| - **User Filtering:** To exclude activity from certain roles, add them to the comma-separated list in `gpsc.ignored_users_list`. | ||
| - **Trimming plans:** Query texts and execution plans are trimmed based on `gpsc.max_text_size` and `gpsc.max_plan_size` (default: 1024KB). For now, it is not recommended to set these GUCs higher than 1024KB. | ||
| - **Analyze collection:** Analyze is sent if execution time exceeds `gpsc.min_analyze_time`, which is 10 seconds by default. Analyze is collected if `gpsc.enable_analyze` is true. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.