Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[receiver/saphanareceiver] New SAP HANA metrics receiver #9234

Merged
merged 62 commits into from
May 2, 2022
Merged
Show file tree
Hide file tree
Changes from 57 commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
8cd5181
initial commit
Mar 14, 2022
1319f8d
initial generated metric
Mar 14, 2022
1f4e737
First sap hana metric
Mar 15, 2022
9a8016b
Fully functioning first metric
Mar 16, 2022
78b4e4a
Set up structures for monitoring queries for sap hana
Mar 16, 2022
7bf7503
Clean up sap hana collection code a bit
Mar 16, 2022
a366eeb
More touchups to hana
Mar 16, 2022
c25a3b8
initial tests & enhancements to support unit tests
Mar 21, 2022
8153ae5
Small fixes, finish metadata
Mar 23, 2022
0d34ab2
Add rest of metrics to metadata
Mar 23, 2022
1332980
Enhance null support, finish adding queries
Mar 24, 2022
48cf925
Enhance testing & update queries
Mar 24, 2022
8eb950a
Merge branch 'main' into sap-hana
Mar 24, 2022
e9426d9
tidy up the gomod
Mar 24, 2022
69d83e5
Support disabling queries
Mar 26, 2022
c6be416
Update queries slightly
Mar 26, 2022
97a73fa
Ensure variable coming from go sql is not ratio
Mar 26, 2022
d029fe7
Update saphana documentation
Mar 26, 2022
c153216
Alphabetize sap hana queries in LPU documentation
Mar 26, 2022
302d23b
Minor change to sap hana documentation
Mar 26, 2022
81f9136
Update go mod
Mar 30, 2022
986030e
Merge branch 'main' into sap-hana
Mar 30, 2022
e4fc708
Merge branch 'main' into sap-hana
Apr 4, 2022
a8f82bc
Merge branch 'main' into sap-hana
Apr 8, 2022
0bd6151
Update query based on feedback
Apr 8, 2022
544b1a2
Merge branch 'main' into sap-hana
Apr 11, 2022
4550593
Merge branch 'main' into sap-hana
Apr 12, 2022
1aa1dac
Fix documentation
Apr 12, 2022
a5e9c2a
Address linter issues
Apr 12, 2022
b5a1e50
Add changelog entry
Apr 12, 2022
620deb0
Appease linter
Apr 12, 2022
021126f
Add component to components list for saphana
Apr 12, 2022
44ab994
Update receiver/saphanareceiver/Makefile
dehaansa Apr 13, 2022
de0ca49
Update receiver/saphanareceiver/testdata/mocked_queries/mostly_disabl…
dehaansa Apr 13, 2022
074a2db
Update receiver/saphanareceiver/testdata/mocked_queries/all_query_res…
dehaansa Apr 13, 2022
9f28081
Merge branch 'main' into sap-hana
Apr 13, 2022
bd69de5
Address some PR feedback
Apr 13, 2022
4b8331a
Ensure all errors end up in ScrapeErrors
Apr 13, 2022
91075be
Merge branch 'main' into sap-hana
Apr 16, 2022
d29319e
Add codeowner
Apr 16, 2022
56cbd8f
Update dependencies in gomod
Apr 17, 2022
a87fdcd
Merge branch 'main' into sap-hana
Apr 22, 2022
9130485
Merge branch 'main' into sap-hana
Apr 25, 2022
f920d26
Add resource attributes
Apr 25, 2022
a10fbd5
Address linter
Apr 25, 2022
8d4225e
Update gomod
Apr 26, 2022
f791169
Add db.system identifier
Apr 26, 2022
8bed44d
Tiny change to error message to trigger ci
Apr 26, 2022
fec5d0c
Merge branch 'main' into sap-hana
Apr 26, 2022
6c0e54f
Merge branch 'main' into sap-hana
Apr 28, 2022
77b2a47
Add replace to saphana go mod
Apr 28, 2022
aae8528
Merge branch 'main' into sap-hana
Apr 28, 2022
0634b18
Update reference in saphana gomod
Apr 28, 2022
28badde
Fix unnecessary update to sapmexporter gomod
Apr 28, 2022
446b170
Address PR feedback
Apr 28, 2022
84381b8
Reduce repetition in client
Apr 28, 2022
81a4c92
Simplify assignment in client
Apr 28, 2022
a1d8a21
Merge branch 'main' into sap-hana
Apr 29, 2022
0da4899
Update gomod
Apr 29, 2022
3e504b6
Fix another gomod entry
Apr 29, 2022
cb6bcee
Merge branch 'main' into sap-hana
May 2, 2022
2a294a9
Fix changelog location after merge
May 2, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ receiver/rabbitmqreceiver/ @open-telemetry/collector-c
receiver/receivercreator/ @open-telemetry/collector-contrib-approvers @jrcamp
receiver/redisreceiver/ @open-telemetry/collector-contrib-approvers @pmcollins @dmitryax
receiver/riakreceiver/ @open-telemetry/collector-contrib-approvers @djaglowski @armstrmi
receiver/saphanareceiver/ @open-telemetry/collector-contrib-approvers @pmm-sumo @dehaansa
receiver/sapmreceiver/ @open-telemetry/collector-contrib-approvers @owais
receiver/signalfxreceiver/ @open-telemetry/collector-contrib-approvers @pjanotti @dmitryax
receiver/skywalkingreceiver @open-telemetry/collector-contrib-approvers @JaredTan95
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

### 🚀 New components 🚀

- `saphanareceiver`: Added implementation of SAP HANA Metric Receiver (#8827)
pmm-sumo marked this conversation as resolved.
Show resolved Hide resolved
- `iisreceiver`: Add implementation of IIS Metric Receiver (#8832)
- `sqlserverreceiver`: Add implementation of SQL Server Metric Receiver (#8398)
- `activedirectorydsreceiver`: Add implementation of Active Directory Domain Services metric receiver (#9359)
Expand Down
8 changes: 6 additions & 2 deletions cmd/configschema/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ require (
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/trace v1.4.0 // indirect
github.com/Microsoft/go-winio v0.5.1 // indirect
github.com/ReneKroon/ttlcache/v2 v2.11.0 // indirect
github.com/SAP/go-hdb v0.105.5 // indirect
github.com/SermoDigital/jose v0.9.2-0.20161205224733-f6df55f235c2 // indirect
github.com/Shopify/sarama v1.32.0 // indirect
github.com/Showmax/go-fqdn v1.0.0 // indirect
Expand Down Expand Up @@ -353,6 +354,7 @@ require (
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/receivercreator v0.49.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/redisreceiver v0.49.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/riakreceiver v0.49.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/saphanareceiver v0.49.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/sapmreceiver v0.49.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/signalfxreceiver v0.49.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/simpleprometheusreceiver v0.49.0 // indirect
Expand Down Expand Up @@ -442,7 +444,7 @@ require (
go.etcd.io/bbolt v1.3.6 // indirect
go.mongodb.org/atlas v0.15.0 // indirect
go.opencensus.io v0.23.0 // indirect
go.opentelemetry.io/collector/model v0.49.0 // indirect
go.opentelemetry.io/collector/model v0.49.1-0.20220428142054-b34df3a7e7e9 // indirect
go.opentelemetry.io/collector/semconv v0.0.0-20220422001137-87ab5de64ce4 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.31.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.31.0 // indirect
Expand All @@ -453,7 +455,7 @@ require (
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/goleak v1.1.12 // indirect
go.uber.org/zap v1.21.0 // indirect
golang.org/x/crypto v0.0.0-20220214200702-86341886e292 // indirect
golang.org/x/crypto v0.0.0-20220307211146-efcb8507fb70 // indirect
golang.org/x/net v0.0.0-20220325170049-de3da57026de // indirect
golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
Expand Down Expand Up @@ -770,6 +772,8 @@ replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/redis

replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/riakreceiver => ../../receiver/riakreceiver

replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/saphanareceiver => ../../receiver/saphanareceiver

replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/sapmreceiver => ../../receiver/sapmreceiver

replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/signalfxreceiver => ../../receiver/signalfxreceiver
Expand Down
11 changes: 6 additions & 5 deletions cmd/configschema/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ require (
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/receivercreator v0.49.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/redisreceiver v0.49.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/riakreceiver v0.49.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/saphanareceiver v0.49.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/sapmreceiver v0.49.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/signalfxreceiver v0.49.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/simpleprometheusreceiver v0.49.0
Expand Down Expand Up @@ -165,6 +166,7 @@ require (
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/trace v1.4.0 // indirect
github.com/Microsoft/go-winio v0.5.1 // indirect
github.com/ReneKroon/ttlcache/v2 v2.11.0 // indirect
github.com/SAP/go-hdb v0.105.5 // indirect
github.com/SermoDigital/jose v0.9.2-0.20161205224733-f6df55f235c2 // indirect
github.com/Shopify/sarama v1.32.0 // indirect
github.com/Showmax/go-fqdn v1.0.0 // indirect
Expand Down Expand Up @@ -441,7 +443,7 @@ require (
go.etcd.io/bbolt v1.3.6 // indirect
go.mongodb.org/atlas v0.15.0 // indirect
go.opencensus.io v0.23.0 // indirect
go.opentelemetry.io/collector/model v0.49.0 // indirect
go.opentelemetry.io/collector/model v0.49.1-0.20220428142054-b34df3a7e7e9 // indirect
go.opentelemetry.io/collector/pdata v0.49.1-0.20220428142054-b34df3a7e7e9 // indirect
go.opentelemetry.io/collector/semconv v0.0.0-20220422001137-87ab5de64ce4 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.31.0 // indirect
Expand All @@ -457,7 +459,7 @@ require (
go.uber.org/goleak v1.1.12 // indirect
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.21.0 // indirect
golang.org/x/crypto v0.0.0-20220214200702-86341886e292 // indirect
golang.org/x/crypto v0.0.0-20220307211146-efcb8507fb70 // indirect
golang.org/x/mod v0.5.1 // indirect
golang.org/x/net v0.0.0-20220325170049-de3da57026de // indirect
golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a // indirect
Expand Down Expand Up @@ -774,6 +776,8 @@ replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/redis

replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/riakreceiver => ./receiver/riakreceiver

replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/saphanareceiver => ./receiver/saphanareceiver

replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/sapmreceiver => ./receiver/sapmreceiver

replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/signalfxreceiver => ./receiver/signalfxreceiver
Expand Down
9 changes: 6 additions & 3 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions internal/components/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ import (
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/receivercreator"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/redisreceiver"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/riakreceiver"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/saphanareceiver"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/sapmreceiver"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/signalfxreceiver"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/simpleprometheusreceiver"
Expand Down Expand Up @@ -213,6 +214,7 @@ func Components() (component.Factories, error) {
receivercreator.NewFactory(),
redisreceiver.NewFactory(),
riakreceiver.NewFactory(),
saphanareceiver.NewFactory(),
sapmreceiver.NewFactory(),
signalfxreceiver.NewFactory(),
simpleprometheusreceiver.NewFactory(),
Expand Down
3 changes: 3 additions & 0 deletions internal/components/receivers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,9 @@ func TestDefaultReceivers(t *testing.T) {
{
receiver: "sapm",
},
{
receiver: "saphana",
},
{
receiver: "signalfx",
},
Expand Down
1 change: 1 addition & 0 deletions receiver/saphanareceiver/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ../../Makefile.Common
95 changes: 95 additions & 0 deletions receiver/saphanareceiver/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# SAP HANA Receiver

This receiver can fetch stats from a SAP HANA instance. It leverages the [driver](https://github.com/SAP/go-hdb) written by SAP for connecting to SAP HANA with the golang sql module to execute several monitoring queries.

Supported pipeline types: `metrics`

> :construction: This receiver is currently in **BETA**.

### 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
--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

> :information_source: This receiver is in beta and configuration fields are subject to change.

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`.
- `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
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 [here](./config.go)
with detailed sample configurations [here](./testdata/config.yaml).

## Metrics

Details about the metrics produced by this receiver can be found in [metadata.yaml](./metadata.yaml). Further details of the monitoring queries used to collect them may be found in [queries.go](./queries.go).

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

Loading