Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Switch over to github.com/sijms/go-ora/v2 #312

Merged
merged 10 commits into from
May 4, 2023

Conversation

schmikei
Copy link
Contributor

@schmikei schmikei commented Apr 24, 2023

Description

Fixes #311

This switches the oracledb_exporter to use https://github.com/sijms/go-ora/ v2 🚀

This should improve usability and simplify deployments and usages of this exporter. I've validated docker, windows, linux, and darwin.

I also improved the makefile to target different OSes and arches. This was helpful in testing all the aforementioned deployments. Please let me know if you'd prefer a separate PR for this but was pretty helpful for my testing :)

Happy to explore further topics like binary size impacts and performance but overall its been a smoove transition.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Screenshots (if appropriate):

Currently built binary but still validating:

curl ```sh [root@oradb-21-dev-0 ~]# curl http://localhost:9161/metrics # HELP go_gc_duration_seconds A summary of the pause duration of garbage collection cycles. # TYPE go_gc_duration_seconds summary go_gc_duration_seconds{quantile="0"} 7.3863e-05 go_gc_duration_seconds{quantile="0.25"} 9.6053e-05 go_gc_duration_seconds{quantile="0.5"} 0.00016273 go_gc_duration_seconds{quantile="0.75"} 0.000484257 go_gc_duration_seconds{quantile="1"} 0.013157553 go_gc_duration_seconds_sum 0.014095265 go_gc_duration_seconds_count 6 # HELP go_goroutines Number of goroutines that currently exist. # TYPE go_goroutines gauge go_goroutines 12 # HELP go_info Information about the Go environment. # TYPE go_info gauge go_info{version="go1.19.4"} 1 # HELP go_memstats_alloc_bytes Number of bytes allocated and still in use. # TYPE go_memstats_alloc_bytes gauge go_memstats_alloc_bytes 919880 # HELP go_memstats_alloc_bytes_total Total number of bytes allocated, even if freed. # TYPE go_memstats_alloc_bytes_total counter go_memstats_alloc_bytes_total 1.2054176e+07 # HELP go_memstats_buck_hash_sys_bytes Number of bytes used by the profiling bucket hash table. # TYPE go_memstats_buck_hash_sys_bytes gauge go_memstats_buck_hash_sys_bytes 1.449952e+06 # HELP go_memstats_frees_total Total number of frees. # TYPE go_memstats_frees_total counter go_memstats_frees_total 172711 # HELP go_memstats_gc_sys_bytes Number of bytes used for garbage collection system metadata. # TYPE go_memstats_gc_sys_bytes gauge go_memstats_gc_sys_bytes 9.019104e+06 # HELP go_memstats_heap_alloc_bytes Number of heap bytes allocated and still in use. # TYPE go_memstats_heap_alloc_bytes gauge go_memstats_heap_alloc_bytes 919880 # HELP go_memstats_heap_idle_bytes Number of heap bytes waiting to be used. # TYPE go_memstats_heap_idle_bytes gauge go_memstats_heap_idle_bytes 4.882432e+06 # HELP go_memstats_heap_inuse_bytes Number of heap bytes that are in use. # TYPE go_memstats_heap_inuse_bytes gauge go_memstats_heap_inuse_bytes 2.916352e+06 # HELP go_memstats_heap_objects Number of allocated objects. # TYPE go_memstats_heap_objects gauge go_memstats_heap_objects 6519 # HELP go_memstats_heap_released_bytes Number of heap bytes released to OS. # TYPE go_memstats_heap_released_bytes gauge go_memstats_heap_released_bytes 3.129344e+06 # HELP go_memstats_heap_sys_bytes Number of heap bytes obtained from system. # TYPE go_memstats_heap_sys_bytes gauge go_memstats_heap_sys_bytes 7.798784e+06 # HELP go_memstats_last_gc_time_seconds Number of seconds since 1970 of last garbage collection. # TYPE go_memstats_last_gc_time_seconds gauge go_memstats_last_gc_time_seconds 1.6823560418454983e+09 # HELP go_memstats_lookups_total Total number of pointer lookups. # TYPE go_memstats_lookups_total counter go_memstats_lookups_total 0 # HELP go_memstats_mallocs_total Total number of mallocs. # TYPE go_memstats_mallocs_total counter go_memstats_mallocs_total 179230 # HELP go_memstats_mcache_inuse_bytes Number of bytes in use by mcache structures. # TYPE go_memstats_mcache_inuse_bytes gauge go_memstats_mcache_inuse_bytes 4800 # HELP go_memstats_mcache_sys_bytes Number of bytes used for mcache structures obtained from system. # TYPE go_memstats_mcache_sys_bytes gauge go_memstats_mcache_sys_bytes 15600 # HELP go_memstats_mspan_inuse_bytes Number of bytes in use by mspan structures. # TYPE go_memstats_mspan_inuse_bytes gauge go_memstats_mspan_inuse_bytes 74160 # HELP go_memstats_mspan_sys_bytes Number of bytes used for mspan structures obtained from system. # TYPE go_memstats_mspan_sys_bytes gauge go_memstats_mspan_sys_bytes 97632 # HELP go_memstats_next_gc_bytes Number of heap bytes when next garbage collection will take place. # TYPE go_memstats_next_gc_bytes gauge go_memstats_next_gc_bytes 4.194304e+06 # HELP go_memstats_other_sys_bytes Number of bytes used for other system allocations. # TYPE go_memstats_other_sys_bytes gauge go_memstats_other_sys_bytes 801784 # HELP go_memstats_stack_inuse_bytes Number of bytes in use by the stack allocator. # TYPE go_memstats_stack_inuse_bytes gauge go_memstats_stack_inuse_bytes 589824 # HELP go_memstats_stack_sys_bytes Number of bytes obtained from system for stack allocator. # TYPE go_memstats_stack_sys_bytes gauge go_memstats_stack_sys_bytes 589824 # HELP go_memstats_sys_bytes Number of bytes obtained from system. # TYPE go_memstats_sys_bytes gauge go_memstats_sys_bytes 1.977268e+07 # HELP go_threads Number of OS threads created. # TYPE go_threads gauge go_threads 7 # HELP oracledb_activity_execute_count Generic counter metric from v$sysstat view in Oracle. # TYPE oracledb_activity_execute_count gauge oracledb_activity_execute_count 1.25932554e+08 # HELP oracledb_activity_parse_count_total Generic counter metric from v$sysstat view in Oracle. # TYPE oracledb_activity_parse_count_total gauge oracledb_activity_parse_count_total 3.3204974e+07 # HELP oracledb_activity_user_commits Generic counter metric from v$sysstat view in Oracle. # TYPE oracledb_activity_user_commits gauge oracledb_activity_user_commits 1.46804e+06 # HELP oracledb_activity_user_rollbacks Generic counter metric from v$sysstat view in Oracle. # TYPE oracledb_activity_user_rollbacks gauge oracledb_activity_user_rollbacks 51 # HELP oracledb_exporter_build_info A metric with a constant '1' value labeled by version, revision, branch, goversion from which oracledb_exporter was built, and the goos and goarch for the build. # TYPE oracledb_exporter_build_info gauge oracledb_exporter_build_info{branch="",goarch="amd64",goos="linux",goversion="go1.19.4",revision="a6064cad07d88e02e20048141272930eeeffd5a3-modified",tags="unknown",version=""} 1 # HELP oracledb_exporter_last_scrape_duration_seconds Duration of the last scrape of metrics from Oracle DB. # TYPE oracledb_exporter_last_scrape_duration_seconds gauge oracledb_exporter_last_scrape_duration_seconds 0.476720531 # HELP oracledb_exporter_last_scrape_error Whether the last scrape of metrics from Oracle DB resulted in an error (1 for error, 0 for success). # TYPE oracledb_exporter_last_scrape_error gauge oracledb_exporter_last_scrape_error 0 # HELP oracledb_exporter_scrapes_total Total number of times Oracle DB was scraped for metrics. # TYPE oracledb_exporter_scrapes_total counter oracledb_exporter_scrapes_total 4 # HELP oracledb_process_count Gauge metric with count of processes. # TYPE oracledb_process_count gauge oracledb_process_count 78 # HELP oracledb_resource_current_utilization Generic counter metric from v$resource_limit view in Oracle (current value). # TYPE oracledb_resource_current_utilization gauge oracledb_resource_current_utilization{resource_name="branches"} 0 oracledb_resource_current_utilization{resource_name="cmtcallbk"} 0 oracledb_resource_current_utilization{resource_name="dml_locks"} 0 oracledb_resource_current_utilization{resource_name="enqueue_locks"} 36 oracledb_resource_current_utilization{resource_name="enqueue_resources"} 28 oracledb_resource_current_utilization{resource_name="gcs_resources"} 0 oracledb_resource_current_utilization{resource_name="gcs_shadows"} 0 oracledb_resource_current_utilization{resource_name="ges_big_msgs"} 0 oracledb_resource_current_utilization{resource_name="ges_cache_ress"} 0 oracledb_resource_current_utilization{resource_name="ges_locks"} 0 oracledb_resource_current_utilization{resource_name="ges_procs"} 0 oracledb_resource_current_utilization{resource_name="ges_reg_msgs"} 0 oracledb_resource_current_utilization{resource_name="ges_ress"} 0 oracledb_resource_current_utilization{resource_name="ges_rsv_msgs"} 0 oracledb_resource_current_utilization{resource_name="k2q_locks"} 0 oracledb_resource_current_utilization{resource_name="max_rollback_segments"} 23 oracledb_resource_current_utilization{resource_name="max_shared_servers"} 1 oracledb_resource_current_utilization{resource_name="parallel_max_servers"} 8 oracledb_resource_current_utilization{resource_name="processes"} 76 oracledb_resource_current_utilization{resource_name="sessions"} 90 oracledb_resource_current_utilization{resource_name="smartio_buffer_memory"} 0 oracledb_resource_current_utilization{resource_name="smartio_metadata_memory"} 0 oracledb_resource_current_utilization{resource_name="smartio_overhead_memory"} 0 oracledb_resource_current_utilization{resource_name="smartio_sessions"} 0 oracledb_resource_current_utilization{resource_name="sort_segment_locks"} 0 oracledb_resource_current_utilization{resource_name="temporary_table_locks"} 0 oracledb_resource_current_utilization{resource_name="transactions"} 0 # HELP oracledb_resource_limit_value Generic counter metric from v$resource_limit view in Oracle (UNLIMITED: -1). # TYPE oracledb_resource_limit_value gauge oracledb_resource_limit_value{resource_name="branches"} -1 oracledb_resource_limit_value{resource_name="cmtcallbk"} -1 oracledb_resource_limit_value{resource_name="dml_locks"} -1 oracledb_resource_limit_value{resource_name="enqueue_locks"} 6060 oracledb_resource_limit_value{resource_name="enqueue_resources"} -1 oracledb_resource_limit_value{resource_name="gcs_resources"} -1 oracledb_resource_limit_value{resource_name="gcs_shadows"} -1 oracledb_resource_limit_value{resource_name="ges_big_msgs"} -1 oracledb_resource_limit_value{resource_name="ges_cache_ress"} -1 oracledb_resource_limit_value{resource_name="ges_locks"} -1 oracledb_resource_limit_value{resource_name="ges_procs"} 0 oracledb_resource_limit_value{resource_name="ges_reg_msgs"} -1 oracledb_resource_limit_value{resource_name="ges_ress"} -1 oracledb_resource_limit_value{resource_name="ges_rsv_msgs"} 0 oracledb_resource_limit_value{resource_name="k2q_locks"} -1 oracledb_resource_limit_value{resource_name="max_rollback_segments"} 65535 oracledb_resource_limit_value{resource_name="max_shared_servers"} -1 oracledb_resource_limit_value{resource_name="parallel_max_servers"} 32767 oracledb_resource_limit_value{resource_name="processes"} 320 oracledb_resource_limit_value{resource_name="sessions"} 504 oracledb_resource_limit_value{resource_name="smartio_buffer_memory"} -1 oracledb_resource_limit_value{resource_name="smartio_metadata_memory"} -1 oracledb_resource_limit_value{resource_name="smartio_overhead_memory"} -1 oracledb_resource_limit_value{resource_name="smartio_sessions"} -1 oracledb_resource_limit_value{resource_name="sort_segment_locks"} -1 oracledb_resource_limit_value{resource_name="temporary_table_locks"} -1 oracledb_resource_limit_value{resource_name="transactions"} -1 # HELP oracledb_sessions_value Gauge metric with count of sessions by status and type. # TYPE oracledb_sessions_value gauge oracledb_sessions_value{status="ACTIVE",type="BACKGROUND"} 61 oracledb_sessions_value{status="ACTIVE",type="USER"} 6 oracledb_sessions_value{status="INACTIVE",type="USER"} 1 # HELP oracledb_tablespace_bytes Generic counter metric of tablespaces bytes in Oracle. # TYPE oracledb_tablespace_bytes gauge oracledb_tablespace_bytes{tablespace="SYSAUX",type="PERMANENT"} 1.699151872e+09 oracledb_tablespace_bytes{tablespace="SYSTEM",type="PERMANENT"} 1.487929344e+09 oracledb_tablespace_bytes{tablespace="TEMP",type="TEMPORARY"} 0 oracledb_tablespace_bytes{tablespace="UNDOTBS1",type="UNDO"} 1.703936e+07 oracledb_tablespace_bytes{tablespace="USERS",type="PERMANENT"} 2.818048e+06 # HELP oracledb_tablespace_free Generic counter metric of tablespaces free bytes in Oracle. # TYPE oracledb_tablespace_free gauge oracledb_tablespace_free{tablespace="SYSAUX",type="PERMANENT"} 3.2660570112e+10 oracledb_tablespace_free{tablespace="SYSTEM",type="PERMANENT"} 3.287179264e+10 oracledb_tablespace_free{tablespace="TEMP",type="TEMPORARY"} 3.4359721984e+10 oracledb_tablespace_free{tablespace="UNDOTBS1",type="UNDO"} 3.4342682624e+10 oracledb_tablespace_free{tablespace="USERS",type="PERMANENT"} 3.4356903936e+10 # HELP oracledb_tablespace_max_bytes Generic counter metric of tablespaces max bytes in Oracle. # TYPE oracledb_tablespace_max_bytes gauge oracledb_tablespace_max_bytes{tablespace="SYSAUX",type="PERMANENT"} 3.4359721984e+10 oracledb_tablespace_max_bytes{tablespace="SYSTEM",type="PERMANENT"} 3.4359721984e+10 oracledb_tablespace_max_bytes{tablespace="TEMP",type="TEMPORARY"} 3.4359721984e+10 oracledb_tablespace_max_bytes{tablespace="UNDOTBS1",type="UNDO"} 3.4359721984e+10 oracledb_tablespace_max_bytes{tablespace="USERS",type="PERMANENT"} 3.4359721984e+10 # HELP oracledb_tablespace_used_percent Gauge metric showing as a percentage of how much of the tablespace has been used. # TYPE oracledb_tablespace_used_percent gauge oracledb_tablespace_used_percent{tablespace="SYSAUX",type="PERMANENT"} 4.9451851583410065 oracledb_tablespace_used_percent{tablespace="SYSTEM",type="PERMANENT"} 4.330446400855256 oracledb_tablespace_used_percent{tablespace="TEMP",type="TEMPORARY"} 0 oracledb_tablespace_used_percent{tablespace="UNDOTBS1",type="UNDO"} 0.04959108809999852 oracledb_tablespace_used_percent{tablespace="USERS",type="PERMANENT"} 0.008201603031922832 # HELP oracledb_up Whether the Oracle database server is up. # TYPE oracledb_up gauge oracledb_up 1 # HELP oracledb_wait_time_administrative Generic counter metric from v$waitclassmetric view in Oracle. # TYPE oracledb_wait_time_administrative gauge oracledb_wait_time_administrative 0 # HELP oracledb_wait_time_application Generic counter metric from v$waitclassmetric view in Oracle. # TYPE oracledb_wait_time_application gauge oracledb_wait_time_application 0 # HELP oracledb_wait_time_commit Generic counter metric from v$waitclassmetric view in Oracle. # TYPE oracledb_wait_time_commit gauge oracledb_wait_time_commit 0.047 # HELP oracledb_wait_time_concurrency Generic counter metric from v$waitclassmetric view in Oracle. # TYPE oracledb_wait_time_concurrency gauge oracledb_wait_time_concurrency 0.003 # HELP oracledb_wait_time_configuration Generic counter metric from v$waitclassmetric view in Oracle. # TYPE oracledb_wait_time_configuration gauge oracledb_wait_time_configuration 0 # HELP oracledb_wait_time_network Generic counter metric from v$waitclassmetric view in Oracle. # TYPE oracledb_wait_time_network gauge oracledb_wait_time_network 0 # HELP oracledb_wait_time_other Generic counter metric from v$waitclassmetric view in Oracle. # TYPE oracledb_wait_time_other gauge oracledb_wait_time_other 0.001 # HELP oracledb_wait_time_scheduler Generic counter metric from v$waitclassmetric view in Oracle. # TYPE oracledb_wait_time_scheduler gauge oracledb_wait_time_scheduler 0 # HELP oracledb_wait_time_system_io Generic counter metric from v$waitclassmetric view in Oracle. # TYPE oracledb_wait_time_system_io gauge oracledb_wait_time_system_io 0.133 # HELP oracledb_wait_time_user_io Generic counter metric from v$waitclassmetric view in Oracle. # TYPE oracledb_wait_time_user_io gauge oracledb_wait_time_user_io 0.01 # HELP process_cpu_seconds_total Total user and system CPU time spent in seconds. # TYPE process_cpu_seconds_total counter process_cpu_seconds_total 0.38 # HELP process_max_fds Maximum number of open file descriptors. # TYPE process_max_fds gauge process_max_fds 65536 # HELP process_open_fds Number of open file descriptors. # TYPE process_open_fds gauge process_open_fds 11 # HELP process_resident_memory_bytes Resident memory size in bytes. # TYPE process_resident_memory_bytes gauge process_resident_memory_bytes 1.6355328e+07 # HELP process_start_time_seconds Start time of the process since unix epoch in seconds. # TYPE process_start_time_seconds gauge process_start_time_seconds 1.68235602117e+09 # HELP process_virtual_memory_bytes Virtual memory size in bytes. # TYPE process_virtual_memory_bytes gauge process_virtual_memory_bytes 7.4534912e+08 # HELP process_virtual_memory_max_bytes Maximum amount of virtual memory available in bytes. # TYPE process_virtual_memory_max_bytes gauge process_virtual_memory_max_bytes 1.8446744073709552e+19 ```

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • Updated version in Makefile respecting semver v2

@Yannig
Copy link
Collaborator

Yannig commented Apr 25, 2023

Hi @schmikei

Thanks for your work.

Just one question: you will merge this PR after the other you did previously? In fact, if you prefer, we can already merge the previous PR. If you don't want to bump a new major version, you can just increment the number in Makefile and stick to 0.4. Next major version will be 0.5.

Let me know what you prefer.

Regards

@schmikei
Copy link
Contributor Author

@Yannig Sure I think my preference would be to merge in #308, and then fix this PR and make this one with a major version bump. Does that sound good to you?

@Yannig
Copy link
Collaborator

Yannig commented Apr 26, 2023

That sound perfect for me :)

@schmikei
Copy link
Contributor Author

schmikei commented Apr 28, 2023

Still in the middle of validating all use cases for this exporter. Will probably finish tomorrow!

Edit 04/28/2023: Still looking into this, have to head out for the weekend, but will continue docker validation in a bit :)

Makefile Outdated
@@ -159,7 +138,7 @@ else
@echo "Can't find cosign.key file"
endif

travis: oci.pc prereq deps go-test go-build docker
travis: deps go-test go-build docker
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think you can remove travis stuff. We don't use this anymore

@schmikei
Copy link
Contributor Author

schmikei commented May 1, 2023

Validated some docker stuff today, am going to look into validating windows tomorrow!

@schmikei schmikei marked this pull request as ready for review May 3, 2023 21:00
@schmikei
Copy link
Contributor Author

schmikei commented May 3, 2023

@Yannig I finished up my windows validation and feel like everything has been working perfectly :)

Happy to do some deeper dives if you have more concerns but I think this is good for you to take a look!

@schmikei schmikei changed the title WIP: Attempt to switch over to github.com/sijms/go-ora/v2 Switch over to github.com/sijms/go-ora/v2 May 3, 2023
@Yannig
Copy link
Collaborator

Yannig commented May 4, 2023

I think we can remove more stuff but I think it's not very urgent :)

Let's merge this work for now. I will do some clean up.

Thanks a lot @schmikei for this amazing work!

@Yannig Yannig merged commit f801dc4 into iamseth:master May 4, 2023
@schmikei schmikei deleted the go-ora-switch branch May 8, 2023 13:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Switching over to github.com/sijms/go-ora
2 participants