Skip to content

Commit 89d7a0b

Browse files
committed
Refine parameter for Prometheus metrics restrictions
1 parent ab677e2 commit 89d7a0b

36 files changed

+158
-37
lines changed

docs/semconv/relational-database.md

+40-10
Large diffs are not rendered by default.

ojr-dameng-db/build.gradle

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
}
55

66
group = "com.ojr"
7-
version = "0.5.1"
7+
version = "0.5.2"
88

99
java {
1010
sourceCompatibility = JavaVersion.VERSION_1_8
@@ -28,9 +28,9 @@ dependencies {
2828
implementation("io.opentelemetry.semconv:opentelemetry-semconv-incubating:1.28.0-alpha")
2929
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.18.2")
3030

31-
implementation(files("libs/ojr-core-0.6.0.jar"))
31+
implementation(files("libs/ojr-core-0.6.1.jar"))
3232
implementation(files("libs/ojr-vault-all-0.4.0.jar"))
33-
implementation(files("libs/ojr-rdb-0.5.1.jar"))
33+
implementation(files("libs/ojr-rdb-0.5.2.jar"))
3434
implementation(files("libs/DmJdbcDriver8.jar"))
3535

3636
testImplementation platform('org.junit:junit-bom:5.11.3')

ojr-dameng-db/config/config.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ instances:
1515
otel.callback.interval: 30
1616
#otel.backend.url: http://localhost:4317
1717
otel.backend.url: http://localhost:4318
18-
otel.transport: http+prometheus
18+
otel.transport: prometheus
1919
prometheus.port: 16543
20+
prometheus.restricted.metrics: db.sql.elapsed_time,db.lock.time
2021
otel.service.name: DamengA
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
package com.ojr.dameng;
2+
3+
import com.ojr.rdb.DbDcConfig;
4+
5+
import java.sql.*;
6+
import java.util.List;
7+
8+
public class DamengSimpIntegrationTest {
9+
private DamengAgent agent;
10+
11+
public void init() throws Exception {
12+
agent = new DamengAgent();
13+
agent.initEnv(DbDcConfig.class, DamengDc.class);
14+
}
15+
16+
public void testSqlStatement(Connection conn) throws SQLException {
17+
Statement stmt = null;
18+
PreparedStatement pstmt = null;
19+
ResultSet rs = null;
20+
21+
stmt = conn.createStatement();
22+
23+
String createTableSQL = "CREATE TABLE IF NOT EXISTS ojr_users (" +
24+
"id INT PRIMARY KEY AUTO_INCREMENT, " +
25+
"name VARCHAR(100), " +
26+
"email VARCHAR(100) UNIQUE)";
27+
stmt.executeUpdate(createTableSQL);
28+
29+
String insertSQL = "INSERT INTO ojr_users (name, email) VALUES (?, ?)";
30+
pstmt = conn.prepareStatement(insertSQL);
31+
pstmt.setString(1, "John Doe");
32+
pstmt.setString(2, "[email protected]");
33+
pstmt.executeUpdate();
34+
35+
pstmt.setString(1, "Jane Smith");
36+
pstmt.setString(2, "[email protected]");
37+
pstmt.executeUpdate();
38+
39+
String updateSQL = "UPDATE ojr_users SET email = ? WHERE name = ?";
40+
pstmt = conn.prepareStatement(updateSQL);
41+
pstmt.setString(1, "[email protected]");
42+
pstmt.setString(2, "John Doe");
43+
pstmt.executeUpdate();
44+
45+
String querySQL = "SELECT id, name, email FROM ojr_users";
46+
pstmt = conn.prepareStatement(querySQL);
47+
rs = pstmt.executeQuery();
48+
49+
while (rs.next()) {
50+
int id = rs.getInt("id");
51+
String name = rs.getString("name");
52+
String email = rs.getString("email");
53+
54+
System.out.printf("ID: %d, Name: %s, Email: %s%n", id, name, email);
55+
}
56+
57+
String deleteTableSQL = "DROP TABLE ojr_users";
58+
stmt.executeUpdate(deleteTableSQL);
59+
60+
rs.close();
61+
pstmt.close();
62+
stmt.close();
63+
}
64+
65+
public void test() throws Exception {
66+
List<DamengDc> dcs = agent.getDcs();
67+
if (dcs.isEmpty()) {
68+
System.err.println("No Dcs found");
69+
return;
70+
}
71+
DamengDc dc = dcs.get(0);
72+
Connection conn = dc.getConnection();
73+
for (int i = 0; i < 1000; i++)
74+
testSqlStatement(conn);
75+
conn.close();
76+
}
77+
78+
public static void main(String[] args) throws Exception {
79+
DamengSimpIntegrationTest test = new DamengSimpIntegrationTest();
80+
test.init();
81+
test.test();
82+
}
83+
}

ojr-ibmmq/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
}
55

66
group = "com.ojr"
7-
version = "0.1.2"
7+
version = "0.1.3"
88

99
java {
1010
sourceCompatibility = JavaVersion.VERSION_1_8
@@ -30,7 +30,7 @@ dependencies {
3030
implementation('org.apache.commons:commons-lang3:3.17.0')
3131
implementation('com.ibm.mq:com.ibm.mq.allclient:9.4.1.1')
3232

33-
implementation(files("libs/ojr-core-0.6.0.jar"))
33+
implementation(files("libs/ojr-core-0.6.1.jar"))
3434

3535
testImplementation platform('org.junit:junit-bom:5.11.3')
3636
testImplementation 'org.junit.jupiter:junit-jupiter'
Binary file not shown.

ojr-informix-db/build.gradle

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
}
55

66
group = "com.ojr"
7-
version = "0.4.1"
7+
version = "0.4.2"
88

99
java {
1010
sourceCompatibility = JavaVersion.VERSION_1_8
@@ -31,9 +31,9 @@ dependencies {
3131
implementation("org.apache.commons:commons-dbcp2:2.11.0")
3232
implementation("com.ibm.informix:jdbc:4.50.10")
3333

34-
implementation(files("libs/ojr-core-0.6.0.jar"))
34+
implementation(files("libs/ojr-core-0.6.1.jar"))
3535
implementation(files("libs/ojr-vault-all-0.4.0.jar"))
36-
implementation(files("libs/ojr-rdb-0.5.1.jar"))
36+
implementation(files("libs/ojr-rdb-0.5.2.jar"))
3737

3838
testImplementation platform('org.junit:junit-bom:5.11.3')
3939
testImplementation 'org.junit.jupiter:junit-jupiter'

ojr-informix-db/config/config.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ instances:
1616

1717
#OTel properties:
1818
otel.service.name: InformixDB
19+
prometheus.restricted.metrics: db.sql.elapsed_time,db.lock.time
1920

2021
#Data collector properties:
2122
#Either use `otel.poll.interval` or `custom.poll.interval`
Binary file not shown.
Binary file not shown.

ojr-linux-host/build.gradle

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
}
55

66
group = "com.ojr"
7-
version = "0.4.1"
7+
version = "0.4.2"
88

99
java {
1010
sourceCompatibility = JavaVersion.VERSION_1_8
@@ -28,8 +28,8 @@ dependencies {
2828
implementation("io.opentelemetry.semconv:opentelemetry-semconv-incubating:1.28.0-alpha")
2929
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.18.2")
3030

31-
implementation(files("libs/ojr-core-0.6.0.jar"))
32-
implementation(files("libs/ojr-host-0.5.1.jar"))
31+
implementation(files("libs/ojr-core-0.6.1.jar"))
32+
implementation(files("libs/ojr-host-0.5.2.jar"))
3333

3434
testImplementation platform('org.junit:junit-bom:5.11.3')
3535
testImplementation 'org.junit.jupiter:junit-jupiter'
Binary file not shown.

ojr-mq-appliance/build.gradle

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
}
55

66
group = "com.ojr"
7-
version = "0.4.1"
7+
version = "0.4.2"
88

99
java {
1010
sourceCompatibility = JavaVersion.VERSION_1_8
@@ -28,8 +28,8 @@ dependencies {
2828
implementation("io.opentelemetry.semconv:opentelemetry-semconv-incubating:1.28.0-alpha")
2929
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.18.2")
3030

31-
implementation(files("libs/ojr-core-0.6.0.jar"))
32-
implementation(files("libs/ojr-host-0.5.1.jar"))
31+
implementation(files("libs/ojr-core-0.6.1.jar"))
32+
implementation(files("libs/ojr-host-0.5.2.jar"))
3333

3434
testImplementation platform('org.junit:junit-bom:5.11.3')
3535
testImplementation 'org.junit.jupiter:junit-jupiter'
-45.2 KB
Binary file not shown.
45.2 KB
Binary file not shown.

ojr-oceanbase-db/build.gradle

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
}
55

66
group = "com.ojr"
7-
version = "0.4.1"
7+
version = "0.4.2"
88

99
java {
1010
sourceCompatibility = JavaVersion.VERSION_1_8
@@ -29,9 +29,9 @@ dependencies {
2929
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.18.2")
3030
implementation("mysql:mysql-connector-java:5.1.46")
3131

32-
implementation(files("libs/ojr-core-0.6.0.jar"))
32+
implementation(files("libs/ojr-core-0.6.1.jar"))
3333
implementation(files("libs/ojr-vault-all-0.4.0.jar"))
34-
implementation(files("libs/ojr-rdb-0.5.1.jar"))
34+
implementation(files("libs/ojr-rdb-0.5.2.jar"))
3535

3636
testImplementation platform('org.junit:junit-bom:5.11.3')
3737
testImplementation 'org.junit.jupiter:junit-jupiter'

ojr-oceanbase-db/config/config.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ instances:
1818
otel.backend.url: http://localhost:4318
1919
otel.transport: http+prometheus
2020
prometheus.port: 16543
21+
prometheus.restricted.metrics: db.sql.elapsed_time,db.lock.time
2122
otel.service.name: OBCluster1
2223
otel.service.instance.id: cluster@OBCluster1
2324

@@ -37,5 +38,6 @@ instances:
3738
otel.backend.url: http://localhost:4318
3839
otel.transport: http+prometheus
3940
prometheus.port: 16543
41+
prometheus.restricted.metrics: db.sql.elapsed_time,db.lock.time
4042
otel.service.name: OBCluster1
4143
otel.service.instance.id: test1@OBCluster1
-45.2 KB
Binary file not shown.
45.2 KB
Binary file not shown.

ojr-snmp-host/build.gradle

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
}
55

66
group = "com.ojr"
7-
version = "0.4.1"
7+
version = "0.4.2"
88

99
java {
1010
sourceCompatibility = JavaVersion.VERSION_1_8
@@ -29,9 +29,9 @@ dependencies {
2929
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.18.2")
3030
implementation("org.snmp4j:snmp4j-agent:3.8.1")
3131

32-
implementation(files("libs/ojr-core-0.6.0.jar"))
32+
implementation(files("libs/ojr-core-0.6.1.jar"))
3333
implementation(files("libs/ojr-snmp-0.4.0.jar"))
34-
implementation(files("libs/ojr-host-0.5.1.jar"))
34+
implementation(files("libs/ojr-host-0.5.2.jar"))
3535

3636
testImplementation platform('org.junit:junit-bom:5.11.3')
3737
testImplementation 'org.junit.jupiter:junit-jupiter'

ojr-snmp-host/libs/ojr-core-0.6.0.jar

-45.2 KB
Binary file not shown.

ojr-snmp-host/libs/ojr-core-0.6.1.jar

45.2 KB
Binary file not shown.
Binary file not shown.

sdk/ojr-core/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
}
55

66
group = "com.ojr"
7-
version = "0.6.0"
7+
version = "0.6.1"
88

99
java {
1010
sourceCompatibility = JavaVersion.VERSION_1_8

sdk/ojr-core/src/main/java/com/ojr/core/metric/PrometheusMergedReader.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,14 @@ private boolean isMetricRestricted(String metricName) {
3030
if (metricRestrictions == null)
3131
return false;
3232

33+
if (metricName == null)
34+
return true;
35+
3336
for (String metricRestriction : metricRestrictions) {
34-
if (metricRestriction.equals(metricName))
37+
if (metricName.startsWith(metricRestriction))
3538
return true;
3639
}
40+
3741
return false;
3842
}
3943

templates/ojr-host/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
}
55

66
group = "com.ojr"
7-
version = "0.5.1"
7+
version = "0.5.2"
88

99
java {
1010
sourceCompatibility = JavaVersion.VERSION_1_8
@@ -28,7 +28,7 @@ dependencies {
2828
api("io.opentelemetry.semconv:opentelemetry-semconv-incubating:1.28.0-alpha")
2929
api("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.18.2")
3030

31-
implementation(files("libs/ojr-core-0.6.0.jar"))
31+
implementation(files("libs/ojr-core-0.6.1.jar"))
3232

3333
testImplementation platform('org.junit:junit-bom:5.11.3')
3434
testImplementation 'org.junit.jupiter:junit-jupiter'
-45.2 KB
Binary file not shown.
45.2 KB
Binary file not shown.

templates/ojr-rdb/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
}
55

66
group = "com.ojr"
7-
version = "0.5.1"
7+
version = "0.5.2"
88

99
java {
1010
sourceCompatibility = JavaVersion.VERSION_1_8
@@ -28,7 +28,7 @@ dependencies {
2828
api("io.opentelemetry.semconv:opentelemetry-semconv-incubating:1.28.0-alpha")
2929
api("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.18.2")
3030

31-
implementation(files("libs/ojr-core-0.6.0.jar"))
31+
implementation(files("libs/ojr-core-0.6.1.jar"))
3232
implementation(files("libs/ojr-vault-all-0.4.0.jar"))
3333

3434
testImplementation platform('org.junit:junit-bom:5.11.3')
-45.2 KB
Binary file not shown.
45.2 KB
Binary file not shown.

0 commit comments

Comments
 (0)