> ## Documentation Index
> Fetch the complete documentation index at: https://otel.fyi/llms.txt
> Use this file to discover all available pages before exploring further.

# Saphana

> OpenTelemetry receiver for Saphana

# Saphana Receiver

![Status](https://img.shields.io/badge/status-alpha-red)

**Available in:** `contrib`

**Maintainers:** [@dehaansa](https://github.com/dehaansa)

**Source:** [opentelemetry-collector-contrib](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/saphanareceiver)

## Supported Telemetry

![Metrics](https://img.shields.io/badge/metrics-alpha-green)

## Overview

### Prerequisites

> The receiver is intended to support SAP HANA version 2, older versions have not been tested.

A monitoring user requires `SELECT` access to the relevant monitoring views. The following sql script should create a monitoring role and apply it to a monitoring user if executed by a user with sufficient permissions connected to the SAP HANA instance.

```sql theme={null}
--Create the user
CREATE RESTRICTED USER otel_monitoring_user PASSWORD <password>;

--Enable user login
ALTER USER otel_monitoring_user ENABLE CLIENT CONNECT;

--Create the monitoring role
CREATE ROLE OTEL_MONITORING;

--Grant permissions to the relevant views
GRANT CATALOG READ TO OTEL_MONITORING;
GRANT SELECT ON SYS.M_BACKUP_CATALOG TO OTEL_MONITORING;
GRANT SELECT ON SYS.M_BLOCKED_TRANSACTIONS TO OTEL_MONITORING;
GRANT SELECT ON SYS.M_CONNECTIONS TO OTEL_MONITORING;
GRANT SELECT ON SYS.M_CS_ALL_COLUMNS TO OTEL_MONITORING;
GRANT SELECT ON SYS.M_CS_TABLES TO OTEL_MONITORING;
GRANT SELECT ON SYS.M_DATABASE TO OTEL_MONITORING;
GRANT SELECT ON SYS.M_DISKS TO OTEL_MONITORING;
GRANT SELECT ON SYS.M_HOST_RESOURCE_UTILIZATION TO OTEL_MONITORING;
GRANT SELECT ON SYS.M_LICENSES TO OTEL_MONITORING;
GRANT SELECT ON SYS.M_RS_TABLES TO OTEL_MONITORING;
GRANT SELECT ON SYS.M_SERVICE_COMPONENT_MEMORY TO OTEL_MONITORING;
GRANT SELECT ON SYS.M_SERVICE_MEMORY TO OTEL_MONITORING;
GRANT SELECT ON SYS.M_SERVICE_REPLICATION TO OTEL_MONITORING;
GRANT SELECT ON SYS.M_SERVICE_STATISTICS TO OTEL_MONITORING;
GRANT SELECT ON SYS.M_SERVICE_THREADS TO OTEL_MONITORING;
GRANT SELECT ON SYS.M_SERVICES TO OTEL_MONITORING;
GRANT SELECT ON SYS.M_VOLUME_IO_TOTAL_STATISTICS TO OTEL_MONITORING;
GRANT SELECT ON SYS.M_WORKLOAD TO OTEL_MONITORING;
GRANT SELECT ON _SYS_STATISTICS.STATISTICS_CURRENT_ALERTS TO OTEL_MONITORING;

--Add the OTEL_MONITOR role to the monitoring user
GRANT OTEL_MONITORING TO otel_monitoring_user;
```

## Configuration

The following settings are required:

* `endpoint` (default: `localhost:33015`): The hostname/IP address and port of the SAP HANA instance
* `username`
* `password`

The following settings are optional:

* `collection_interval` (default = `60s`): This receiver runs on an interval.
  Each time it runs, it queries memcached, creates metrics, and sends them to the
  next consumer. The `collection_interval` configuration option tells this
  receiver the duration between runs. This value must be a string readable by
  Golang's `ParseDuration` function (example: `1h30m`). Valid time units are
  `ns`, `us` (or `µs`), `ms`, `s`, `m`, `h`.
* `initial_delay` (default = `1s`): defines how long this receiver waits before starting.
* `tls`:
  * `insecure` (default = true): whether to disable client transport security for the exporter's connection.
  * `ca_file`: path to the CA cert. For a client this verifies the server certificate. Should only be used if `insecure` is set to false.
  * `cert_file`: path to the TLS cert to use for TLS required connections. Should only be used if `insecure` is set to false.
  * `key_file`: path to the TLS key to use for TLS required connections. Should only be used if `insecure` is set to false.

Example:

```yaml theme={null}
receivers:
  saphana:
    endpoint: "localhost:33015"
    collection_interval: 60s
    metrics:
      saphana.cpu.used:
        enabled: false
```

The full list of settings exposed for this receiver are documented in [config.go](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/saphanareceiver/config.go)
with detailed sample configurations in [testdata/config.yaml](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/saphanareceiver/testdata/config.yaml).

## Metrics

Details about the metrics produced by this receiver can be found in [metadata.yaml](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/saphanareceiver/metadata.yaml). Further details of the monitoring queries used to collect them may be found in [queries.go](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/saphanareceiver/queries.go).

> If all of the metrics collected by a given monitoring query are marked as `enabled: false` in the receiver configuration, the monitoring query will not be executed.

## Metrics

| Metric Name | Description | Unit | Type | Attributes |
| - | - | - | - | - |
| ✅ `saphana.alert.count` | Number of current alerts. | \{alerts} | UpDownCounter | alert\_rating |
| ✅ `saphana.backup.latest` | The age of the latest backup by start time. | s | Gauge | |
| ✅ `saphana.column.memory.used` | The memory used in all columns. | By | UpDownCounter | column\_memory\_type, column\_memory\_subtype |
| ✅ `saphana.component.memory.used` | The memory used in components. | By | UpDownCounter | component |
| ✅ `saphana.connection.count` | The number of current connections. | \{connections} | UpDownCounter | connection\_status |
| ✅ `saphana.cpu.used` | Total CPU time spent. | ms | Counter | cpu\_type |
| ✅ `saphana.disk.size.current` | The disk size. | By | UpDownCounter | path, disk\_usage\_type, disk\_state\_used\_free |
| ✅ `saphana.host.memory.current` | The amount of physical memory on the host. | By | UpDownCounter | memory\_state\_used\_free |
| ✅ `saphana.host.swap.current` | The amount of swap space on the host. | By | UpDownCounter | host\_swap\_state |
| ✅ `saphana.instance.code_size` | The instance code size, including shared libraries of SAP HANA processes. | By | UpDownCounter | |
| ✅ `saphana.instance.memory.current` | The size of the memory pool for all SAP HANA processes. | By | UpDownCounter | memory\_state\_used\_free |
| ✅ `saphana.instance.memory.shared.allocated` | The shared memory size of SAP HANA processes. | By | UpDownCounter | |
| ✅ `saphana.instance.memory.used.peak` | The peak memory from the memory pool used by SAP HANA processes since the instance started (this is a sample-based value). | By | UpDownCounter | |
| ✅ `saphana.license.expiration.time` | The amount of time remaining before license expiration. | s | Gauge | system, product |
| ✅ `saphana.license.limit` | The allowed product usage as specified by the license (for example, main memory). | \{licenses} | UpDownCounter | system, product |
| ✅ `saphana.license.peak` | The peak product usage value during last 13 months, measured periodically. | \{licenses} | UpDownCounter | system, product |
| ✅ `saphana.network.request.average_time` | The average response time calculated over recent requests | ms | Gauge | |
| ✅ `saphana.network.request.count` | The number of active and pending service requests. | \{requests} | UpDownCounter | active\_pending\_request\_state |
| ✅ `saphana.network.request.finished.count` | The number of service requests that have completed. | \{requests} | Counter | internal\_external\_request\_type |
| ✅ `saphana.replication.average_time` | The average amount of time consumed replicating a log. | us | Gauge | primary\_host, secondary\_host, port, replication\_mode |
| ✅ `saphana.replication.backlog.size` | The current replication backlog size. | By | UpDownCounter | primary\_host, secondary\_host, port, replication\_mode |
| ✅ `saphana.replication.backlog.time` | The current replication backlog. | us | UpDownCounter | primary\_host, secondary\_host, port, replication\_mode |
| ✅ `saphana.row_store.memory.used` | The used memory for all row tables. | By | UpDownCounter | row\_memory\_type |
| ✅ `saphana.schema.memory.used.current` | The memory size for all tables in schema. | By | UpDownCounter | schema, schema\_memory\_type |
| ✅ `saphana.schema.memory.used.max` | The estimated maximum memory consumption for all fully loaded tables in schema (data for open transactions is not included). | By | UpDownCounter | schema |
| ✅ `saphana.schema.operation.count` | The number of operations done on all tables in schema. | \{operations} | Counter | schema, schema\_operation\_type |
| ✅ `saphana.schema.record.compressed.count` | The number of entries in main during the last optimize compression run for all tables in schema. | \{records} | UpDownCounter | schema |
| ✅ `saphana.schema.record.count` | The number of records for all tables in schema. | \{records} | UpDownCounter | schema, schema\_record\_type |
| ✅ `saphana.service.code_size` | The service code size, including shared libraries. | By | UpDownCounter | service |
| ✅ `saphana.service.count` | The number of services in a given status. | \{services} | UpDownCounter | service\_status |
| ✅ `saphana.service.memory.compactors.allocated` | The part of the memory pool that can potentially (if unpinned) be freed during a memory shortage. | By | UpDownCounter | service |
| ✅ `saphana.service.memory.compactors.freeable` | The memory that can be freed during a memory shortage. | By | UpDownCounter | service |
| ✅ `saphana.service.memory.effective_limit` | The effective maximum memory pool size, calculated considering the pool sizes of other processes. | By | UpDownCounter | service |
| ✅ `saphana.service.memory.heap.current` | The size of the heap portion of the memory pool. | By | UpDownCounter | service, memory\_state\_used\_free |
| ✅ `saphana.service.memory.limit` | The configured maximum memory pool size. | By | UpDownCounter | service |
| ✅ `saphana.service.memory.shared.current` | The size of the shared portion of the memory pool. | By | UpDownCounter | service, memory\_state\_used\_free |
| ✅ `saphana.service.memory.used` | The used memory from the operating system perspective. | By | UpDownCounter | service, service\_memory\_used\_type |
| ✅ `saphana.service.stack_size` | The service stack size. | By | UpDownCounter | service |
| ✅ `saphana.service.thread.count` | The number of service threads in a given status. | \{threads} | UpDownCounter | thread\_status |
| ✅ `saphana.transaction.blocked` | The number of transactions waiting for a lock. | \{transactions} | UpDownCounter | |
| ✅ `saphana.transaction.count` | The number of transactions. | \{transactions} | Counter | transaction\_type |
| ✅ `saphana.uptime` | The uptime of the database. | s | UpDownCounter | system, database |
| ✅ `saphana.volume.operation.count` | The number of operations executed. | \{operations} | Counter | path, disk\_usage\_type, volume\_operation\_type |
| ✅ `saphana.volume.operation.size` | The size of operations executed. | By | Counter | path, disk\_usage\_type, volume\_operation\_type |
| ✅ `saphana.volume.operation.time` | The time spent executing operations. | ms | Counter | path, disk\_usage\_type, volume\_operation\_type |

## Attributes

| Attribute Name | Description | Type | Values |
| - | - | - | - |
| `state` | The state of network request. | string | `active`, `pending` |
| `rating` | The alert rating. | string | |
| `subtype` | The subtype of column store memory. | string | `data`, `dict`, `index`, `misc` |
| `type` | The type of column store memory. | string | `main`, `delta` |
| `component` | The SAP HANA component. | string | |
| `status` | The connection status. | string | `running`, `idle`, `queueing` |
| `type` | The type of cpu. | string | `user`, `system`, `io_wait`, `idle` |
| `database` | The SAP HANA database. | string | |
| `state` | The state of the disk storage. | string | `used`, `free` |
| `usage_type` | The SAP HANA disk & volume usage type. | string | |
| `state` | The state of swap data. | string | `used`, `free` |
| `type` | The type of network request. | string | `internal`, `external` |
| `state` | The state of memory. | string | `used`, `free` |
| `path` | The SAP HANA disk path. | string | |
| `port` | The SAP HANA port. | string | |
| `primary` | The primary SAP HANA host in replication. | string | |
| `product` | The SAP HANA product. | string | |
| `mode` | The replication mode. | string | |
| `type` | The type of row store memory. | string | `fixed`, `variable` |
| `schema` | The SAP HANA schema. | string | |
| `type` | The type of schema memory. | string | `main`, `delta`, `history_main`, `history_delta` |
| `type` | The type of operation. | string | `read`, `write`, `merge` |
| `type` | The type of schema record. | string | `main`, `delta`, `history_main`, `history_delta` |
| `secondary` | The secondary SAP HANA host in replication. | string | |
| `service` | The SAP HANA service. | string | |
| `type` | The type of service memory. | string | `logical`, `physical` |
| `status` | The status of services. | string | `active`, `inactive` |
| `system` | The SAP HANA system. | string | |
| `status` | The status of threads. | string | `active`, `inactive` |
| `type` | The transaction type. | string | `update`, `commit`, `rollback` |
| `type` | The type of operation. | string | `read`, `write` |

## Resource Attributes

| Attribute Name | Description | Type | Enabled |
| - | - | - | - |
| `db.system` | The type of database system. | string | ✅ |
| `saphana.host` | The SAP HANA host. | string | ✅ |

## Configuration

### Example Configuration

```yaml theme={null}
saphana:
  metrics:
    saphana.cpu.used:
      enabled: false
  endpoint: example.com:30015
  username: otel
  password: password
  collection_interval: 2m
```

***

*Last generated: 2026-10-05*
