Skip to content

Add SAP HANA schema collection and diagnostics#23934

Draft
pawel-big-lebowski wants to merge 5 commits into
masterfrom
pawel.leszczynski/sap-hana-schema-colletor
Draft

Add SAP HANA schema collection and diagnostics#23934
pawel-big-lebowski wants to merge 5 commits into
masterfrom
pawel.leszczynski/sap-hana-schema-colletor

Conversation

@pawel-big-lebowski
Copy link
Copy Markdown

What does this PR do?

Adds Database Monitoring schema collection and startup diagnostics to the SAP HANA integration.

  • Schema collection (schemas.py): a HanaSchemaCollector built on the shared datadog_checks.base.utils.db.schemas.SchemaCollector base class (the same one used by postgres). It queries SYS.SCHEMAS, SYS.TABLES, and SYS.TABLE_COLUMNS and emits kind=hana_databases metadata payloads (schemas → tables → columns) for the Schema Explorer. System schemas are skipped, and include_schemas/exclude_schemas/max_tables/max_columns limits are honored.
  • Diagnostics (diagnose.py): a HanaDiagnose registered via self.diagnosis.register(...) that checks connectivity, minimum supported version (2.x), and per-view catalog access, distinguishing privilege errors from generic failures and surfacing actionable remediation.
  • Configuration: a new collect_schemas option (enabled, collection_interval, max_tables, max_columns, include_schemas, exclude_schemas) added to spec.yaml, with regenerated config_models and conf.yaml.example. Disabled by default.
  • Wiring (sap_hana.py): time-gated _maybe_collect_schemas() invoked from check(), plus the DatabaseCheck-style properties the base collector requires (dbms, dbms_version, database_identifier, reported_hostname, cloud_metadata, tags).
  • Docs (README.md): documents the new grants (SYS.SCHEMAS, SYS.TABLES, SYS.TABLE_COLUMNS, covered by GRANT CATALOG READ) and a "Schema collection" configuration section.

Motivation

Bring SAP HANA in line with other Database Monitoring integrations (postgres, mysql, sqlserver, clickhouse) by surfacing catalog metadata in the Schema Explorer, and give users a quick way to diagnose missing privileges or connectivity issues.

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

Collect SAP HANA catalog metadata (schemas, tables, columns) for Database
Monitoring's Schema Explorer, mirroring the postgres implementation on the
shared SchemaCollector base class. Add startup diagnostics for connection,
version, and catalog-view access.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@datadog-datadog-prod-us1-2
Copy link
Copy Markdown

datadog-datadog-prod-us1-2 Bot commented Jun 5, 2026

Pipelines  Tests

Fix all issues with BitsAI

⚠️ Warnings

🚦 3 Pipeline jobs failed

PR | test / check   View in Datadog   GitHub Actions

PR | test / test (linux, ubuntu-22.04, sap_hana, SAP HANA (py3.13-2.0), py3.13-2.0) / SAP HANA (py3.13-2.0)-py3.13-2.0   View in Datadog   GitHub Actions

PR | test / test-minimum-base-package (linux, ubuntu-22.04, sap_hana, SAP HANA (py3.13-2.0), py3.13-2.0) / minimum-base-package-SAP HANA (py3.13-2.0)-py3.13-2.0   View in Datadog   GitHub Actions

🧪 2 Tests failed in 1 job

PR | run   GitHub Actions

TestHanaDiagnose::test_properties from test_schemas_diagnose.py   View in Datadog (Fix with Cursor)
assert &#39;saphana&#39; == &#39;hana&#39;
  
  - hana
  &#43; saphana
TestHanaSchemaCollector::test_payload_structure from test_schemas_diagnose.py   View in Datadog (Fix with Cursor)
assert &#39;saphana_databases&#39; == &#39;hana_databases&#39;
  
  - hana_databases
  &#43; saphana_databases
  ? &#43;&#43;&#43;

ℹ️ Info

No other issues found (see more)

❄️ No new flaky tests detected

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 4ee1d7c | Docs | Datadog PR Page | Give us feedback!

pawel-big-lebowski and others added 3 commits June 5, 2026 07:49
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
HANA Express does not include the DESCRIPTION column in SYS.M_DATABASE.
Fetch DATABASE_NAME and DESCRIPTION in separate queries so that the
absence of DESCRIPTION (silently ignored) does not prevent the database
name from being resolved.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Use 'saphana_databases' as the schema payload kind and 'saphana' as the
dbms identifier, matching KindSapHanaDatabases and the SapHana DBMS
constant defined in the dd-go dbm-metadata-processor PR.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dd-octo-sts
Copy link
Copy Markdown
Contributor

dd-octo-sts Bot commented Jun 5, 2026

Validation Report

All 21 validations passed.

Show details
Validation Description Status
agent-reqs Verify check versions match the Agent requirements file
ci Validate CI configuration and code coverage settings
codeowners Validate every integration has a CODEOWNERS entry
config Validate default configuration files against spec.yaml
dep Verify dependency pins are consistent and Agent-compatible
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
labeler Validate PR labeler config matches integration directories
legacy-signature Validate no integration uses the legacy Agent check signature
license-headers Validate Python files have proper license headers
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
version Validate version consistency between package and changelog

View full run

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.

1 participant