-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
baede06
commit 2063fe6
Showing
12 changed files
with
226 additions
and
269 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* Copyright 2023 Greptime Team | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.greptime; | ||
|
||
import io.greptime.models.Column; | ||
import io.greptime.models.DataType; | ||
import io.greptime.models.Metric; | ||
|
||
/** | ||
* @author jiachun.fjc | ||
*/ | ||
@Metric(name = "mem_metric") | ||
public class Memory { | ||
@Column(name = "host", tag = true, dataType = DataType.String) | ||
private String host; | ||
|
||
@Column(name = "ts", timestamp = true, dataType = DataType.TimestampMillisecond) | ||
private long ts; | ||
|
||
@Column(name = "mem_usage", dataType = DataType.Float64) | ||
private double memUsage; | ||
|
||
public String getHost() { | ||
return host; | ||
} | ||
|
||
public void setHost(String host) { | ||
this.host = host; | ||
} | ||
|
||
public long getTs() { | ||
return ts; | ||
} | ||
|
||
public void setTs(long ts) { | ||
this.ts = ts; | ||
} | ||
|
||
public double getMemUsage() { | ||
return memUsage; | ||
} | ||
|
||
public void setMemUsage(double memUsage) { | ||
this.memUsage = memUsage; | ||
} | ||
} |
110 changes: 0 additions & 110 deletions
110
ingester-example/src/main/java/io/greptime/MyMetric1.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright 2023 Greptime Team | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.greptime; | ||
|
||
import java.io.IOException; | ||
import java.sql.Connection; | ||
import java.sql.DriverManager; | ||
import java.sql.SQLException; | ||
import java.util.Objects; | ||
import java.util.Properties; | ||
|
||
/** | ||
* @author jiachun.fjc | ||
*/ | ||
public class QueryJDBC { | ||
|
||
public static void main(String[] args) throws Exception { | ||
GreptimeDB greptimeDB = TestConnector.connectToDefaultDB(); | ||
|
||
// Inserts data first | ||
|
||
|
||
try (Connection conn = makeConnection()) { | ||
|
||
} | ||
} | ||
|
||
public static Connection makeConnection() throws IOException, ClassNotFoundException, SQLException { | ||
Properties prop = new Properties(); | ||
prop.load(QueryJDBC.class.getResourceAsStream("/db-connection.properties")); | ||
|
||
String dbName = (String) prop.get("db.database-driver"); | ||
|
||
String dbConnUrl = (String) prop.get("db.url"); | ||
String dbUserName = (String) prop.get("db.username"); | ||
String dbPassword = (String) prop.get("db.password"); | ||
|
||
Class.forName(dbName); | ||
Connection dbConn = DriverManager.getConnection(dbConnUrl, dbUserName, dbPassword); | ||
|
||
return Objects.requireNonNull(dbConn, "Failed to make connection!"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.