diff --git a/.github/workflows/broken_links_checker.yml b/.github/workflows/broken_links_checker.yml
index d7a38b4..39612b7 100644
--- a/.github/workflows/broken_links_checker.yml
+++ b/.github/workflows/broken_links_checker.yml
@@ -13,6 +13,8 @@ on:
jobs:
linkChecker:
runs-on: ubuntu-latest
+ permissions:
+ contents: read
defaults:
run:
shell: "bash"
diff --git a/.github/workflows/ci-build-next-java.yml b/.github/workflows/ci-build-next-java.yml
index 8886e10..e8302fe 100644
--- a/.github/workflows/ci-build-next-java.yml
+++ b/.github/workflows/ci-build-next-java.yml
@@ -15,7 +15,6 @@ jobs:
shell: "bash"
permissions:
contents: read
- checks: write # Allow scacap/action-surefire-report
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
@@ -35,9 +34,3 @@ jobs:
mvn --batch-mode --update-snapshots clean package -DtrimStackTrace=false \
-Djava.version=17 \
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
- - name: Publish Test Report for Java 17
- uses: scacap/action-surefire-report@v1
- if: ${{ always() && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' }}
- with:
- github_token: ${{ secrets.GITHUB_TOKEN }}
- fail_if_no_tests: false
diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml
index bb1e92b..b6bd052 100644
--- a/.github/workflows/ci-build.yml
+++ b/.github/workflows/ci-build.yml
@@ -15,8 +15,7 @@ jobs:
shell: bash
}
permissions: {
- contents: read,
- checks: write
+ contents: read
}
concurrency: {
group: '${{ github.workflow }}-${{ github.ref }}-${{ matrix.exasol_db_version }}',
@@ -26,11 +25,12 @@ jobs:
fail-fast: false
matrix:
exasol_db_version: [
+ 8.27.0,
7.1.26
]
env: {
- DEFAULT_EXASOL_DB_VERSION: 7.1.26
+ DEFAULT_EXASOL_DB_VERSION: 8.27.0
}
steps:
- name: Free Disk Space
diff --git a/.github/workflows/dependencies_update.yml b/.github/workflows/dependencies_update.yml
index 9f536ee..0fa7180 100644
--- a/.github/workflows/dependencies_update.yml
+++ b/.github/workflows/dependencies_update.yml
@@ -61,14 +61,6 @@ jobs:
env: {
CREATED_ISSUES: '${{ inputs.vulnerability_issues }}'
}
- - name: Project Keeper Fix
- id: project-keeper-fix
- run: |
- mvn --batch-mode com.exasol:project-keeper-maven-plugin:fix --projects .
- - name: Project Keeper Fix for updated Project Keeper version
- id: project-keeper-fix-2
- run: |
- mvn --batch-mode com.exasol:project-keeper-maven-plugin:fix --projects .
- name: Generate Pull Request comment
id: pr-comment
run: |
@@ -81,7 +73,11 @@ jobs:
echo 'It updates dependencies.' >> "$GITHUB_OUTPUT"
fi
echo >> "$GITHUB_OUTPUT"
- echo '# ⚠️ This PR does not trigger CI workflows by default ⚠️' >> "$GITHUB_OUTPUT"
+ echo '# ⚠️ Notes ⚠️' >> "$GITHUB_OUTPUT"
+ echo '## Run PK fix manually' >> "$GITHUB_OUTPUT"
+ echo 'Due to restrictions workflow `dependencies_update.yml` cannot update other workflows, see https://github.com/exasol/project-keeper/issues/578 for details.' >> "$GITHUB_OUTPUT"
+ echo 'Please checkout this PR locally and run `mvn com.exasol:project-keeper-maven-plugin:fix --projects .`' >> "$GITHUB_OUTPUT"
+ echo '## This PR does not trigger CI workflows' >> "$GITHUB_OUTPUT"
echo 'Please click the **Close pull request** button and then **Reopen pull request** to trigger running checks.' >> "$GITHUB_OUTPUT"
echo 'See https://github.com/exasol/project-keeper/issues/534 for details.' >> "$GITHUB_OUTPUT"
echo 'EOF' >> "$GITHUB_OUTPUT"
diff --git a/.project-keeper.yml b/.project-keeper.yml
index 899912b..22e479c 100644
--- a/.project-keeper.yml
+++ b/.project-keeper.yml
@@ -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
diff --git a/ci-isolation/pom.xml b/ci-isolation/pom.xml
index 4da9313..9ca6180 100644
--- a/ci-isolation/pom.xml
+++ b/ci-isolation/pom.xml
@@ -20,7 +20,7 @@
software.amazon.awscdk
aws-cdk-lib
- 2.136.1
+ 2.145.0
software.constructs
@@ -44,7 +44,7 @@
org.codehaus.mojo
exec-maven-plugin
- 3.2.0
+ 3.3.0
com.exasol.adapter.document.files.ciisolation.CiIsolationApp
diff --git a/dependencies.md b/dependencies.md
index 247f235..95158f5 100644
--- a/dependencies.md
+++ b/dependencies.md
@@ -43,7 +43,7 @@
| Dependency | License |
| ------------------------------------------------------- | ------------------------------------- |
| [SonarQube Scanner for Maven][30] | [GNU LGPL 3][31] |
-| [Apache Maven Toolchains Plugin][32] | [Apache License, Version 2.0][8] |
+| [Apache Maven Toolchains Plugin][32] | [Apache-2.0][8] |
| [Apache Maven Compiler Plugin][33] | [Apache-2.0][8] |
| [Apache Maven Enforcer Plugin][34] | [Apache-2.0][8] |
| [Maven Flatten Plugin][35] | [Apache Software Licenese][8] |
diff --git a/doc/changes/changelog.md b/doc/changes/changelog.md
index 2d15d73..03355e4 100644
--- a/doc/changes/changelog.md
+++ b/doc/changes/changelog.md
@@ -1,5 +1,6 @@
# Changes
+* [1.1.0](changes_1.1.0.md)
* [1.0.11](changes_1.0.11.md)
* [1.0.10](changes_1.0.10.md)
* [1.0.9](changes_1.0.9.md)
diff --git a/doc/changes/changes_1.1.0.md b/doc/changes/changes_1.1.0.md
new file mode 100644
index 0000000..97c7d99
--- /dev/null
+++ b/doc/changes/changes_1.1.0.md
@@ -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`
diff --git a/doc/supported_metrics.md b/doc/supported_metrics.md
index cf5c3f1..a7a5122 100644
--- a/doc/supported_metrics.md
+++ b/doc/supported_metrics.md
@@ -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)
diff --git a/error_code_config.yml b/error_code_config.yml
index 92e6725..07277ca 100644
--- a/error_code_config.yml
+++ b/error_code_config.yml
@@ -2,4 +2,4 @@ error-tags:
CWA:
packages:
- com.exasol.cloudwatch
- highest-index: 35
\ No newline at end of file
+ highest-index: 36
diff --git a/pk_generated_parent.pom b/pk_generated_parent.pom
index 216820b..79de1bb 100644
--- a/pk_generated_parent.pom
+++ b/pk_generated_parent.pom
@@ -3,7 +3,7 @@
4.0.0
com.exasol
cloudwatch-adapter-generated-parent
- 1.0.11
+ 1.1.0
pom
UTF-8
@@ -39,12 +39,12 @@
org.sonarsource.scanner.maven
sonar-maven-plugin
- 3.11.0.3922
+ 4.0.0.4121
org.apache.maven.plugins
maven-toolchains-plugin
- 3.1.0
+ 3.2.0
@@ -77,7 +77,7 @@
org.apache.maven.plugins
maven-enforcer-plugin
- 3.4.1
+ 3.5.0
enforce-maven
@@ -265,7 +265,7 @@
com.exasol
error-code-crawler-maven-plugin
- 2.0.2
+ 2.0.3
verify
diff --git a/pom.xml b/pom.xml
index 16fa4a4..f7fec96 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,14 +3,14 @@
4.0.0
com.exasol
cloudwatch-adapter
- 1.0.11
+ 1.1.0
cloudwatch-adapter
Makes Exasol database monitoring data available in AWS CloudWatch
https://github.com/exasol/cloudwatch-adapter/
- 1.19.7
+ 1.19.8
2.23.1
- 2.25.28
+ 2.25.70
@@ -41,7 +41,7 @@
com.amazonaws
aws-lambda-java-events
- 3.11.4
+ 3.11.5
com.amazonaws
@@ -90,7 +90,7 @@
com.exasol
exasol-testcontainers
- 7.0.1
+ 7.1.0
test
@@ -102,7 +102,7 @@
org.mockito
mockito-core
- 5.11.0
+ 5.12.0
test
@@ -125,7 +125,7 @@
com.amazonaws
aws-java-sdk-s3
- 1.12.698
+ 1.12.740
test
@@ -169,7 +169,7 @@
com.exasol
project-keeper-maven-plugin
- 4.3.0
+ 4.3.3
@@ -225,7 +225,7 @@
cloudwatch-adapter-generated-parent
com.exasol
- 1.0.11
+ 1.1.0
pk_generated_parent.pom
diff --git a/release_config.yml b/release_config.yml
deleted file mode 100644
index 45f75e8..0000000
--- a/release_config.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-release-platforms:
- - GitHub
-language: Java
diff --git a/sam/template.yaml b/sam/template.yaml
index f8f3b9b..f69ab36 100644
--- a/sam/template.yaml
+++ b/sam/template.yaml
@@ -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:
@@ -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."
@@ -46,6 +46,10 @@ Resources:
Handler: com.exasol.cloudwatch.CloudWatchAdapter
Runtime: java11
MemorySize: 512
+ SnapStart:
+ ApplyOn: PublishedVersions
+ EphemeralStorage:
+ Size: 512
VpcConfig:
SecurityGroupIds:
- !Ref SecurityGroup
diff --git a/src/main/java/com/exasol/cloudwatch/exasolmetrics/ExasolStatisticsTableEventsMetric.java b/src/main/java/com/exasol/cloudwatch/exasolmetrics/ExasolStatisticsTableEventsMetric.java
index e0fa22c..2f18f97 100644
--- a/src/main/java/com/exasol/cloudwatch/exasolmetrics/ExasolStatisticsTableEventsMetric.java
+++ b/src/main/java/com/exasol/cloudwatch/exasolmetrics/ExasolStatisticsTableEventsMetric.java
@@ -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;
diff --git a/src/main/java/com/exasol/cloudwatch/exasolmetrics/ExasolStatisticsTableEventsMetricReader.java b/src/main/java/com/exasol/cloudwatch/exasolmetrics/ExasolStatisticsTableEventsMetricReader.java
index 8974c77..e1b3bca 100644
--- a/src/main/java/com/exasol/cloudwatch/exasolmetrics/ExasolStatisticsTableEventsMetricReader.java
+++ b/src/main/java/com/exasol/cloudwatch/exasolmetrics/ExasolStatisticsTableEventsMetricReader.java
@@ -68,8 +68,17 @@ private List readResult(final List result = new ArrayList<>();
+ final Set 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")));
}
@@ -77,6 +86,15 @@ private List readResult(final List getColumnLabels(final ResultSet resultSet) throws SQLException {
+ final Set 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.
*
diff --git a/src/main/java/com/exasol/cloudwatch/exasolmetrics/ExasolStatisticsTableRegularMetric.java b/src/main/java/com/exasol/cloudwatch/exasolmetrics/ExasolStatisticsTableRegularMetric.java
index be82c0e..696bece 100644
--- a/src/main/java/com/exasol/cloudwatch/exasolmetrics/ExasolStatisticsTableRegularMetric.java
+++ b/src/main/java/com/exasol/cloudwatch/exasolmetrics/ExasolStatisticsTableRegularMetric.java
@@ -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;
diff --git a/src/test/java/com/exasol/cloudwatch/TestConstants.java b/src/test/java/com/exasol/cloudwatch/TestConstants.java
index 08e0f1e..99c671f 100644
--- a/src/test/java/com/exasol/cloudwatch/TestConstants.java
+++ b/src/test/java/com/exasol/cloudwatch/TestConstants.java
@@ -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";
}
diff --git a/src/test/java/com/exasol/cloudwatch/exasolmetrics/ExaSystemEventsMockTable.java b/src/test/java/com/exasol/cloudwatch/exasolmetrics/ExaSystemEventsMockTable.java
index ddd1e45..f429426 100644
--- a/src/test/java/com/exasol/cloudwatch/exasolmetrics/ExaSystemEventsMockTable.java
+++ b/src/test/java/com/exasol/cloudwatch/exasolmetrics/ExaSystemEventsMockTable.java
@@ -18,6 +18,7 @@ class ExaSystemEventsMockTable implements AutoCloseable {
private final Connection exasolConnection;
private final Statement statement;
private final Calendar timeZoneCalendar;
+ private final String dbVersion;
ExaSystemEventsMockTable(final Connection exasolConnection) throws SQLException {
this(exasolConnection, TimeZone.getTimeZone("UTC"));
@@ -30,6 +31,15 @@ private ExaSystemEventsMockTable(final Connection exasolConnection, final TimeZo
this.statement.executeUpdate(
"CREATE TABLE " + MOCK_SCHEMA + "." + EXA_SYSTEM_EVENTS + " LIKE EXA_STATISTICS." + EXA_SYSTEM_EVENTS);
this.timeZoneCalendar = Calendar.getInstance(timeZone);
+ this.dbVersion = getDbVersion(statement);
+ }
+
+ private static String getDbVersion(final Statement stmt) throws SQLException {
+ try (ResultSet rs = stmt
+ .executeQuery("select PARAM_VALUE from SYS.EXA_METADATA where PARAM_NAME='databaseProductVersion'")) {
+ assertTrue(rs.next());
+ return rs.getString(1);
+ }
}
static ExaSystemEventsMockTable forDbTimeZone(final Connection exasolConnection) throws SQLException {
@@ -61,23 +71,40 @@ private static String convertTimeZoneId(final String timeZoneId) {
void insert(final Instant measureTime, final double dbRamSize, final int nodes, final String clusterName)
throws SQLException {
- insert(measureTime, null, dbRamSize, nodes, clusterName);
+ insert(measureTime, null, dbRamSize, nodes, clusterName, null);
+ }
+
+ void insert(final Instant measureTime, final double dbRamSize, final int nodes, final String clusterName,
+ final int vcpu) throws SQLException {
+ insert(measureTime, null, dbRamSize, nodes, clusterName, vcpu);
}
void insert(final Instant measureTime, final String clusterName, final String eventType) throws SQLException {
- insert(measureTime, eventType, 0, 0, clusterName);
+ insert(measureTime, eventType, 0, 0, clusterName, null);
}
private void insert(final Instant measureTime, final String eventType, final double dbRamSize, final int nodes,
- final String clusterName) throws SQLException {
- final PreparedStatement insertStatement = this.exasolConnection.prepareStatement(
- "INSERT INTO " + MOCK_SCHEMA + "." + EXA_SYSTEM_EVENTS + " VALUES(?, ?, ?, '',? ,? , '')");
- insertStatement.setString(1, clusterName);
- insertStatement.setTimestamp(2, Timestamp.from(measureTime), this.timeZoneCalendar);
- insertStatement.setString(3, eventType);
- insertStatement.setInt(4, nodes);
- insertStatement.setDouble(5, dbRamSize);
- insertStatement.executeUpdate();
+ final String clusterName, final Integer vcpu) throws SQLException {
+ String sql = "INSERT INTO " + MOCK_SCHEMA + "." + EXA_SYSTEM_EVENTS + " VALUES(?, ?, ?, '',? ,? , ''";
+ if (isExasol8()) {
+ sql += ",?";
+ }
+ sql += ")";
+ try (final PreparedStatement insertStatement = this.exasolConnection.prepareStatement(sql)) {
+ insertStatement.setString(1, clusterName);
+ insertStatement.setTimestamp(2, Timestamp.from(measureTime), this.timeZoneCalendar);
+ insertStatement.setString(3, eventType);
+ insertStatement.setInt(4, nodes);
+ insertStatement.setDouble(5, dbRamSize);
+ if (isExasol8()) {
+ insertStatement.setObject(6, vcpu);
+ }
+ insertStatement.executeUpdate();
+ }
+ }
+
+ private boolean isExasol8() {
+ return dbVersion.startsWith("8");
}
@Override
@@ -86,4 +113,4 @@ public void close() throws SQLException {
this.statement.executeUpdate("DROP SCHEMA " + MOCK_SCHEMA);
this.statement.close();
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/com/exasol/cloudwatch/exasolmetrics/ExasolBackupDurationReaderIT.java b/src/test/java/com/exasol/cloudwatch/exasolmetrics/ExasolBackupDurationReaderIT.java
index 01235ed..35bbbd4 100644
--- a/src/test/java/com/exasol/cloudwatch/exasolmetrics/ExasolBackupDurationReaderIT.java
+++ b/src/test/java/com/exasol/cloudwatch/exasolmetrics/ExasolBackupDurationReaderIT.java
@@ -36,7 +36,7 @@ class ExasolBackupDurationReaderIT {
private Connection exasolConnection;
@BeforeEach
- void beforeEach() throws SQLException {
+ void beforeEach() {
this.exasolConnection = EXASOL.createConnection();
}
@@ -61,7 +61,7 @@ void noMetricSpecifiedReturnsNothing() throws SQLException {
}
}
- private List runReaderWithoutEvent(final Instant someWhen) throws SQLException {
+ private List runReaderWithoutEvent(final Instant someWhen) {
return runReader(someWhen, emptyList());
}
@@ -220,20 +220,20 @@ void logsWarningForSkippedPointsDueToTimeshift(final Capturable stdOutStream) th
}
@Test
- void failsWithSqlExceptionWhenTableIsMissing() throws SQLException {
+ void failsWithSqlExceptionWhenTableIsMissing() {
final IllegalStateException exception = assertThrows(IllegalStateException.class, () -> runReader(NOW));
assertThat(exception.getMessage(), startsWith("F-CWA-35: Failed to execute query"));
- assertThat(exception.getCause().getMessage(),
- startsWith("object \"MOCK_SCHEMA\".\"EXA_SYSTEM_EVENTS\" not found"));
+ assertThat(exception.getCause().getMessage().replace("\"", ""),
+ startsWith("object MOCK_SCHEMA.EXA_SYSTEM_EVENTS not found"));
}
- private void assertNoBackupDuration(final Instant someWhen) throws SQLException {
- assertThat(runReader(NOW), hasSize(0));
+ private void assertNoBackupDuration(final Instant someWhen) {
+ assertThat(runReader(someWhen), hasSize(0));
}
private void assertBackupDuration(final Instant someWhen, final String expectedCluster,
- final Instant expectedTimestamp, final double expectedDuration) throws SQLException {
- final List metrics = runReader(NOW);
+ final Instant expectedTimestamp, final double expectedDuration) {
+ final List metrics = runReader(someWhen);
assertThat(metrics, hasSize(1));
assertMetricDatum(metrics.get(0), expectedCluster, expectedTimestamp, expectedDuration);
}
@@ -247,11 +247,11 @@ private void assertMetricDatum(final ExasolMetricDatum actualMetricDatum, final
() -> assertThat("backup duration", actualMetricDatum.getValue(), closeTo(expectedDuration, 0.000001)));
}
- private List runReader(final Instant someWhen) throws SQLException {
+ private List runReader(final Instant someWhen) {
return runReader(someWhen, List.of("BACKUP_DURATION"));
}
- private List runReader(final Instant someWhen, final List events) throws SQLException {
+ private List runReader(final Instant someWhen, final List events) {
final ExasolMetricReader reader = new ExasolBackupDurationReaderFactory().getReader(EXASOL.createConnection(),
ExaSystemEventsMockTable.MOCK_SCHEMA);
return reader.readMetrics(events, someWhen);
diff --git a/src/test/java/com/exasol/cloudwatch/exasolmetrics/ExasolEventMetricsReaderIT.java b/src/test/java/com/exasol/cloudwatch/exasolmetrics/ExasolEventMetricsReaderIT.java
index 3418927..aa801ac 100644
--- a/src/test/java/com/exasol/cloudwatch/exasolmetrics/ExasolEventMetricsReaderIT.java
+++ b/src/test/java/com/exasol/cloudwatch/exasolmetrics/ExasolEventMetricsReaderIT.java
@@ -38,7 +38,7 @@ class ExasolEventMetricsReaderIT {
private Connection exasolConnection;
@BeforeEach
- void beforeEach() throws SQLException {
+ void beforeEach() {
this.exasolConnection = EXASOL.createConnection();
}
@@ -175,19 +175,19 @@ void logsWarningForSkippedPointsDueToTimeshift(final Capturable stdOutStream) th
}
@Test
- void failsWithSqlExceptionWhenTableIsMissing() throws SQLException {
+ void failsWithSqlExceptionWhenTableIsMissing() {
final IllegalStateException exception = assertThrows(IllegalStateException.class,
() -> runReader(NOW, "EVENT_BACKUP_START"));
assertThat(exception.getMessage(), startsWith("F-CWA-22: Failed to execute query"));
- assertThat(exception.getCause().getMessage(),
- startsWith("object \"MOCK_SCHEMA\".\"EXA_SYSTEM_EVENTS\" not found"));
+ assertThat(exception.getCause().getMessage().replace("\"", ""),
+ startsWith("object MOCK_SCHEMA.EXA_SYSTEM_EVENTS not found"));
}
- private List runReader(final Instant someWhen, final String... events) throws SQLException {
+ private List runReader(final Instant someWhen, final String... events) {
return runReader(someWhen, asList(events));
}
- private List runReader(final Instant someWhen, final List events) throws SQLException {
+ private List runReader(final Instant someWhen, final List events) {
final ExasolMetricReader reader = new ExasolEventMetricsReaderFactory().getReader(EXASOL.createConnection(),
ExaSystemEventsMockTable.MOCK_SCHEMA);
return reader.readMetrics(events, someWhen);
diff --git a/src/test/java/com/exasol/cloudwatch/exasolmetrics/ExasolStatisticsTableEventsMetricReaderIT.java b/src/test/java/com/exasol/cloudwatch/exasolmetrics/ExasolStatisticsTableEventsMetricReaderIT.java
index 91c8361..fb9cd56 100644
--- a/src/test/java/com/exasol/cloudwatch/exasolmetrics/ExasolStatisticsTableEventsMetricReaderIT.java
+++ b/src/test/java/com/exasol/cloudwatch/exasolmetrics/ExasolStatisticsTableEventsMetricReaderIT.java
@@ -5,6 +5,8 @@
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*;
import static org.junit.jupiter.api.Assertions.assertAll;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
import java.sql.Connection;
import java.sql.SQLException;
@@ -29,7 +31,7 @@ class ExasolStatisticsTableEventsMetricReaderIT {
private static final Instant NOW = Instant.parse("2007-12-03T10:15:30.00Z");
@BeforeAll
- static void beforeAll() throws SQLException {
+ static void beforeAll() {
exasolConnection = EXASOL.createConnection();
}
@@ -73,6 +75,49 @@ void testTwoMetricsRequested() throws SQLException {
}
}
+ @Test
+ void testVcpuMetricOnExasol8() throws SQLException {
+ assumeExasol8();
+ try (final ExaSystemEventsMockTable mockTable = new ExaSystemEventsMockTable(exasolConnection)) {
+ final Instant someWhen = Instant.ofEpochSecond(0);
+ mockTable.insert(someWhen, 10, 2, "MAIN");
+ mockTable.insert(someWhen.plus(Duration.ofHours(1)), 100, 4, "MAIN", 7);
+ mockTable.insert(someWhen.minus(Duration.ofHours(1)), 5, 1, "MAIN", 3);
+ final List result = runReader(someWhen, "VCPU");
+ assertAll( //
+ () -> assertThat(result, hasSize(1)), //
+ () -> assertThat(result.get(0).getMetricName(), equalTo("VCPU")), //
+ () -> assertThat(result.get(0).getClusterName(), equalTo("MAIN")), //
+ () -> assertThat(result.get(0).getUnit(), equalTo(ExasolUnit.COUNT)), //
+ () -> assertThat(result.get(0).getValue(), equalTo(7.0)), //
+ () -> assertThat(result.get(0).getTimestamp(), equalTo(NOW)));
+ }
+ }
+
+ @Test
+ void testVcpuMetricFailsOnExasol71() throws SQLException {
+ assumeExasol71();
+ try (final ExaSystemEventsMockTable mockTable = new ExaSystemEventsMockTable(exasolConnection)) {
+ final Instant someWhen = Instant.ofEpochSecond(0);
+ mockTable.insert(someWhen, 10, 2, "MAIN");
+ mockTable.insert(someWhen.plus(Duration.ofHours(1)), 100, 4, "MAIN", 7);
+ mockTable.insert(someWhen.minus(Duration.ofHours(1)), 5, 1, "MAIN", 3);
+ final IllegalStateException exception = assertThrows(IllegalStateException.class,
+ () -> runReader(someWhen, "VCPU"));
+ assertThat(exception.getMessage(), equalTo(
+ "F-CWA-36: Column MOCK_SCHEMA.EXA_SYSTEM_EVENTS.VCPU not available for metric 'VCPU'. Ensure that the Exasol DB version supports this metric."));
+ }
+ }
+
+ private void assumeExasol8() {
+ assumeTrue(EXASOL.getDockerImageReference().getMajor() >= 8);
+ }
+
+ private void assumeExasol71() {
+ assumeTrue(
+ EXASOL.getDockerImageReference().getMajor() == 7 && EXASOL.getDockerImageReference().getMinor() == 1);
+ }
+
@Test
void testLatestIsReported() throws SQLException {
try (final ExaSystemEventsMockTable mockTable = new ExaSystemEventsMockTable(exasolConnection)) {
@@ -124,4 +169,4 @@ private List runReader(final Instant someWhen, final String..
exasolConnection, ExaSystemEventsMockTable.MOCK_SCHEMA, Clock.fixed(NOW, ZoneId.of("UTC")));
return reader.readMetrics(asList(metrics), someWhen.plus(Duration.ofHours(100)));
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/com/exasol/cloudwatch/exasolmetrics/ExasolStatisticsTableRegularMetricReaderIT.java b/src/test/java/com/exasol/cloudwatch/exasolmetrics/ExasolStatisticsTableRegularMetricReaderIT.java
index 547be7c..0e061c9 100644
--- a/src/test/java/com/exasol/cloudwatch/exasolmetrics/ExasolStatisticsTableRegularMetricReaderIT.java
+++ b/src/test/java/com/exasol/cloudwatch/exasolmetrics/ExasolStatisticsTableRegularMetricReaderIT.java
@@ -43,7 +43,7 @@ class ExasolStatisticsTableRegularMetricReaderIT {
private static Connection connection;
@BeforeAll
- static void beforeAll() throws SQLException {
+ static void beforeAll() {
connection = EXASOL.createConnection();
}
@@ -143,4 +143,4 @@ private List runQueryForMinuteOnMockTable(final Instant minut
return exasolStatisticsTableMetricReader.readMetrics(List.of("USERS", "QUERIES"), minuteToQuery);
}
}
-}
\ No newline at end of file
+}