[monitoring-template] feat(cloudspanner): add Google Cloud Spanner monitoring#4147
Open
neon-hippo wants to merge 1 commit into
Open
[monitoring-template] feat(cloudspanner): add Google Cloud Spanner monitoring#4147neon-hippo wants to merge 1 commit into
neon-hippo wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adds a new monitor type for Google Cloud Spanner, supporting both the Google Standard SQL dialect (
app-cloudspanner.yml) and the PostgreSQL dialect (app-cloudspanner-pg.yml). HertzBeat connects via the open-source Cloud Spanner JDBC driver; no GCP credentials are baked in — users supply a service account key path via the Extra Params field.The connection URL is assembled automatically from the three natural GCP identifiers:
What is included
app-cloudspanner.yml— Google Standard SQL dialect monitor (i18n: en/zh/ja)app-cloudspanner-pg.yml— PostgreSQL dialect monitor (i18n: en/zh/ja)hertzbeat-collector/hertzbeat-collector-cloudspanner— new collector module that loads the Spanner JDBC driver, which is not discovered by the standard JDBC classpath scanpom.xml— bumpsgoogle-cloud-spanner-jdbc2.30.0 → 2.34.0 and pinsgrpc-netty-shaded:1.70.0to resolve a runtime conflict with the GreptimeDB ingester (see Design Decisions)CloudSpannerDriverLoaderTestandSpannerJdbcTemplateIntegrationTest(27 cases)Metric groups (both dialects)
tablesINFORMATION_SCHEMA.TABLESindexesINFORMATION_SCHEMA.INDEXESdatabase_optionsINFORMATION_SCHEMA.DATABASE_OPTIONSquery_statsSPANNER_SYS.QUERY_STATS_TOTAL_MINUTEtxn_statsSPANNER_SYS.TXN_STATS_TOTAL_MINUTElock_statsSPANNER_SYS.LOCK_STATS_TOTAL_MINUTEtable_sizesSPANNER_SYS.TABLE_SIZES_STATS_1HOURDesign decisions
hostfield reused for Instance ID. HertzBeat's param schema requires one field of typehostfor validation. The Cloud Spanner JDBC URL doesn't have a traditional hostname, so Instance ID is mapped to this field. The UI label reads "Instance ID" — users never see "host."ingester-all) declares a transitive dependency ongrpc-netty-shaded:1.56.1, which conflicts with the version required by the Spanner JDBC driver and causes aNoSuchMethodErrorat startup. The fix pinsgrpc-netty-shaded:1.70.0in rootdependencyManagementand excludes the old transitive pull fromhertzbeat-warehouse. This has no impact on GreptimeDB functionality or the rest of the project — it simply prevents the older version from winning the dependency resolution.Permissions required
The GCP service account used by HertzBeat needs read access to the target database. The minimum IAM role is:
This grants
SELECTon all tables and access toINFORMATION_SCHEMAandSPANNER_SYSviews. It can be granted at the database, instance, or project level via the GCP Console orgcloud:Live verification
Both templates were tested against a real GCP project (
hertzbeat-spanner-dev, instancehertzbeat-dev). All 7 metric groups collected successfully on both the GSS and PG databases.Known limitations
SPANNER_SYStables (query/txn/lock/table-size stats) are not available on the Cloud Spanner emulator. Those metric groups return no data in local dev environments.References
🤖 Generated with Claude Code