forked from apache/paimon
-
Notifications
You must be signed in to change notification settings - Fork 0
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
d2ddaa9
commit 4bb3013
Showing
22 changed files
with
285 additions
and
49 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
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
59 changes: 59 additions & 0 deletions
59
paimon-core/src/main/java/org/apache/paimon/metrics/MetricRepository.java
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 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you 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 org.apache.paimon.metrics; | ||
|
||
import java.util.Queue; | ||
import java.util.concurrent.ConcurrentLinkedQueue; | ||
|
||
/** A Table level repostory for metricGroup. */ | ||
public class MetricRepository { | ||
private final Queue<MetricGroup> metricGroups = new ConcurrentLinkedQueue<>(); | ||
private final String tableName; | ||
private final String metricName; | ||
|
||
private final String repositoryName; | ||
|
||
public MetricRepository(String tableName, String metricName) { | ||
this.tableName = tableName; | ||
this.metricName = metricName; | ||
this.repositoryName = String.format("%s-%s", tableName, metricName); | ||
Metrics.getInstance().addMetricRepository(repositoryName, this); | ||
} | ||
|
||
public String getTableName() { | ||
return tableName; | ||
} | ||
|
||
public String getMetricName() { | ||
return metricName; | ||
} | ||
|
||
public void registerMetricGroup(MetricGroup metricGroup) { | ||
metricGroups.offer(metricGroup); | ||
} | ||
|
||
public Queue<MetricGroup> getMetricGroups() { | ||
return metricGroups; | ||
} | ||
|
||
public void close() { | ||
Metrics.getInstance().removeMetricRepository(repositoryName); | ||
metricGroups.clear(); | ||
} | ||
} |
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
47 changes: 47 additions & 0 deletions
47
paimon-core/src/main/java/org/apache/paimon/metrics/groups/WriterMetricGroup.java
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,47 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you 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 org.apache.paimon.metrics.groups; | ||
|
||
import org.apache.paimon.metrics.AbstractMetricGroup; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
/** A Writer MetricGroup {@link org.apache.paimon.metrics.MetricGroup}. */ | ||
public class WriterMetricGroup extends AbstractMetricGroup { | ||
|
||
private final String groupName; | ||
|
||
WriterMetricGroup(final Map<String, String> tags, final String groupName) { | ||
super(tags); | ||
this.groupName = groupName; | ||
} | ||
|
||
public static WriterMetricGroup createWriterMetricGroup( | ||
final String table, final String groupName, final Map<String, String> externTags) { | ||
Map<String, String> tags = new HashMap<>(externTags); | ||
tags.put("table", table); | ||
return new WriterMetricGroup(tags, groupName); | ||
} | ||
|
||
@Override | ||
public String getGroupName() { | ||
return groupName; | ||
} | ||
} |
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
Oops, something went wrong.