Skip to content

Google Cloud Spanner Query-Level Metrics#24565

Open
amw-zero wants to merge 11 commits into
masterfrom
alex.weisberger/dbmon-6844-spanner-integration
Open

Google Cloud Spanner Query-Level Metrics#24565
amw-zero wants to merge 11 commits into
masterfrom
alex.weisberger/dbmon-6844-spanner-integration

Conversation

@amw-zero

@amw-zero amw-zero commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

This introduces a new integration: cloud_spanner. This integration adds query-level metrics for Spanner databases by connecting to the DB and querying tables in the SPANNER_SYS schema.

This integration should be seen as experimental until otherwise communicated.

Motivation

Today, Datadog collects various metrics for Spanner databases, but it does it via the GCP API. This limits what data is available. For example, query metrics are aggregated across all queries, and a per-query breakdown is not supported.

Query-Level Metrics are a staple of Database Monitoring, so we can support a Database Monitoring experience for Spanner by collecting and sending them.

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Add qa/required if this PR needs QA validation, or qa/skip-qa if it does not. Exactly one of the two is required.
  • If you need to backport this PR to another branch, you can add the backport/<branch-name> label to the PR and it will automatically open a backport PR once this one is merged

amw-zero and others added 3 commits July 14, 2026 17:59
- Add metadata.csv with 10 spanner.queries.* metrics
- Add assets/service_checks.json (empty)
- Add assets/configuration/spec.yaml with full config schema
- Generate conf.yaml.example and config_models/ via ddev
- Update manifest.json: add app_uuid, owner, fix metrics prefix to spanner.*
- Update pyproject.toml Development Status from Alpha to Beta
- Add README.md with beta notice, setup instructions, and tile sections
- Fix ruff formatting across all Python files in the integration

Environment: Datadog workspace

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@datadog-datadog-prod-us1

This comment has been minimized.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b10a86a46b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread cloud_spanner/datadog_checks/cloud_spanner/queries.py Outdated
Comment thread cloud_spanner/datadog_checks/cloud_spanner/check.py
@amw-zero amw-zero added the qa/skip-qa Automatically skip this PR for the next QA label Jul 15, 2026
@amw-zero amw-zero changed the title Alex.weisberger/dbmon 6844 spanner integration Google Cloud Spanner Query-Level Metrics Jul 15, 2026
@drichards-87 drichards-87 added the editorial review Waiting on a more in-depth review from a docs team editor label Jul 15, 2026
@drichards-87

Copy link
Copy Markdown
Contributor

Created DOCS-15122 for the editorial review.

@dd-octo-sts

dd-octo-sts Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Validation Report

Validation Description Status
ci Validate CI configuration and code coverage settings
dep Verify dependency pins are consistent and Agent-compatible
labeler Validate PR labeler config matches integration directories
license-headers Validate Python files have proper license headers
version Validate version consistency between package and changelog

Run ddev validate all changed --fix to attempt to auto-fix supported validations.

Passed validations (16)
Validation Description Status
agent-reqs Verify check versions match the Agent requirements file
codeowners Validate every integration has a CODEOWNERS entry
config Validate default configuration files against spec.yaml
http Validate integrations use the HTTP wrapper correctly
imports Validate check imports do not use deprecated modules
integration-style Validate check code style conventions
jmx-metrics Validate JMX metrics definition files and config
legacy-signature Validate no integration uses the legacy Agent check signature
licenses Validate third-party license attribution list
metadata Validate metadata.csv metric definitions
models Validate configuration data models match spec.yaml
openmetrics Validate OpenMetrics integrations disable the metric limit
package Validate Python package metadata and naming
qa-label Validate the pull request declares whether it needs QA for the next Agent release
readmes Validate README files have required sections
saved-views Validate saved view JSON file structure and fields

View full run

- pyproject.toml: move google-cloud-spanner and google-auth from
  project.dependencies to project.optional-dependencies.deps so the
  hatch env feature `deps` is defined (fixes py3.13 test env).
- manifest.json: add tile.changelog, tile.media, and
  assets.integration.auto_install (fixes validate-manifests/logs/assets).
- CHANGELOG.md + changelog.d/24565.added: new scaffold and initial
  entry (fixes Check PR changelog and version validator).
- labeler.yml: register integration/cloud_spanner (ddev validate
  labeler --sync).
- License headers on all cloud_spanner *.py files (ddev validate
  license-headers --fix).
- agent_requirements.in + LICENSE-3rdparty.csv: sync google-auth and
  google-cloud-spanner (ddev dep freeze).

Environment: Datadog workspace

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@amw-zero
amw-zero requested a review from a team as a code owner July 17, 2026 15:05
amw-zero and others added 3 commits July 17, 2026 15:20
… base package pins.

The uv resolver in CI failed because google-auth==2.38.0 caps cachetools
at <6.0, but datadog-checks-base pins cachetools==7.0.5. The cachetools
cap was dropped in google-auth 2.48.0.

google-cloud-spanner==3.48.0 also caps protobuf at <6.0.0dev while the
base package pins protobuf==7.34.0. protobuf >=4.25.8, <8 support was
added in google-cloud-spanner 3.65.0.

- google-auth: 2.38.0 -> 2.56.0
- google-cloud-spanner: 3.48.0 -> 3.69.0

Verified with `pip install --dry-run` against the full base-package
deps set (cachetools==7.0.5, protobuf==7.34.0, mmh3==5.2.1, etc.) that
the resolver finds a valid solution.

Environment: Datadog workspace

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The datadog-assets validator expects sample_tags values to be
comma-separated, wrapped in double quotes (per other integrations like
anthropic_usage_and_costs). The previous space-separated form failed
validate-metrics_metadata for all 10 spanner.queries.* rows.

Environment: Datadog workspace

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The wheel-builder workflow (resolve-build-deps.yaml) installs
host_dependencies.txt on each runner. google-cloud-storage transitively
pulls in google-auth (>=2.48.0), which hard-requires cryptography>=38.0.3.
Unpinned, pip picks cryptography 49.0.0 — which dropped macos-x86_64
wheels — and falls back to a source build that fails on the macos-x86_64
runner because Homebrew (and thus OpenSSL) was removed as part of runner
setup.

This has been failing on every PR that touches agent_requirements.in
since cryptography 49.0.0 released 2026-06-12. Not a cloud_spanner
issue, but it blocks this PR because the earlier commits added google
deps to agent_requirements.in, causing the wheel-builder to actually run.

cryptography 48.x still ships universal2 wheels that cover x86_64.

Environment: Datadog workspace

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@amw-zero
amw-zero requested a review from a team as a code owner July 17, 2026 15:54

@buraizu buraizu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good overall, just suggesting a few minor updates for the doc

Comment thread cloud_spanner/README.md
@@ -0,0 +1,64 @@
## Overview

> **Note:** This integration is in beta. Features and configuration options may change.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
> **Note:** This integration is in beta. Features and configuration options may change.
> **Note:** This integration is in preview. Features and configuration options may change.

Comment thread cloud_spanner/README.md

### Prerequisites

- A Google Cloud service account with the `spanner.databases.select` permission, or Application Default Credentials (ADC) when running inside GCP

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
- A Google Cloud service account with the `spanner.databases.select` permission, or Application Default Credentials (ADC) when running inside GCP
- A Google Cloud service account with the `spanner.databases.select` permission, or Application Default Credentials (ADC) when running inside Google Cloud

Comment thread cloud_spanner/README.md
Comment on lines +40 to +46
## Data Collected

### Metrics

See [metadata.csv][6] for a list of metrics provided by this integration.

### Service Checks

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
## Data Collected
### Metrics
See [metadata.csv][6] for a list of metrics provided by this integration.
### Service Checks
## Data collected
### Metrics
See [metadata.csv][6] for a list of metrics provided by this integration.
### Service checks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants