Skip to content

Commit

Permalink
#91: Adapt tests to Exasol 8 (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaklakariada authored Jun 11, 2024
1 parent 61ec7e0 commit 434ade8
Show file tree
Hide file tree
Showing 24 changed files with 200 additions and 79 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/broken_links_checker.yml

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

7 changes: 0 additions & 7 deletions .github/workflows/ci-build-next-java.yml

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

6 changes: 3 additions & 3 deletions .github/workflows/ci-build.yml

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

14 changes: 5 additions & 9 deletions .github/workflows/dependencies_update.yml

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

2 changes: 1 addition & 1 deletion .project-keeper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ sources:
- integration_tests
build:
exasolDbVersions:
- "8.27.0"
- "7.1.26"
# Version 8 not yet supported, see https://github.com/exasol/cloudwatch-adapter/issues/91
4 changes: 2 additions & 2 deletions ci-isolation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<dependency>
<groupId>software.amazon.awscdk</groupId>
<artifactId>aws-cdk-lib</artifactId>
<version>2.136.1</version>
<version>2.145.0</version>
</dependency>
<dependency>
<groupId>software.constructs</groupId>
Expand All @@ -44,7 +44,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.2.0</version>
<version>3.3.0</version>
<configuration>
<mainClass>com.exasol.adapter.document.files.ciisolation.CiIsolationApp</mainClass>
</configuration>
Expand Down
2 changes: 1 addition & 1 deletion dependencies.md

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

1 change: 1 addition & 0 deletions doc/changes/changelog.md

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

35 changes: 35 additions & 0 deletions doc/changes/changes_1.1.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Cloudwatch Adapter 1.1.0, released 2024-06-11

Code name: Support Exasol v8

## Summary

This release adds support for Exasol v8. It also enables [SnapStart](https://docs.aws.amazon.com/lambda/latest/dg/snapstart.html) for the AWS Lambda function to speedup execution and adds the `VCPU` (total number of virtual CPUs used by the Exasol cluster) as an additional metric for Exasol v8.

## Features

* #91: Added support for Exasol v8

## Dependency Updates

### Compile Dependency Updates

* Updated `com.amazonaws:aws-lambda-java-events:3.11.4` to `3.11.5`
* Updated `software.amazon.awssdk:cloudwatch:2.25.28` to `2.25.70`
* Updated `software.amazon.awssdk:secretsmanager:2.25.28` to `2.25.70`

### Test Dependency Updates

* Updated `com.amazonaws:aws-java-sdk-s3:1.12.698` to `1.12.740`
* Updated `com.exasol:exasol-testcontainers:7.0.1` to `7.1.0`
* Updated `org.mockito:mockito-core:5.11.0` to `5.12.0`
* Updated `org.testcontainers:junit-jupiter:1.19.7` to `1.19.8`
* Updated `org.testcontainers:localstack:1.19.7` to `1.19.8`

### Plugin Dependency Updates

* Updated `com.exasol:error-code-crawler-maven-plugin:2.0.2` to `2.0.3`
* Updated `com.exasol:project-keeper-maven-plugin:4.3.0` to `4.3.3`
* Updated `org.apache.maven.plugins:maven-enforcer-plugin:3.4.1` to `3.5.0`
* Updated `org.apache.maven.plugins:maven-toolchains-plugin:3.1.0` to `3.2.0`
* Updated `org.sonarsource.scanner.maven:sonar-maven-plugin:3.11.0.3922` to `4.0.0.4121`
1 change: 1 addition & 0 deletions doc/supported_metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Currently, this adapter supports the following metrics.
* [`AUXILIARY_SIZE`](https://docs.exasol.com/db/latest/sql_references/system_tables/statistical/exa_db_size_last_day.htm)
* [`REMOTE_WRITE_DURATION`](https://docs.exasol.com/db/latest/sql_references/system_tables/statistical/exa_monitor_last_day.htm)
* [`DB_RAM_SIZE`](https://docs.exasol.com/db/latest/sql_references/system_tables/statistical/exa_system_events.htm)
* [`VCPU`](https://docs.exasol.com/db/latest/sql_references/system_tables/statistical/exa_system_events.htm) (only for Exasol v8 and later)
* [`LOCAL_READ_DURATION`](https://docs.exasol.com/db/latest/sql_references/system_tables/statistical/exa_monitor_last_day.htm)
* [`REMOTE_WRITE_SIZE`](https://docs.exasol.com/db/latest/sql_references/system_tables/statistical/exa_monitor_last_day.htm)
* [`STATISTICS_SIZE`](https://docs.exasol.com/db/latest/sql_references/system_tables/statistical/exa_db_size_last_day.htm)
Expand Down
2 changes: 1 addition & 1 deletion error_code_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ error-tags:
CWA:
packages:
- com.exasol.cloudwatch
highest-index: 35
highest-index: 36
10 changes: 5 additions & 5 deletions pk_generated_parent.pom

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

18 changes: 9 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.exasol</groupId>
<artifactId>cloudwatch-adapter</artifactId>
<version>1.0.11</version>
<version>1.1.0</version>
<name>cloudwatch-adapter</name>
<description>Makes Exasol database monitoring data available in AWS CloudWatch</description>
<url>https://github.com/exasol/cloudwatch-adapter/</url>
<properties>
<org.testcontainers.version>1.19.7</org.testcontainers.version>
<org.testcontainers.version>1.19.8</org.testcontainers.version>
<log4j.version>2.23.1</log4j.version>
<aws.sdk.version>2.25.28</aws.sdk.version>
<aws.sdk.version>2.25.70</aws.sdk.version>
</properties>
<dependencies>
<dependency>
Expand Down Expand Up @@ -41,7 +41,7 @@
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-lambda-java-events</artifactId>
<version>3.11.4</version>
<version>3.11.5</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
Expand Down Expand Up @@ -90,7 +90,7 @@
<dependency>
<groupId>com.exasol</groupId>
<artifactId>exasol-testcontainers</artifactId>
<version>7.0.1</version>
<version>7.1.0</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -102,7 +102,7 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>5.11.0</version>
<version>5.12.0</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -125,7 +125,7 @@
<!-- Required by org.testcontainer:localstack -->
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-s3</artifactId>
<version>1.12.698</version>
<version>1.12.740</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -169,7 +169,7 @@
<plugin>
<groupId>com.exasol</groupId>
<artifactId>project-keeper-maven-plugin</artifactId>
<version>4.3.0</version>
<version>4.3.3</version>
<executions>
<execution>
<goals>
Expand Down Expand Up @@ -225,7 +225,7 @@
<parent>
<artifactId>cloudwatch-adapter-generated-parent</artifactId>
<groupId>com.exasol</groupId>
<version>1.0.11</version>
<version>1.1.0</version>
<relativePath>pk_generated_parent.pom</relativePath>
</parent>
</project>
3 changes: 0 additions & 3 deletions release_config.yml

This file was deleted.

8 changes: 6 additions & 2 deletions sam/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Metadata:
LicenseUrl: ../LICENSE
ReadmeUrl: ../README.md
HomePageUrl: https://github.com/exasol/cloudwatch-adapter
SemanticVersion: 1.0.11
SemanticVersion: 1.1.0
SourceCodeUrl: https://github.com/exasol/cloudwatch-adapter

Globals:
Expand All @@ -20,7 +20,7 @@ Parameters:
Metrics:
Type: "String"
Description: "Comma separated list of the metrics to report. See https://github.com/exasol/cloudwatch-adapter for all available metrics."
Default: "RAW_OBJECT_SIZE, MEM_OBJECT_SIZE, AUXILIARY_SIZE, STATISTICS_SIZE, RECOMMENDED_DB_RAM_SIZE, STORAGE_SIZE, USE, TEMP_SIZE, OBJECT_COUNT, LOAD, CPU, TEMP_DB_RAM, PERSISTENT_DB_RAM, HDD_READ, HDD_WRITE, LOCAL_READ_SIZE, LOCAL_READ_DURATION, LOCAL_WRITE_DURATION, CACHE_READ_SIZE, CACHE_READ_DURATION, CACHE_WRITE_SIZE, CACHE_WRITE_DURATION, REMOTE_READ_SIZE, REMOTE_READ_DURATION, REMOTE_WRITE_SIZE, REMOTE_WRITE_DURATION, NET, SWAP, USERS, QUERIES, NODES, DB_RAM_SIZE, EVENT_BACKUP_END, EVENT_BACKUP_START, EVENT_BACKUP_ABORTED, BACKUP_DURATION"
Default: "RAW_OBJECT_SIZE, MEM_OBJECT_SIZE, AUXILIARY_SIZE, STATISTICS_SIZE, RECOMMENDED_DB_RAM_SIZE, STORAGE_SIZE, USE, TEMP_SIZE, OBJECT_COUNT, LOAD, CPU, TEMP_DB_RAM, PERSISTENT_DB_RAM, HDD_READ, HDD_WRITE, LOCAL_READ_SIZE, LOCAL_READ_DURATION, LOCAL_WRITE_DURATION, CACHE_READ_SIZE, CACHE_READ_DURATION, CACHE_WRITE_SIZE, CACHE_WRITE_DURATION, REMOTE_READ_SIZE, REMOTE_READ_DURATION, REMOTE_WRITE_SIZE, REMOTE_WRITE_DURATION, NET, SWAP, USERS, QUERIES, NODES, DB_RAM_SIZE, VCPU, EVENT_BACKUP_END, EVENT_BACKUP_START, EVENT_BACKUP_ABORTED, BACKUP_DURATION"
ExasolDeploymentName:
Type: "String"
Description: "A name describing the Exasol installation you want to monitor. The adapter adds this name as a dimension to the metrics in cloudwatch. This will help you to distinguish the data if you monitor more than one Exasol deployment."
Expand All @@ -46,6 +46,10 @@ Resources:
Handler: com.exasol.cloudwatch.CloudWatchAdapter
Runtime: java11
MemorySize: 512
SnapStart:
ApplyOn: PublishedVersions
EphemeralStorage:
Size: 512
VpcConfig:
SecurityGroupIds:
- !Ref SecurityGroup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
*/
enum ExasolStatisticsTableEventsMetric {
NODES(COUNT, 4), //
DB_RAM_SIZE(GIBIBYTES, 4);
DB_RAM_SIZE(GIBIBYTES, 4), //
VCPU(COUNT, 4);

private final ExasolUnit unit;
private final int reportIntervalMinutes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,33 @@ private List<ExasolMetricDatum> readResult(final List<ExasolStatisticsTableEvent
final ResultSet resultSet) throws SQLException {
final Instant now = this.clock.instant();
final List<ExasolMetricDatum> result = new ArrayList<>();
final Set<String> availableColumnLabels = getColumnLabels(resultSet);
while (resultSet.next()) {
for (final ExasolStatisticsTableEventsMetric metric : metrics) {
if (!availableColumnLabels.contains(metric.name())) {
throw new IllegalStateException(ExaError.messageBuilder("F-CWA-36").message(
"Column {{schema name|uq}}.{{table name|uq}}.{{column|uq}} not available for metric {{metric name}}.")
.parameter("schema name", getSchema())
.parameter("table name", ExasolStatisticsTable.EXA_SYSTEM_EVENTS)
.parameter("column", metric.name()).parameter("metric name", metric.name())
.mitigation("Ensure that the Exasol DB version supports this metric.").toString());
}
result.add(new ExasolMetricDatum(metric.name(), metric.getUnit(), now,
resultSet.getDouble(metric.name()), resultSet.getString("CLUSTER_NAME")));
}
}
return result;
}

private Set<String> getColumnLabels(final ResultSet resultSet) throws SQLException {
final Set<String> columnLabels = new HashSet<>();
final ResultSetMetaData metaData = resultSet.getMetaData();
for (int i = 1; i <= metaData.getColumnCount(); i++) {
columnLabels.add(metaData.getColumnLabel(i));
}
return columnLabels;
}

/**
* Build a metric query for the latest report of each cluster.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ enum ExasolStatisticsTableRegularMetric {
USERS(EXA_USAGE_LAST_DAY, COUNT), //
QUERIES(EXA_USAGE_LAST_DAY, COUNT), //
NODES(EXA_SYSTEM_EVENTS, COUNT), //
DB_RAM_SIZE(EXA_SYSTEM_EVENTS, GIBIBYTES);
DB_RAM_SIZE(EXA_SYSTEM_EVENTS, GIBIBYTES), //
VCPU(EXA_SYSTEM_EVENTS, COUNT);

private final ExasolStatisticsTable table;
private final ExasolUnit unit;
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/exasol/cloudwatch/TestConstants.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.exasol.cloudwatch;

public class TestConstants {
public static final String EXASOL_DOCKER_DB_VERSION = "7.1.25";
public static final String EXASOL_DOCKER_DB_VERSION = "8.27.0";
public static final String LOCAL_STACK_IMAGE = "localstack/localstack:2.2";
}
Loading

0 comments on commit 434ade8

Please sign in to comment.