Skip to content

Commit a14373c

Browse files
authored
chore: minor refactor for v0.5.0 (#13)
* chore: refactor GreptimeOptions * chore: v0.5.0 * chore: require database name on start * chore: require database name on start * chore: warn on empty database name not sets * chore: add TestConnector * chore: more friendly write api * chore: shutdown on test * chore: refactor demos * chore: add jdbc demo
1 parent dad6406 commit a14373c

32 files changed

+620
-413
lines changed

ingester-all/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<artifactId>greptimedb-ingester</artifactId>
66
<groupId>io.greptime</groupId>
7-
<version>0.4.0</version>
7+
<version>0.5.0</version>
88
</parent>
99

1010
<artifactId>ingester-all</artifactId>

ingester-common/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<artifactId>greptimedb-ingester</artifactId>
66
<groupId>io.greptime</groupId>
7-
<version>0.4.0</version>
7+
<version>0.5.0</version>
88
</parent>
99

1010
<artifactId>ingester-common</artifactId>

ingester-example/pom.xml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<artifactId>greptimedb-ingester</artifactId>
66
<groupId>io.greptime</groupId>
7-
<version>0.4.0</version>
7+
<version>0.5.0</version>
88
</parent>
99

1010
<artifactId>ingester-example</artifactId>
@@ -38,5 +38,12 @@
3838
<artifactId>log4j-slf4j-impl</artifactId>
3939
<scope>compile</scope>
4040
</dependency>
41+
42+
<!-- MySQL usage dependency -->
43+
<dependency>
44+
<groupId>mysql</groupId>
45+
<artifactId>mysql-connector-java</artifactId>
46+
<version>8.0.33</version>
47+
</dependency>
4148
</dependencies>
4249
</project>

ingester-example/src/main/java/io/greptime/MyMetric2.java renamed to ingester-example/src/main/java/io/greptime/Cpu.java

Lines changed: 21 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -18,40 +18,29 @@
1818
import io.greptime.models.Column;
1919
import io.greptime.models.DataType;
2020
import io.greptime.models.Metric;
21-
import java.util.Date;
2221

2322
/**
2423
* @author jiachun.fjc
2524
*/
26-
@Metric(name = "my_metric2")
27-
public class MyMetric2 {
28-
@Column(name = "tag1", tag = true, dataType = DataType.String)
29-
private String tag1;
30-
@Column(name = "tag2", tag = true, dataType = DataType.String)
31-
private String tag2;
25+
@Metric(name = "cpu_metric")
26+
public class Cpu {
27+
@Column(name = "host", tag = true, dataType = DataType.String)
28+
private String host;
3229

33-
@Column(name = "ts", timestamp = true, dataType = DataType.TimestampSecond)
30+
@Column(name = "ts", timestamp = true, dataType = DataType.TimestampMillisecond)
3431
private long ts;
3532

36-
@Column(name = "field1", dataType = DataType.Date)
37-
private Date field1;
38-
@Column(name = "field2", dataType = DataType.Float64)
39-
private double field2;
33+
@Column(name = "cpu_user", dataType = DataType.Float64)
34+
private double cpuUser;
35+
@Column(name = "cpu_sys", dataType = DataType.Float64)
36+
private double cpuSys;
4037

41-
public String getTag1() {
42-
return tag1;
38+
public String getHost() {
39+
return host;
4340
}
4441

45-
public void setTag1(String tag1) {
46-
this.tag1 = tag1;
47-
}
48-
49-
public String getTag2() {
50-
return tag2;
51-
}
52-
53-
public void setTag2(String tag2) {
54-
this.tag2 = tag2;
42+
public void setHost(String host) {
43+
this.host = host;
5544
}
5645

5746
public long getTs() {
@@ -62,19 +51,19 @@ public void setTs(long ts) {
6251
this.ts = ts;
6352
}
6453

65-
public Date getField1() {
66-
return field1;
54+
public double getCpuUser() {
55+
return cpuUser;
6756
}
6857

69-
public void setField1(Date field1) {
70-
this.field1 = field1;
58+
public void setCpuUser(double cpuUser) {
59+
this.cpuUser = cpuUser;
7160
}
7261

73-
public double getField2() {
74-
return field2;
62+
public double getCpuSys() {
63+
return cpuSys;
7564
}
7665

77-
public void setField2(double field2) {
78-
this.field2 = field2;
66+
public void setCpuSys(double cpuSys) {
67+
this.cpuSys = cpuSys;
7968
}
8069
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* Copyright 2023 Greptime Team
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package io.greptime;
17+
18+
import io.greptime.models.Column;
19+
import io.greptime.models.DataType;
20+
import io.greptime.models.Metric;
21+
22+
/**
23+
* @author jiachun.fjc
24+
*/
25+
@Metric(name = "mem_metric")
26+
public class Memory {
27+
@Column(name = "host", tag = true, dataType = DataType.String)
28+
private String host;
29+
30+
@Column(name = "ts", timestamp = true, dataType = DataType.TimestampMillisecond)
31+
private long ts;
32+
33+
@Column(name = "mem_usage", dataType = DataType.Float64)
34+
private double memUsage;
35+
36+
public String getHost() {
37+
return host;
38+
}
39+
40+
public void setHost(String host) {
41+
this.host = host;
42+
}
43+
44+
public long getTs() {
45+
return ts;
46+
}
47+
48+
public void setTs(long ts) {
49+
this.ts = ts;
50+
}
51+
52+
public double getMemUsage() {
53+
return memUsage;
54+
}
55+
56+
public void setMemUsage(double memUsage) {
57+
this.memUsage = memUsage;
58+
}
59+
}

ingester-example/src/main/java/io/greptime/MyMetric1.java

Lines changed: 0 additions & 110 deletions
This file was deleted.

0 commit comments

Comments
 (0)