World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.
Java ai-catalogdata-catalogdatalakefederated-querylakehousemetadatametalakemodel-catalogopendatacatalogskycomputingstratosphere
[#8596] improvement(metrics): add metrics for backend meta service (#8606)
mchadese1fcc7595975
diff --git a/LICENSE.bin b/LICENSE.binindex 170ff65639..753915e4d4 100644--- a/LICENSE.bin+++ b/LICENSE.bin@@ -465,6 +465,7 @@This product bundles various third-party components also under theEclipse Public License 2.0+ Eclipse AspectJEclipse JettyEclipse JerseyEclipse GlassFishdiff --git a/core/build.gradle.kts b/core/build.gradle.ktsindex c353771f92..38dfc219de 100644--- a/core/build.gradle.kts+++ b/core/build.gradle.kts@@ -24,12 +24,14 @@ plugins {id("idea")alias(libs.plugins.jcstress)alias(libs.plugins.jmh)+ alias(libs.plugins.aspectj.post.compile.weaving)}dependencies {implementation(project(":api"))implementation(project(":common"))implementation(project(":catalogs:catalog-common"))+ implementation(libs.aspectj.aspectjrt)implementation(libs.bundles.log4j)implementation(libs.bundles.metrics)implementation(libs.bundles.prometheus)@@ -71,6 +73,7 @@ dependencies {testRuntimeOnly(libs.junit.jupiter.engine)jcstressImplementation(libs.mockito.core)+ jcstressImplementation(libs.aspectj.aspectjrt)}tasks.test {diff --git a/core/src/main/java/org/apache/gravitino/metrics/MethodMonitorAspect.java b/core/src/main/java/org/apache/gravitino/metrics/MethodMonitorAspect.javanew file mode 100644index 0000000000..7e081cd82b--- /dev/null+++ b/core/src/main/java/org/apache/gravitino/metrics/MethodMonitorAspect.java@@ -0,0 +1,81 @@+/*+ * 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.gravitino.metrics;++import com.codahale.metrics.Meter;+import com.codahale.metrics.MetricRegistry;+import com.codahale.metrics.Timer;+import org.apache.gravitino.GravitinoEnv;+import org.apache.gravitino.metrics.source.MetricsSource;+import org.aspectj.lang.ProceedingJoinPoint;+import org.aspectj.lang.annotation.Around;+import org.aspectj.lang.annotation.Aspect;+import org.aspectj.lang.annotation.Pointcut;+import org.slf4j.Logger;+import org.slf4j.LoggerFactory;++@Aspect+public class MethodMonitorAspect {++ private static final Logger LOG = LoggerFactory.getLogger(MethodMonitorAspect.class);+ private MetricsSystem metricsSystem;++ public MethodMonitorAspect() {+ this.metricsSystem = GravitinoEnv.getInstance().metricsSystem();+ // Metrics System could be null in UT.+ if (metricsSystem != null) {+ LOG.info("MethodMonitorAspect initialized.");+ } else {+ LOG.warn("MetricsSystem is not initialized, MethodMonitorAspect is disabled.");+ }+ }++ @Pointcut("execution(@org.apache.gravitino.metrics.Monitored * *(..))")+ public void monitoredMethods() {}++ @Around("monitoredMethods() && @annotation(monitored)")+ public Object monitorMethod(ProceedingJoinPoint pjp, Monitored monitored) throws Throwable {+ if (metricsSystem == null) {+ return pjp.proceed();+ }++ MetricsSource metricsSource = metricsSystem.getMetricsSource(monitored.metricsSource());+ if (metricsSource == null) {+ LOG.warn(+ "MetricsSource {} is not registered in MetricsSystem, skip monitoring for method {}",+ monitored.metricsSource(),+ pjp.getSignature().toShortString());+ return pjp.proceed();+ }++ String baseMetricName = monitored.baseMetricName();+ Timer timer = metricsSource.getTimer(MetricRegistry.name(baseMetricName, "total"));+ Meter successMeter = metricsSource.getMeter(MetricRegistry.name(baseMetricName, "success"));+ Meter failureMeter = metricsSource.getMeter(MetricRegistry.name(baseMetricName, "failure"));++ try (Timer.Context ignore = timer.time()) {+ Object result = pjp.proceed();+ successMeter.mark();+ return result;+ } catch (Throwable t) {+ failureMeter.mark();+ throw t;+ }+ }+}diff --git a/core/src/main/java/org/apache/gravitino/metrics/MetricsSystem.java b/core/src/main/java/org/apache/gravitino/metrics/MetricsSystem.javaindex bcd86ad530..fb61f39eff 100644--- a/core/src/main/java/org/apache/gravitino/metrics/MetricsSystem.java+++ b/core/src/main/java/org/apache/gravitino/metrics/MetricsSystem.java@@ -119,6 +119,10 @@ public class MetricsSystem implements Closeable {LOG.info("Unregistered {} from metrics system {}", metricsSource.getMetricsSourceName(), name);}+ public MetricsSource getMetricsSource(String metricsSourceName) {+ return this.metricSources.get(metricsSourceName);+ }+// We support JMX reporter for now, todo: support more reportersprivate void initAndStartMetricsReporter() {JmxReporter jmxReporter = JmxReporter.forRegistry(metricRegistry).build();diff --git a/core/src/main/java/org/apache/gravitino/metrics/Monitored.java b/core/src/main/java/org/apache/gravitino/metrics/Monitored.javanew file mode 100644index 0000000000..f5eceeebc2--- /dev/null+++ b/core/src/main/java/org/apache/gravitino/metrics/Monitored.java@@ -0,0 +1,60 @@+/*+ * 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.gravitino.metrics;++import java.lang.annotation.ElementType;+import java.lang.annotation.Retention;+import java.lang.annotation.RetentionPolicy;+import java.lang.annotation.Target;+import org.apache.gravitino.metrics.source.MetricsSource;++/**+ * An annotation for monitoring method performance. It automatically tracks the execution time,+ * success count, and failure count.+ *+ * <p>The metric names will be generated based on the {@link #metricsSource()} and {@link+ * #baseMetricName()} and the method's outcome. The final metric name will be in the format: {@code+ * {metricsSource}.{baseMetricName}.{suffix}}.+ *+ * <p>The generated metrics like:+ *+ * <ul>+ * <li>{@code {metricsSource}.{baseMetricName}.total}: A timer for overall execution duration.+ * <li>{@code {metricsSource}.{baseMetricName}.success}: A meter for successful executions.+ * <li>{@code {metricsSource}.{baseMetricName}.failure}: A meter for failed executions.+ * </ul>+ */+@Target(ElementType.METHOD)+@Retention(RetentionPolicy.RUNTIME)+public @interface Monitored {++ /**+ * The {@link MetricsSource} name of the metric belongs to.+ *+ * @return the metrics source name+ */+ String metricsSource();++ /**+ * The base name for the metric.+ *+ * @return the base name for the metric+ */+ String baseMetricName();+}diff --git a/core/src/main/java/org/apache/gravitino/metrics/source/MetricsSource.java b/core/src/main/java/org/apache/gravitino/metrics/source/MetricsSource.javaindex 049e8194cd..8289d1de0c 100644--- a/core/src/main/java/org/apache/gravitino/metrics/source/MetricsSource.java+++ b/core/src/main/java/org/apache/gravitino/metrics/source/MetricsSource.java@@ -22,6 +22,7 @@ package org.apache.gravitino.metrics.source;import com.codahale.metrics.Counter;import com.codahale.metrics.Gauge;import com.codahale.metrics.Histogram;+import com.codahale.metrics.Meter;import com.codahale.metrics.MetricRegistry;import com.codahale.metrics.SlidingTimeWindowArrayReservoir;import com.codahale.metrics.Timer;@@ -127,6 +128,16 @@ public abstract class MetricsSource {getTimeSlidingWindowSeconds(), TimeUnit.SECONDS)));}+ /**+ * Get or create a Meter+ *+ * @param name The name for the meter, should be unique in metrics source.+ * @return a new or pre-existing Meter+ */+ public Meter getMeter(String name) {+ return this.metricRegistry.meter(name);+ }+protected int getTimeSlidingWindowSeconds() {return timeSlidingWindowSeconds;}diff --git a/core/src/main/java/org/apache/gravitino/storage/relational/service/CatalogMetaService.java b/core/src/main/java/org/apache/gravitino/storage/relational/service/CatalogMetaService.javaindex e4d08f4130..396ca397fd 100644--- a/core/src/main/java/org/apache/gravitino/storage/relational/service/CatalogMetaService.java+++ b/core/src/main/java/org/apache/gravitino/storage/relational/service/CatalogMetaService.java@@ -18,12 +18,13 @@*/package org.apache.gravitino.storage.relational.service;+import static org.apache.gravitino.metrics.source.MetricsSource.GRAVITINO_RELATIONAL_STORE_METRIC_NAME;+import com.google.common.base.Preconditions;import java.io.IOException;import java.util.List;import java.util.Objects;import java.util.function.Function;-import javax.annotation.Nullable;import org.apache.gravitino.Entity;import org.apache.gravitino.HasIdentifier;import org.apache.gravitino.MetadataObject;@@ -33,6 +34,7 @@ import org.apache.gravitino.exceptions.NoSuchEntityException;import org.apache.gravitino.exceptions.NonEmptyEntityException;import org.apache.gravitino.meta.CatalogEntity;import org.apache.gravitino.meta.SchemaEntity;+import org.apache.gravitino.metrics.Monitored;import org.apache.gravitino.storage.relational.helper.CatalogIds;import org.apache.gravitino.storage.relational.mapper.CatalogMetaMapper;import org.apache.gravitino.storage.relational.mapper.FilesetMetaMapper;@@ -68,6 +70,9 @@ public class CatalogMetaService {private CatalogMetaService() {}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getCatalogPOByName")public CatalogPO getCatalogPOByName(String metalakeName, String catalogName) {CatalogPO catalogPO =SessionUtils.getWithoutCommit(@@ -83,22 +88,18 @@ public class CatalogMetaService {return catalogPO;}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getCatalogIdByMetalakeAndCatalogName")public CatalogIds getCatalogIdByMetalakeAndCatalogName(String metalakeName, String catalogName) {return SessionUtils.getWithoutCommit(CatalogMetaMapper.class,mapper -> mapper.selectCatalogIdByMetalakeNameAndCatalogName(metalakeName, catalogName));}- // Catalog may be deleted, so the CatalogPO may be null.- @Nullable- public CatalogPO getCatalogPOById(Long catalogId) {- CatalogPO catalogPO =- SessionUtils.getWithoutCommit(- CatalogMetaMapper.class, mapper -> mapper.selectCatalogMetaById(catalogId));-- return catalogPO;- }-+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getCatalogIdByMetalakeIdAndName")public Long getCatalogIdByMetalakeIdAndName(Long metalakeId, String catalogName) {Long catalogId =SessionUtils.getWithoutCommit(@@ -114,6 +115,9 @@ public class CatalogMetaService {return catalogId;}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getCatalogIdByName")public Long getCatalogIdByName(String metalakeName, String catalogName) {Long catalogId =SessionUtils.doWithCommitAndFetchResult(@@ -129,6 +133,9 @@ public class CatalogMetaService {return catalogId;}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getCatalogByIdentifier")public CatalogEntity getCatalogByIdentifier(NameIdentifier identifier) {NameIdentifierUtil.checkCatalog(identifier);String catalogName = identifier.name();@@ -138,6 +145,9 @@ public class CatalogMetaService {return POConverters.fromCatalogPO(catalogPO, identifier.namespace());}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "listCatalogsByNamespace")public List<CatalogEntity> listCatalogsByNamespace(Namespace namespace) {NamespaceUtil.checkCatalog(namespace);List<CatalogPO> catalogPOS =@@ -148,6 +158,9 @@ public class CatalogMetaService {return POConverters.fromCatalogPOs(catalogPOS, namespace);}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "insertCatalog")public void insertCatalog(CatalogEntity catalogEntity, boolean overwrite) throws IOException {try {NameIdentifierUtil.checkCatalog(catalogEntity.nameIdentifier());@@ -172,6 +185,9 @@ public class CatalogMetaService {}}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "updateCatalog")public <E extends Entity & HasIdentifier> CatalogEntity updateCatalog(NameIdentifier identifier, Function<E, E> updater) throws IOException {NameIdentifierUtil.checkCatalog(identifier);@@ -212,6 +228,9 @@ public class CatalogMetaService {}}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "deleteCatalog")public boolean deleteCatalog(NameIdentifier identifier, boolean cascade) {NameIdentifierUtil.checkCatalog(identifier);@@ -327,6 +346,9 @@ public class CatalogMetaService {return true;}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "deleteCatalogMetasByLegacyTimeline")public int deleteCatalogMetasByLegacyTimeline(Long legacyTimeline, int limit) {return SessionUtils.doWithCommitAndFetchResult(CatalogMetaMapper.class,diff --git a/core/src/main/java/org/apache/gravitino/storage/relational/service/CommonMetaService.java b/core/src/main/java/org/apache/gravitino/storage/relational/service/CommonMetaService.javaindex aa18d4bc56..d070d97163 100644--- a/core/src/main/java/org/apache/gravitino/storage/relational/service/CommonMetaService.java+++ b/core/src/main/java/org/apache/gravitino/storage/relational/service/CommonMetaService.java@@ -19,10 +19,13 @@package org.apache.gravitino.storage.relational.service;+import static org.apache.gravitino.metrics.source.MetricsSource.GRAVITINO_RELATIONAL_STORE_METRIC_NAME;+import com.google.common.base.Preconditions;import org.apache.gravitino.Entity;import org.apache.gravitino.Namespace;import org.apache.gravitino.exceptions.NoSuchEntityException;+import org.apache.gravitino.metrics.Monitored;import org.apache.gravitino.storage.relational.helper.CatalogIds;import org.apache.gravitino.storage.relational.helper.SchemaIds;@@ -36,6 +39,9 @@ public class CommonMetaService {private CommonMetaService() {}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getParentEntityIdByNamespace")public Long getParentEntityIdByNamespace(Namespace namespace) {Preconditions.checkArgument(!namespace.isEmpty() && namespace.levels().length <= 3,@@ -88,6 +94,9 @@ public class CommonMetaService {}}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getParentEntityIdsByNamespace")public Long[] getParentEntityIdsByNamespace(Namespace namespace) {Preconditions.checkArgument(!namespace.isEmpty() && namespace.levels().length <= 3,diff --git a/core/src/main/java/org/apache/gravitino/storage/relational/service/FilesetMetaService.java b/core/src/main/java/org/apache/gravitino/storage/relational/service/FilesetMetaService.javaindex 246414609b..15fa3f6b14 100644--- a/core/src/main/java/org/apache/gravitino/storage/relational/service/FilesetMetaService.java+++ b/core/src/main/java/org/apache/gravitino/storage/relational/service/FilesetMetaService.java@@ -18,6 +18,8 @@*/package org.apache.gravitino.storage.relational.service;+import static org.apache.gravitino.metrics.source.MetricsSource.GRAVITINO_RELATIONAL_STORE_METRIC_NAME;+import com.google.common.base.Preconditions;import java.io.IOException;import java.util.List;@@ -30,6 +32,7 @@ import org.apache.gravitino.NameIdentifier;import org.apache.gravitino.Namespace;import org.apache.gravitino.exceptions.NoSuchEntityException;import org.apache.gravitino.meta.FilesetEntity;+import org.apache.gravitino.metrics.Monitored;import org.apache.gravitino.storage.relational.mapper.FilesetMetaMapper;import org.apache.gravitino.storage.relational.mapper.FilesetVersionMapper;import org.apache.gravitino.storage.relational.mapper.OwnerMetaMapper;@@ -62,6 +65,9 @@ public class FilesetMetaService {private FilesetMetaService() {}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getFilesetPOBySchemaIdAndName")public FilesetPO getFilesetPOBySchemaIdAndName(Long schemaId, String filesetName) {FilesetPO filesetPO =SessionUtils.getWithoutCommit(@@ -77,14 +83,9 @@ public class FilesetMetaService {return filesetPO;}- // Fileset may be deleted, so the FilesetPO may be null.- public FilesetPO getFilesetPOById(Long filesetId) {- FilesetPO filesetPO =- SessionUtils.getWithoutCommit(- FilesetMetaMapper.class, mapper -> mapper.selectFilesetMetaById(filesetId));- return filesetPO;- }-+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getFilesetIdBySchemaIdAndName")public Long getFilesetIdBySchemaIdAndName(Long schemaId, String filesetName) {Long filesetId =SessionUtils.getWithoutCommit(@@ -100,6 +101,9 @@ public class FilesetMetaService {return filesetId;}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getFilesetByIdentifier")public FilesetEntity getFilesetByIdentifier(NameIdentifier identifier) {NameIdentifierUtil.checkFileset(identifier);@@ -113,6 +117,9 @@ public class FilesetMetaService {return POConverters.fromFilesetPO(filesetPO, identifier.namespace());}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "listFilesetsByNamespace")public List<FilesetEntity> listFilesetsByNamespace(Namespace namespace) {NamespaceUtil.checkFileset(namespace);@@ -125,6 +132,9 @@ public class FilesetMetaService {return POConverters.fromFilesetPOs(filesetPOs, namespace);}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "insertFileset")public void insertFileset(FilesetEntity filesetEntity, boolean overwrite) throws IOException {try {NameIdentifierUtil.checkFileset(filesetEntity.nameIdentifier());@@ -163,6 +173,9 @@ public class FilesetMetaService {}}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "updateFileset")public <E extends Entity & HasIdentifier> FilesetEntity updateFileset(NameIdentifier identifier, Function<E, E> updater) throws IOException {NameIdentifierUtil.checkFileset(identifier);@@ -225,6 +238,9 @@ public class FilesetMetaService {}}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "deleteFileset")public boolean deleteFileset(NameIdentifier identifier) {NameIdentifierUtil.checkFileset(identifier);@@ -277,6 +293,9 @@ public class FilesetMetaService {return true;}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "deleteFilesetAndVersionMetasByLegacyTimeline")public int deleteFilesetAndVersionMetasByLegacyTimeline(Long legacyTimeline, int limit) {int filesetDeletedCount =SessionUtils.doWithCommitAndFetchResult(@@ -293,6 +312,9 @@ public class FilesetMetaService {return filesetDeletedCount + filesetVersionDeletedCount;}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "deleteFilesetVersionsByRetentionCount")public int deleteFilesetVersionsByRetentionCount(Long versionRetentionCount, int limit) {// get the current version of all filesets.List<FilesetMaxVersionPO> filesetCurVersions =diff --git a/core/src/main/java/org/apache/gravitino/storage/relational/service/GroupMetaService.java b/core/src/main/java/org/apache/gravitino/storage/relational/service/GroupMetaService.javaindex e5a32171df..a62052c27a 100644--- a/core/src/main/java/org/apache/gravitino/storage/relational/service/GroupMetaService.java+++ b/core/src/main/java/org/apache/gravitino/storage/relational/service/GroupMetaService.java@@ -18,6 +18,8 @@*/package org.apache.gravitino.storage.relational.service;+import static org.apache.gravitino.metrics.source.MetricsSource.GRAVITINO_RELATIONAL_STORE_METRIC_NAME;+import com.google.common.base.Preconditions;import com.google.common.collect.Lists;import com.google.common.collect.Sets;@@ -37,6 +39,7 @@ import org.apache.gravitino.authorization.AuthorizationUtils;import org.apache.gravitino.exceptions.NoSuchEntityException;import org.apache.gravitino.meta.GroupEntity;import org.apache.gravitino.meta.RoleEntity;+import org.apache.gravitino.metrics.Monitored;import org.apache.gravitino.storage.relational.mapper.GroupMetaMapper;import org.apache.gravitino.storage.relational.mapper.GroupRoleRelMapper;import org.apache.gravitino.storage.relational.mapper.OwnerMetaMapper;@@ -73,6 +76,9 @@ public class GroupMetaService {return GroupPO;}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getGroupIdByMetalakeIdAndName")public Long getGroupIdByMetalakeIdAndName(Long metalakeId, String groupName) {Long groupId =SessionUtils.getWithoutCommit(@@ -88,6 +94,9 @@ public class GroupMetaService {return groupId;}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getGroupByIdentifier")public GroupEntity getGroupByIdentifier(NameIdentifier identifier) {AuthorizationUtils.checkGroup(identifier);@@ -99,6 +108,9 @@ public class GroupMetaService {return POConverters.fromGroupPO(groupPO, rolePOs, identifier.namespace());}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "listGroupsByRoleIdent")public List<GroupEntity> listGroupsByRoleIdent(NameIdentifier roleIdent) {RoleEntity roleEntity = RoleMetaService.getInstance().getRoleByIdentifier(roleIdent);List<GroupPO> groupPOs =@@ -114,6 +126,7 @@ public class GroupMetaService {.collect(Collectors.toList());}+ @Monitored(metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME, baseMetricName = "insertGroup")public void insertGroup(GroupEntity groupEntity, boolean overwritten) throws IOException {try {AuthorizationUtils.checkGroup(groupEntity.nameIdentifier());@@ -157,6 +170,7 @@ public class GroupMetaService {}}+ @Monitored(metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME, baseMetricName = "deleteGroup")public boolean deleteGroup(NameIdentifier identifier) {AuthorizationUtils.checkGroup(identifier);@@ -181,6 +195,7 @@ public class GroupMetaService {return true;}+ @Monitored(metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME, baseMetricName = "updateGroup")public <E extends Entity & HasIdentifier> GroupEntity updateGroup(NameIdentifier identifier, Function<E, E> updater) throws IOException {AuthorizationUtils.checkGroup(identifier);@@ -251,6 +266,9 @@ public class GroupMetaService {return newEntity;}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "listGroupsByNamespace")public List<GroupEntity> listGroupsByNamespace(Namespace namespace, boolean allFields) {AuthorizationUtils.checkGroupNamespace(namespace);String metalakeName = namespace.level(0);@@ -281,6 +299,9 @@ public class GroupMetaService {}}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "deleteGroupMetasByLegacyTimeline")public int deleteGroupMetasByLegacyTimeline(long legacyTimeline, int limit) {int[] groupDeletedCount = new int[] {0};int[] groupRoleRelDeletedCount = new int[] {0};diff --git a/core/src/main/java/org/apache/gravitino/storage/relational/service/JobMetaService.java b/core/src/main/java/org/apache/gravitino/storage/relational/service/JobMetaService.javaindex 86af63c1fa..8aa641de67 100644--- a/core/src/main/java/org/apache/gravitino/storage/relational/service/JobMetaService.java+++ b/core/src/main/java/org/apache/gravitino/storage/relational/service/JobMetaService.java@@ -18,6 +18,8 @@*/package org.apache.gravitino.storage.relational.service;+import static org.apache.gravitino.metrics.source.MetricsSource.GRAVITINO_RELATIONAL_STORE_METRIC_NAME;+import java.io.IOException;import java.util.List;import java.util.Locale;@@ -29,6 +31,7 @@ import org.apache.gravitino.exceptions.IllegalNamespaceException;import org.apache.gravitino.exceptions.NoSuchEntityException;import org.apache.gravitino.job.JobHandle;import org.apache.gravitino.meta.JobEntity;+import org.apache.gravitino.metrics.Monitored;import org.apache.gravitino.storage.relational.mapper.JobMetaMapper;import org.apache.gravitino.storage.relational.po.JobPO;import org.apache.gravitino.storage.relational.utils.ExceptionUtils;@@ -47,6 +50,9 @@ public class JobMetaService {return INSTANCE;}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "listJobsByNamespace")public List<JobEntity> listJobsByNamespace(Namespace ns) {String metalakeName = ns.level(0);if (ns.length() == 3) {@@ -74,6 +80,9 @@ public class JobMetaService {}}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getJobByIdentifier")public JobEntity getJobByIdentifier(NameIdentifier ident) {String metalakeName = ident.namespace().level(0);String jobRunId = ident.name();@@ -97,6 +106,7 @@ public class JobMetaService {return JobPO.fromJobPO(jobPO, ident.namespace());}+ @Monitored(metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME, baseMetricName = "insertJob")public void insertJob(JobEntity jobEntity, boolean overwrite) throws IOException {String metalakeName = jobEntity.namespace().level(0);@@ -120,6 +130,7 @@ public class JobMetaService {}}+ @Monitored(metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME, baseMetricName = "deleteJob")public boolean deleteJob(NameIdentifier jobIdent) {String jobRunId = jobIdent.name();long jobRunIdLong;@@ -134,6 +145,9 @@ public class JobMetaService {return result > 0;}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "deleteJobsByLegacyTimeline")public int deleteJobsByLegacyTimeline(long legacyTimeline, int limit) {// Mark jobs as deleted for finished jobs, so that they can be cleaned up laterSessionUtils.doWithCommit(diff --git a/core/src/main/java/org/apache/gravitino/storage/relational/service/JobTemplateMetaService.java b/core/src/main/java/org/apache/gravitino/storage/relational/service/JobTemplateMetaService.javaindex a042d8ba70..56f60f8ad9 100644--- a/core/src/main/java/org/apache/gravitino/storage/relational/service/JobTemplateMetaService.java+++ b/core/src/main/java/org/apache/gravitino/storage/relational/service/JobTemplateMetaService.java@@ -18,6 +18,8 @@*/package org.apache.gravitino.storage.relational.service;+import static org.apache.gravitino.metrics.source.MetricsSource.GRAVITINO_RELATIONAL_STORE_METRIC_NAME;+import java.io.IOException;import java.util.List;import java.util.Locale;@@ -28,6 +30,7 @@ import org.apache.gravitino.NameIdentifier;import org.apache.gravitino.Namespace;import org.apache.gravitino.exceptions.NoSuchEntityException;import org.apache.gravitino.meta.JobTemplateEntity;+import org.apache.gravitino.metrics.Monitored;import org.apache.gravitino.storage.relational.mapper.JobMetaMapper;import org.apache.gravitino.storage.relational.mapper.JobTemplateMetaMapper;import org.apache.gravitino.storage.relational.po.JobTemplatePO;@@ -46,6 +49,9 @@ public class JobTemplateMetaService {return INSTANCE;}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "listJobTemplatesByNamespace")public List<JobTemplateEntity> listJobTemplatesByNamespace(Namespace ns) {String metalakeName = ns.level(0);List<JobTemplatePO> jobTemplatePOs =@@ -58,6 +64,9 @@ public class JobTemplateMetaService {.collect(Collectors.toList());}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getJobTemplateByIdentifier")public JobTemplateEntity getJobTemplateByIdentifier(NameIdentifier jobTemplateIdent) {String metalakeName = jobTemplateIdent.namespace().level(0);String jobTemplateName = jobTemplateIdent.name();@@ -77,6 +86,9 @@ public class JobTemplateMetaService {return JobTemplatePO.fromJobTemplatePO(jobTemplatePO, jobTemplateIdent.namespace());}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "insertJobTemplate")public void insertJobTemplate(JobTemplateEntity jobTemplateEntity, boolean overwrite)throws IOException {String metalakeName = jobTemplateEntity.namespace().level(0);@@ -104,6 +116,9 @@ public class JobTemplateMetaService {}}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "deleteJobTemplate")public boolean deleteJobTemplate(NameIdentifier jobTemplateIdent) {String metalakeName = jobTemplateIdent.namespace().level(0);String jobTemplateName = jobTemplateIdent.name();@@ -125,6 +140,9 @@ public class JobTemplateMetaService {return result.get() > 0;}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "deleteJobTemplatesByLegacyTimeline")public int deleteJobTemplatesByLegacyTimeline(long legacyTimeline, int limit) {return SessionUtils.doWithCommitAndFetchResult(JobTemplateMetaMapper.class,diff --git a/core/src/main/java/org/apache/gravitino/storage/relational/service/MetadataObjectService.java b/core/src/main/java/org/apache/gravitino/storage/relational/service/MetadataObjectService.javaindex a373495987..c3c3053eeb 100644--- a/core/src/main/java/org/apache/gravitino/storage/relational/service/MetadataObjectService.java+++ b/core/src/main/java/org/apache/gravitino/storage/relational/service/MetadataObjectService.java@@ -18,6 +18,8 @@*/package org.apache.gravitino.storage.relational.service;+import static org.apache.gravitino.metrics.source.MetricsSource.GRAVITINO_RELATIONAL_STORE_METRIC_NAME;+import com.google.common.base.Joiner;import com.google.common.base.Splitter;import com.google.common.collect.ImmutableMap;@@ -31,6 +33,7 @@ import org.apache.gravitino.Entity;import org.apache.gravitino.MetadataObject;import org.apache.gravitino.MetadataObjects;import org.apache.gravitino.meta.GenericEntity;+import org.apache.gravitino.metrics.Monitored;import org.apache.gravitino.storage.relational.mapper.CatalogMetaMapper;import org.apache.gravitino.storage.relational.mapper.FilesetMetaMapper;import org.apache.gravitino.storage.relational.mapper.MetalakeMetaMapper;@@ -77,6 +80,9 @@ public class MetadataObjectService {private MetadataObjectService() {}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "fromGenericEntities")public static List<MetadataObject> fromGenericEntities(List<GenericEntity> entities) {if (entities == null || entities.isEmpty()) {return Lists.newArrayList();@@ -109,6 +115,9 @@ public class MetadataObjectService {return metadataObjects;}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getMetadataObjectId")public static long getMetadataObjectId(long metalakeId, String fullName, MetadataObject.Type type) {if (type == MetadataObject.Type.METALAKE) {@@ -164,6 +173,9 @@ public class MetadataObjectService {* if no Metalake objects are found for the given IDs. {@code @example} value of metalake full* name: "metalake1.catalog1.schema1.table1"*/+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getMetalakeObjectsFullName")public static Map<Long, String> getMetalakeObjectsFullName(List<Long> metalakeIds) {List<MetalakePO> metalakePOs =SessionUtils.getWithoutCommit(@@ -191,6 +203,9 @@ public class MetadataObjectService {* if no Fileset objects are found for the given IDs. {@code @example} value of fileset full* name: "catalog1.schema1.fileset1"*/+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getFilesetObjectsFullName")public static Map<Long, String> getFilesetObjectsFullName(List<Long> filesetIds) {List<FilesetPO> filesetPOs =SessionUtils.getWithoutCommit(@@ -234,6 +249,9 @@ public class MetadataObjectService {* no Model objects are found for the given IDs. {@code @example} value of model full name:* "catalog1.schema1.model1"*/+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getModelObjectsFullName")public static Map<Long, String> getModelObjectsFullName(List<Long> modelIds) {List<ModelPO> modelPOs =SessionUtils.getWithoutCommit(@@ -276,6 +294,9 @@ public class MetadataObjectService {* no Table objects are found for the given IDs. {@code @example} value of table full name:* "catalog1.schema1.table1"*/+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getTableObjectsFullName")public static Map<Long, String> getTableObjectsFullName(List<Long> tableIds) {List<TablePO> tablePOs =SessionUtils.getWithoutCommit(@@ -319,6 +340,9 @@ public class MetadataObjectService {* no column objects are found for the given IDs. {@code @example} value of table full name:* "catalog1.schema1.table1.column1"*/+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getColumnObjectsFullName")public static Map<Long, String> getColumnObjectsFullName(List<Long> columnsIds) {List<ColumnPO> columnPOs =SessionUtils.getWithoutCommit(@@ -364,6 +388,9 @@ public class MetadataObjectService {* no Topic objects are found for the given IDs. {@code @example} value of topic full name:* "catalog1.schema1.topic1"*/+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getTopicObjectsFullName")public static Map<Long, String> getTopicObjectsFullName(List<Long> topicIds) {List<TopicPO> topicPOs =SessionUtils.getWithoutCommit(@@ -406,6 +433,9 @@ public class MetadataObjectService {* if no Catalog objects are found for the given IDs. {@code @example} value of catalog full* name: "catalog1"*/+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getCatalogObjectsFullName")public static Map<Long, String> getCatalogObjectsFullName(List<Long> catalogIds) {List<CatalogPO> catalogPOs =SessionUtils.getWithoutCommit(@@ -432,6 +462,9 @@ public class MetadataObjectService {* no Schema objects are found for the given IDs. {@code @example} value of schema full name:* "catalog1.schema1"*/+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getSchemaObjectsFullName")public static Map<Long, String> getSchemaObjectsFullName(List<Long> schemaIds) {List<SchemaPO> schemaPOs =SessionUtils.getWithoutCommit(diff --git a/core/src/main/java/org/apache/gravitino/storage/relational/service/MetalakeMetaService.java b/core/src/main/java/org/apache/gravitino/storage/relational/service/MetalakeMetaService.javaindex 74fb01b1c6..9e10410e2d 100644--- a/core/src/main/java/org/apache/gravitino/storage/relational/service/MetalakeMetaService.java+++ b/core/src/main/java/org/apache/gravitino/storage/relational/service/MetalakeMetaService.java@@ -19,6 +19,8 @@package org.apache.gravitino.storage.relational.service;+import static org.apache.gravitino.metrics.source.MetricsSource.GRAVITINO_RELATIONAL_STORE_METRIC_NAME;+import com.google.common.base.Preconditions;import java.io.IOException;import java.util.List;@@ -31,6 +33,7 @@ import org.apache.gravitino.exceptions.NoSuchEntityException;import org.apache.gravitino.exceptions.NonEmptyEntityException;import org.apache.gravitino.meta.BaseMetalake;import org.apache.gravitino.meta.CatalogEntity;+import org.apache.gravitino.metrics.Monitored;import org.apache.gravitino.storage.relational.mapper.CatalogMetaMapper;import org.apache.gravitino.storage.relational.mapper.FilesetMetaMapper;import org.apache.gravitino.storage.relational.mapper.FilesetVersionMapper;@@ -75,6 +78,9 @@ public class MetalakeMetaService {private MetalakeMetaService() {}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "listMetalakes")public List<BaseMetalake> listMetalakes() {List<MetalakePO> metalakePOS =SessionUtils.getWithoutCommit(@@ -82,6 +88,9 @@ public class MetalakeMetaService {return POConverters.fromMetalakePOs(metalakePOS);}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getMetalakeIdByName")public Long getMetalakeIdByName(String metalakeName) {Long metalakeId =SessionUtils.getWithoutCommit(@@ -95,6 +104,9 @@ public class MetalakeMetaService {return metalakeId;}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getMetalakeByIdentifier")public BaseMetalake getMetalakeByIdentifier(NameIdentifier ident) {NameIdentifierUtil.checkMetalake(ident);MetalakePO metalakePO =@@ -109,14 +121,9 @@ public class MetalakeMetaService {return POConverters.fromMetalakePO(metalakePO);}- // Metalake may be deleted, so the MetalakePO may be null.- public MetalakePO getMetalakePOById(Long id) {- MetalakePO metalakePO =- SessionUtils.getWithoutCommit(- MetalakeMetaMapper.class, mapper -> mapper.selectMetalakeMetaById(id));- return metalakePO;- }-+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "insertMetalake")public void insertMetalake(BaseMetalake baseMetalake, boolean overwrite) throws IOException {try {NameIdentifierUtil.checkMetalake(baseMetalake.nameIdentifier());@@ -137,6 +144,9 @@ public class MetalakeMetaService {}}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "updateMetalake")public <E extends Entity & HasIdentifier> BaseMetalake updateMetalake(NameIdentifier ident, Function<E, E> updater) throws IOException {NameIdentifierUtil.checkMetalake(ident);@@ -178,6 +188,9 @@ public class MetalakeMetaService {}}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "deleteMetalake")public boolean deleteMetalake(NameIdentifier ident, boolean cascade) {NameIdentifierUtil.checkMetalake(ident);Long metalakeId = getMetalakeIdByName(ident.name());@@ -350,6 +363,9 @@ public class MetalakeMetaService {return true;}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "deleteMetalakeMetasByLegacyTimeline")public int deleteMetalakeMetasByLegacyTimeline(Long legacyTimeline, int limit) {int[] metalakeDeleteCount = new int[] {0};int[] ownerRelDeleteCount = new int[] {0};diff --git a/core/src/main/java/org/apache/gravitino/storage/relational/service/ModelMetaService.java b/core/src/main/java/org/apache/gravitino/storage/relational/service/ModelMetaService.javaindex c150b417bf..7687ce49d6 100644--- a/core/src/main/java/org/apache/gravitino/storage/relational/service/ModelMetaService.java+++ b/core/src/main/java/org/apache/gravitino/storage/relational/service/ModelMetaService.java@@ -19,6 +19,8 @@package org.apache.gravitino.storage.relational.service;+import static org.apache.gravitino.metrics.source.MetricsSource.GRAVITINO_RELATIONAL_STORE_METRIC_NAME;+import com.google.common.base.Preconditions;import java.io.IOException;import java.util.List;@@ -34,6 +36,7 @@ import org.apache.gravitino.NameIdentifier;import org.apache.gravitino.Namespace;import org.apache.gravitino.exceptions.NoSuchEntityException;import org.apache.gravitino.meta.ModelEntity;+import org.apache.gravitino.metrics.Monitored;import org.apache.gravitino.storage.relational.mapper.ModelMetaMapper;import org.apache.gravitino.storage.relational.mapper.ModelVersionAliasRelMapper;import org.apache.gravitino.storage.relational.mapper.ModelVersionMetaMapper;@@ -63,6 +66,9 @@ public class ModelMetaService {private ModelMetaService() {}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "listModelsByNamespace")public List<ModelEntity> listModelsByNamespace(Namespace ns) {NamespaceUtil.checkModel(ns);@@ -75,11 +81,15 @@ public class ModelMetaService {return modelPOs.stream().map(m -> POConverters.fromModelPO(m, ns)).collect(Collectors.toList());}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getModelByIdentifier")public ModelEntity getModelByIdentifier(NameIdentifier ident) {ModelPO modelPO = getModelPOByIdentifier(ident);return POConverters.fromModelPO(modelPO, ident.namespace());}+ @Monitored(metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME, baseMetricName = "insertModel")public void insertModel(ModelEntity modelEntity, boolean overwrite) throws IOException {NameIdentifierUtil.checkModel(modelEntity.nameIdentifier());@@ -104,6 +114,7 @@ public class ModelMetaService {}}+ @Monitored(metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME, baseMetricName = "deleteModel")public boolean deleteModel(NameIdentifier ident) {NameIdentifierUtil.checkModel(ident);@@ -173,12 +184,18 @@ public class ModelMetaService {return modelDeletedCount.get() > 0;}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "deleteModelMetasByLegacyTimeline")public int deleteModelMetasByLegacyTimeline(Long legacyTimeline, int limit) {return SessionUtils.doWithCommitAndFetchResult(ModelMetaMapper.class,mapper -> mapper.deleteModelMetasByLegacyTimeline(legacyTimeline, limit));}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getModelIdBySchemaIdAndModelName")Long getModelIdBySchemaIdAndModelName(Long schemaId, String modelName) {Long modelId =SessionUtils.getWithoutCommit(@@ -195,6 +212,9 @@ public class ModelMetaService {return modelId;}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getModelPOById")ModelPO getModelPOById(Long modelId) {ModelPO modelPO =SessionUtils.getWithoutCommit(@@ -218,6 +238,9 @@ public class ModelMetaService {builder.withSchemaId(parentEntityIds[2]);}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getModelPOByIdentifier")ModelPO getModelPOByIdentifier(NameIdentifier ident) {NameIdentifierUtil.checkModel(ident);@@ -237,6 +260,7 @@ public class ModelMetaService {return modelPO;}+ @Monitored(metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME, baseMetricName = "updateModel")public <E extends Entity & HasIdentifier> ModelEntity updateModel(NameIdentifier identifier, Function<E, E> updater) throws IOException {NameIdentifierUtil.checkModel(identifier);diff --git a/core/src/main/java/org/apache/gravitino/storage/relational/service/ModelVersionMetaService.java b/core/src/main/java/org/apache/gravitino/storage/relational/service/ModelVersionMetaService.javaindex 0c3caa52b8..042445b041 100644--- a/core/src/main/java/org/apache/gravitino/storage/relational/service/ModelVersionMetaService.java+++ b/core/src/main/java/org/apache/gravitino/storage/relational/service/ModelVersionMetaService.java@@ -18,6 +18,8 @@*/package org.apache.gravitino.storage.relational.service;+import static org.apache.gravitino.metrics.source.MetricsSource.GRAVITINO_RELATIONAL_STORE_METRIC_NAME;+import com.google.common.base.Preconditions;import com.google.common.collect.ArrayListMultimap;import com.google.common.collect.ImmutableList;@@ -40,6 +42,7 @@ import org.apache.gravitino.Namespace;import org.apache.gravitino.exceptions.NoSuchEntityException;import org.apache.gravitino.meta.ModelEntity;import org.apache.gravitino.meta.ModelVersionEntity;+import org.apache.gravitino.metrics.Monitored;import org.apache.gravitino.storage.relational.mapper.ModelMetaMapper;import org.apache.gravitino.storage.relational.mapper.ModelVersionAliasRelMapper;import org.apache.gravitino.storage.relational.mapper.ModelVersionMetaMapper;@@ -61,6 +64,9 @@ public class ModelVersionMetaService {private ModelVersionMetaService() {}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "listModelVersionsByNamespace")public List<ModelVersionEntity> listModelVersionsByNamespace(Namespace ns) {NamespaceUtil.checkModelVersion(ns);@@ -102,6 +108,9 @@ public class ModelVersionMetaService {.values());}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getModelVersionByIdentifier")public ModelVersionEntity getModelVersionByIdentifier(NameIdentifier ident) {NameIdentifierUtil.checkModelVersion(ident);@@ -146,6 +155,9 @@ public class ModelVersionMetaService {return POConverters.fromModelVersionPO(modelIdent, modelVersionPOs, aliasRelPOs);}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "insertModelVersion")public void insertModelVersion(ModelVersionEntity modelVersionEntity) throws IOException {NameIdentifier modelIdent = modelVersionEntity.modelIdentifier();NameIdentifierUtil.checkModel(modelIdent);@@ -186,6 +198,9 @@ public class ModelVersionMetaService {}}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "deleteModelVersion")public boolean deleteModelVersion(NameIdentifier ident) {NameIdentifierUtil.checkModelVersion(ident);@@ -238,6 +253,9 @@ public class ModelVersionMetaService {return modelVersionDeletedCount.get() > 0;}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "deleteModelVersionMetasByLegacyTimeline")public int deleteModelVersionMetasByLegacyTimeline(Long legacyTimeline, int limit) {int[] modelVersionDeletedCount = new int[] {0};int[] modelVersionAliasRelDeletedCount = new int[] {0};@@ -268,6 +286,9 @@ public class ModelVersionMetaService {* @param <E> the type of the entity to update* @throws IOException if an error occurs while updating the entity*/+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "updateModelVersion")public <E extends Entity & HasIdentifier> ModelVersionEntity updateModelVersion(NameIdentifier ident, Function<E, E> updater) throws IOException {NameIdentifierUtil.checkModelVersion(ident);diff --git a/core/src/main/java/org/apache/gravitino/storage/relational/service/OwnerMetaService.java b/core/src/main/java/org/apache/gravitino/storage/relational/service/OwnerMetaService.javaindex 1118467b0a..11ef4783ed 100644--- a/core/src/main/java/org/apache/gravitino/storage/relational/service/OwnerMetaService.java+++ b/core/src/main/java/org/apache/gravitino/storage/relational/service/OwnerMetaService.java@@ -18,12 +18,15 @@*/package org.apache.gravitino.storage.relational.service;+import static org.apache.gravitino.metrics.source.MetricsSource.GRAVITINO_RELATIONAL_STORE_METRIC_NAME;+import java.util.Collections;import java.util.Optional;import org.apache.gravitino.Entity;import org.apache.gravitino.MetadataObject;import org.apache.gravitino.NameIdentifier;import org.apache.gravitino.authorization.AuthorizationUtils;+import org.apache.gravitino.metrics.Monitored;import org.apache.gravitino.storage.relational.mapper.OwnerMetaMapper;import org.apache.gravitino.storage.relational.po.GroupPO;import org.apache.gravitino.storage.relational.po.OwnerRelPO;@@ -43,6 +46,7 @@ public class OwnerMetaService {return INSTANCE;}+ @Monitored(metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME, baseMetricName = "getOwner")public Optional<Entity> getOwner(NameIdentifier identifier, Entity.EntityType type) {long metalakeId =MetalakeMetaService.getInstance()@@ -78,6 +82,7 @@ public class OwnerMetaService {return Optional.empty();}+ @Monitored(metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME, baseMetricName = "setOwner")public void setOwner(NameIdentifier entity,Entity.EntityType entityType,diff --git a/core/src/main/java/org/apache/gravitino/storage/relational/service/PolicyMetaService.java b/core/src/main/java/org/apache/gravitino/storage/relational/service/PolicyMetaService.javaindex af45cc0c85..fb921dc986 100644--- a/core/src/main/java/org/apache/gravitino/storage/relational/service/PolicyMetaService.java+++ b/core/src/main/java/org/apache/gravitino/storage/relational/service/PolicyMetaService.java@@ -18,6 +18,8 @@*/package org.apache.gravitino.storage.relational.service;+import static org.apache.gravitino.metrics.source.MetricsSource.GRAVITINO_RELATIONAL_STORE_METRIC_NAME;+import com.google.common.base.Preconditions;import java.io.IOException;import java.util.Arrays;@@ -35,6 +37,7 @@ import org.apache.gravitino.Namespace;import org.apache.gravitino.exceptions.NoSuchEntityException;import org.apache.gravitino.meta.GenericEntity;import org.apache.gravitino.meta.PolicyEntity;+import org.apache.gravitino.metrics.Monitored;import org.apache.gravitino.storage.relational.mapper.PolicyMetaMapper;import org.apache.gravitino.storage.relational.mapper.PolicyMetadataObjectRelMapper;import org.apache.gravitino.storage.relational.mapper.PolicyVersionMapper;@@ -60,6 +63,9 @@ public class PolicyMetaService {private PolicyMetaService() {}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "listPoliciesByNamespace")public List<PolicyEntity> listPoliciesByNamespace(Namespace namespace) {String metalakeName = namespace.level(0);List<PolicyPO> policyPOs =@@ -70,12 +76,18 @@ public class PolicyMetaService {.collect(Collectors.toList());}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getPolicyByIdentifier")public PolicyEntity getPolicyByIdentifier(NameIdentifier ident) {String metalakeName = ident.namespace().level(0);PolicyPO policyPO = getPolicyPOByMetalakeAndName(metalakeName, ident.name());return POConverters.fromPolicyPO(policyPO, ident.namespace());}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "insertPolicy")public void insertPolicy(PolicyEntity policyEntity, boolean overwritten) throws IOException {Namespace ns = policyEntity.namespace();String metalakeName = ns.level(0);@@ -114,6 +126,9 @@ public class PolicyMetaService {}}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "updatePolicy")public <E extends Entity & HasIdentifier> PolicyEntity updatePolicy(NameIdentifier ident, Function<E, E> updater) throws IOException {String metalakeName = ident.namespace().level(0);@@ -166,6 +181,9 @@ public class PolicyMetaService {}}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "deletePolicy")public boolean deletePolicy(NameIdentifier ident) {String metalakeName = ident.namespace().level(0);int[] policyMetaDeletedCount = new int[] {0};@@ -189,6 +207,9 @@ public class PolicyMetaService {return policyMetaDeletedCount[0] + policyVersionDeletedCount[0] > 0;}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "listPoliciesForMetadataObject")public List<PolicyEntity> listPoliciesForMetadataObject(NameIdentifier objectIdent, Entity.EntityType objectType)throws NoSuchEntityException, IOException {@@ -218,6 +239,9 @@ public class PolicyMetaService {.collect(Collectors.toList());}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getPolicyForMetadataObject")public PolicyEntity getPolicyForMetadataObject(NameIdentifier objectIdent, Entity.EntityType objectType, NameIdentifier policyIdent)throws NoSuchEntityException, IOException {@@ -252,6 +276,9 @@ public class PolicyMetaService {return POConverters.fromPolicyPO(policyPO, NamespaceUtil.ofPolicy(metalake));}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "listAssociatedEntitiesForPolicy")public List<GenericEntity> listAssociatedEntitiesForPolicy(NameIdentifier policyIdent)throws IOException {String metalakeName = policyIdent.namespace().level(0);@@ -282,6 +309,9 @@ public class PolicyMetaService {}}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "associatePoliciesWithMetadataObject")public List<PolicyEntity> associatePoliciesWithMetadataObject(NameIdentifier objectIdent,Entity.EntityType objectType,@@ -366,6 +396,9 @@ public class PolicyMetaService {}}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "deletePolicyAndVersionMetasByLegacyTimeline")public int deletePolicyAndVersionMetasByLegacyTimeline(Long legacyTimeline, int limit) {int policyDeletedCount =SessionUtils.doWithCommitAndFetchResult(@@ -380,6 +413,9 @@ public class PolicyMetaService {return policyDeletedCount + policyVersionDeletedCount;}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "deletePolicyVersionsByRetentionCount")public int deletePolicyVersionsByRetentionCount(Long versionRetentionCount, int limit) {// get the current version of all policies.List<PolicyMaxVersionPO> policyMaxVersions =diff --git a/core/src/main/java/org/apache/gravitino/storage/relational/service/RoleMetaService.java b/core/src/main/java/org/apache/gravitino/storage/relational/service/RoleMetaService.javaindex 9c3f324966..87b8c474dd 100644--- a/core/src/main/java/org/apache/gravitino/storage/relational/service/RoleMetaService.java+++ b/core/src/main/java/org/apache/gravitino/storage/relational/service/RoleMetaService.java@@ -9,7 +9,7 @@** http://www.apache.org/licenses/LICENSE-2.0*- * Unless required by applicable law or agreed to in writing,+ * Unless required by applicable law or agreed 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@@ -18,6 +18,8 @@*/package org.apache.gravitino.storage.relational.service;+import static org.apache.gravitino.metrics.source.MetricsSource.GRAVITINO_RELATIONAL_STORE_METRIC_NAME;+import com.google.common.base.Preconditions;import com.google.common.collect.Lists;import com.google.common.collect.Sets;@@ -41,6 +43,7 @@ import org.apache.gravitino.authorization.SecurableObject;import org.apache.gravitino.exceptions.NoSuchEntityException;import org.apache.gravitino.meta.RoleEntity;import org.apache.gravitino.meta.UserEntity;+import org.apache.gravitino.metrics.Monitored;import org.apache.gravitino.storage.relational.mapper.GroupRoleRelMapper;import org.apache.gravitino.storage.relational.mapper.OwnerMetaMapper;import org.apache.gravitino.storage.relational.mapper.RoleMetaMapper;@@ -66,6 +69,9 @@ public class RoleMetaService {private RoleMetaService() {}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getRoleIdByMetalakeIdAndName")public Long getRoleIdByMetalakeIdAndName(Long metalakeId, String roleName) {Long roleId =SessionUtils.getWithoutCommit(@@ -81,11 +87,17 @@ public class RoleMetaService {return roleId;}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "listRolesByUserId")public List<RolePO> listRolesByUserId(Long userId) {return SessionUtils.getWithoutCommit(RoleMetaMapper.class, mapper -> mapper.listRolesByUserId(userId));}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "listRolesByUserIdent")public List<RoleEntity> listRolesByUserIdent(NameIdentifier userIdent) {UserEntity user = UserMetaService.getInstance().getUserByIdentifier(userIdent);String metalake = NameIdentifierUtil.getMetalake(userIdent);@@ -98,6 +110,9 @@ public class RoleMetaService {.collect(Collectors.toList());}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "listRolesByMetadataObject")public List<RoleEntity> listRolesByMetadataObject(NameIdentifier metadataObjectIdent, Entity.EntityType metadataObjectType, boolean allFields) {String metalake = NameIdentifierUtil.getMetalake(metadataObjectIdent);@@ -127,11 +142,15 @@ public class RoleMetaService {.collect(Collectors.toList());}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "listRolesByGroupId")public List<RolePO> listRolesByGroupId(Long groupId) {return SessionUtils.getWithoutCommit(RoleMetaMapper.class, mapper -> mapper.listRolesByGroupId(groupId));}+ @Monitored(metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME, baseMetricName = "insertRole")public void insertRole(RoleEntity roleEntity, boolean overwritten) throws IOException {try {AuthorizationUtils.checkRole(roleEntity.nameIdentifier());@@ -181,6 +200,7 @@ public class RoleMetaService {}}+ @Monitored(metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME, baseMetricName = "updateRole")public <E extends Entity & HasIdentifier> RoleEntity updateRole(NameIdentifier identifier, Function<E, E> updater) throws IOException {AuthorizationUtils.checkRole(identifier);@@ -264,6 +284,9 @@ public class RoleMetaService {return securableObjectPOs;}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getRoleByIdentifier")public RoleEntity getRoleByIdentifier(NameIdentifier identifier) {AuthorizationUtils.checkRole(identifier);@@ -276,6 +299,7 @@ public class RoleMetaService {return POConverters.fromRolePO(rolePO, securableObjects, identifier.namespace());}+ @Monitored(metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME, baseMetricName = "deleteRole")public boolean deleteRole(NameIdentifier identifier) {AuthorizationUtils.checkRole(identifier);@@ -306,11 +330,17 @@ public class RoleMetaService {return true;}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "listSecurableObjectsByRoleId")public static List<SecurableObjectPO> listSecurableObjectsByRoleId(Long roleId) {return SessionUtils.getWithoutCommit(SecurableObjectMapper.class, mapper -> mapper.listSecurableObjectsByRoleId(roleId));}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "listRolesByNamespace")public List<RoleEntity> listRolesByNamespace(Namespace namespace) {AuthorizationUtils.checkRoleNamespace(namespace);String metalakeName = namespace.level(0);@@ -327,6 +357,9 @@ public class RoleMetaService {.collect(Collectors.toList());}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "deleteRoleMetasByLegacyTimeline")public int deleteRoleMetasByLegacyTimeline(long legacyTimeline, int limit) {int[] roleDeletedCount = new int[] {0};int[] userRoleRelDeletedCount = new int[] {0};diff --git a/core/src/main/java/org/apache/gravitino/storage/relational/service/SchemaMetaService.java b/core/src/main/java/org/apache/gravitino/storage/relational/service/SchemaMetaService.javaindex a793af4e5c..e171923923 100644--- a/core/src/main/java/org/apache/gravitino/storage/relational/service/SchemaMetaService.java+++ b/core/src/main/java/org/apache/gravitino/storage/relational/service/SchemaMetaService.java@@ -18,6 +18,8 @@*/package org.apache.gravitino.storage.relational.service;+import static org.apache.gravitino.metrics.source.MetricsSource.GRAVITINO_RELATIONAL_STORE_METRIC_NAME;+import com.google.common.base.Preconditions;import java.io.IOException;import java.util.List;@@ -34,6 +36,7 @@ import org.apache.gravitino.meta.FilesetEntity;import org.apache.gravitino.meta.ModelEntity;import org.apache.gravitino.meta.SchemaEntity;import org.apache.gravitino.meta.TableEntity;+import org.apache.gravitino.metrics.Monitored;import org.apache.gravitino.storage.relational.helper.SchemaIds;import org.apache.gravitino.storage.relational.mapper.FilesetMetaMapper;import org.apache.gravitino.storage.relational.mapper.FilesetVersionMapper;@@ -66,6 +69,9 @@ public class SchemaMetaService {private SchemaMetaService() {}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getSchemaPOByCatalogIdAndName")public SchemaPO getSchemaPOByCatalogIdAndName(Long catalogId, String schemaName) {SchemaPO schemaPO =SessionUtils.getWithoutCommit(@@ -81,6 +87,9 @@ public class SchemaMetaService {return schemaPO;}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getSchemaIdByMetalakeNameAndCatalogNameAndSchemaName")public SchemaIds getSchemaIdByMetalakeNameAndCatalogNameAndSchemaName(String metalakeName, String catalogName, String schemaName) {return SessionUtils.getWithoutCommit(@@ -90,12 +99,9 @@ public class SchemaMetaService {metalakeName, catalogName, schemaName));}- // Schema may be deleted, so the SchemaPO may be null.- public SchemaPO getSchemaPOById(Long schemaId) {- return SessionUtils.getWithoutCommit(- SchemaMetaMapper.class, mapper -> mapper.selectSchemaMetaById(schemaId));- }-+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getSchemaIdByCatalogIdAndName")public Long getSchemaIdByCatalogIdAndName(Long catalogId, String schemaName) {Long schemaId =SessionUtils.getWithoutCommit(@@ -111,6 +117,9 @@ public class SchemaMetaService {return schemaId;}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getSchemaByIdentifier")public SchemaEntity getSchemaByIdentifier(NameIdentifier identifier) {NameIdentifierUtil.checkSchema(identifier);String schemaName = identifier.name();@@ -123,6 +132,9 @@ public class SchemaMetaService {return POConverters.fromSchemaPO(schemaPO, identifier.namespace());}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "listSchemasByNamespace")public List<SchemaEntity> listSchemasByNamespace(Namespace namespace) {NamespaceUtil.checkSchema(namespace);@@ -134,6 +146,9 @@ public class SchemaMetaService {return POConverters.fromSchemaPOs(schemaPOs, namespace);}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "insertSchema")public void insertSchema(SchemaEntity schemaEntity, boolean overwrite) throws IOException {try {NameIdentifierUtil.checkSchema(schemaEntity.nameIdentifier());@@ -158,6 +173,9 @@ public class SchemaMetaService {}}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "updateSchema")public <E extends Entity & HasIdentifier> SchemaEntity updateSchema(NameIdentifier identifier, Function<E, E> updater) throws IOException {NameIdentifierUtil.checkSchema(identifier);@@ -197,6 +215,9 @@ public class SchemaMetaService {}}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "deleteSchema")public boolean deleteSchema(NameIdentifier identifier, boolean cascade) {NameIdentifierUtil.checkSchema(identifier);@@ -336,6 +357,9 @@ public class SchemaMetaService {return true;}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "deleteSchemaMetasByLegacyTimeline")public int deleteSchemaMetasByLegacyTimeline(Long legacyTimeline, int limit) {return SessionUtils.doWithCommitAndFetchResult(SchemaMetaMapper.class,diff --git a/core/src/main/java/org/apache/gravitino/storage/relational/service/StatisticMetaService.java b/core/src/main/java/org/apache/gravitino/storage/relational/service/StatisticMetaService.javaindex e455a4c3b2..5e90e5ad24 100644--- a/core/src/main/java/org/apache/gravitino/storage/relational/service/StatisticMetaService.java+++ b/core/src/main/java/org/apache/gravitino/storage/relational/service/StatisticMetaService.java@@ -18,12 +18,15 @@*/package org.apache.gravitino.storage.relational.service;+import static org.apache.gravitino.metrics.source.MetricsSource.GRAVITINO_RELATIONAL_STORE_METRIC_NAME;+import java.util.List;import java.util.stream.Collectors;import org.apache.gravitino.Entity;import org.apache.gravitino.MetadataObject;import org.apache.gravitino.NameIdentifier;import org.apache.gravitino.meta.StatisticEntity;+import org.apache.gravitino.metrics.Monitored;import org.apache.gravitino.storage.relational.mapper.StatisticMetaMapper;import org.apache.gravitino.storage.relational.po.StatisticPO;import org.apache.gravitino.storage.relational.utils.SessionUtils;@@ -43,6 +46,9 @@ public class StatisticMetaService {private StatisticMetaService() {}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "listStatisticsByEntity")public List<StatisticEntity> listStatisticsByEntity(NameIdentifier identifier, Entity.EntityType type) {long metalakeId =@@ -58,6 +64,9 @@ public class StatisticMetaService {return statisticPOs.stream().map(StatisticPO::fromStatisticPO).collect(Collectors.toList());}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "batchInsertStatisticPOsOnDuplicateKeyUpdate")public void batchInsertStatisticPOsOnDuplicateKeyUpdate(List<StatisticEntity> statisticEntities, NameIdentifier entity, Entity.EntityType type) {if (statisticEntities == null || statisticEntities.isEmpty()) {@@ -77,6 +86,9 @@ public class StatisticMetaService {mapper -> mapper.batchInsertStatisticPOsOnDuplicateKeyUpdate(pos));}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "batchDeleteStatisticPOs")public int batchDeleteStatisticPOs(NameIdentifier identifier, Entity.EntityType type, List<String> statisticNames) {if (statisticNames == null || statisticNames.isEmpty()) {@@ -94,6 +106,9 @@ public class StatisticMetaService {mapper -> mapper.batchDeleteStatisticPOs(entityId, statisticNames));}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "deleteStatisticsByLegacyTimeline")public int deleteStatisticsByLegacyTimeline(long legacyTimeline, int limit) {return SessionUtils.doWithCommitAndFetchResult(StatisticMetaMapper.class,diff --git a/core/src/main/java/org/apache/gravitino/storage/relational/service/TableColumnMetaService.java b/core/src/main/java/org/apache/gravitino/storage/relational/service/TableColumnMetaService.javaindex 7391dffd25..d3dabbe89a 100644--- a/core/src/main/java/org/apache/gravitino/storage/relational/service/TableColumnMetaService.java+++ b/core/src/main/java/org/apache/gravitino/storage/relational/service/TableColumnMetaService.java@@ -18,6 +18,8 @@*/package org.apache.gravitino.storage.relational.service;+import static org.apache.gravitino.metrics.source.MetricsSource.GRAVITINO_RELATIONAL_STORE_METRIC_NAME;+import com.google.common.collect.Lists;import java.util.Collections;import java.util.List;@@ -29,6 +31,7 @@ import org.apache.gravitino.Entity;import org.apache.gravitino.exceptions.NoSuchEntityException;import org.apache.gravitino.meta.ColumnEntity;import org.apache.gravitino.meta.TableEntity;+import org.apache.gravitino.metrics.Monitored;import org.apache.gravitino.storage.relational.mapper.TableColumnMapper;import org.apache.gravitino.storage.relational.po.ColumnPO;import org.apache.gravitino.storage.relational.po.TablePO;@@ -45,6 +48,9 @@ public class TableColumnMetaService {return INSTANCE;}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getColumnsByTableIdAndVersion")List<ColumnPO> getColumnsByTableIdAndVersion(Long tableId, Long version) {List<ColumnPO> columnPOs =SessionUtils.getWithoutCommit(@@ -57,6 +63,9 @@ public class TableColumnMetaService {.collect(Collectors.toList());}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getColumnIdByTableIdAndName")Long getColumnIdByTableIdAndName(Long tableId, String columnName) {Long columnId =SessionUtils.getWithoutCommit(@@ -73,6 +82,9 @@ public class TableColumnMetaService {return columnId;}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getColumnPOById")ColumnPO getColumnPOById(Long columnId) {ColumnPO columnPO =SessionUtils.getWithoutCommit(@@ -88,6 +100,9 @@ public class TableColumnMetaService {return columnPO;}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "insertColumnPOs")void insertColumnPOs(TablePO tablePO, List<ColumnEntity> columnEntities) {List<ColumnPO> columnPOs =POConverters.initializeColumnPOs(tablePO, columnEntities, ColumnPO.ColumnOpType.CREATE);@@ -97,6 +112,9 @@ public class TableColumnMetaService {TableColumnMapper.class, mapper -> mapper.insertColumnPOs(columnPOs));}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "deleteColumnsByTableId")boolean deleteColumnsByTableId(Long tableId) {// deleteColumns will be done in deleteTable transaction, so we don't do commit here.Integer result =@@ -105,6 +123,9 @@ public class TableColumnMetaService {return result > 0;}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "deleteColumnsByLegacyTimeline")public int deleteColumnsByLegacyTimeline(Long legacyTimeline, int limit) {return SessionUtils.doWithCommitAndFetchResult(TableColumnMapper.class,@@ -127,6 +148,9 @@ public class TableColumnMetaService {return oldColumns.size() != newColumns.size() || !oldColumns.equals(newColumns);}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "updateColumnPOsFromTableDiff")void updateColumnPOsFromTableDiff(TableEntity oldTable, TableEntity newTable, TablePO newTablePO) {Map<Long, ColumnEntity> oldColumns =diff --git a/core/src/main/java/org/apache/gravitino/storage/relational/service/TableMetaService.java b/core/src/main/java/org/apache/gravitino/storage/relational/service/TableMetaService.javaindex 190f3b8903..db3646c94a 100644--- a/core/src/main/java/org/apache/gravitino/storage/relational/service/TableMetaService.java+++ b/core/src/main/java/org/apache/gravitino/storage/relational/service/TableMetaService.java@@ -18,6 +18,8 @@*/package org.apache.gravitino.storage.relational.service;+import static org.apache.gravitino.metrics.source.MetricsSource.GRAVITINO_RELATIONAL_STORE_METRIC_NAME;+import com.google.common.base.Preconditions;import java.io.IOException;import java.util.List;@@ -32,6 +34,7 @@ import org.apache.gravitino.NameIdentifier;import org.apache.gravitino.Namespace;import org.apache.gravitino.exceptions.NoSuchEntityException;import org.apache.gravitino.meta.TableEntity;+import org.apache.gravitino.metrics.Monitored;import org.apache.gravitino.storage.relational.mapper.OwnerMetaMapper;import org.apache.gravitino.storage.relational.mapper.PolicyMetadataObjectRelMapper;import org.apache.gravitino.storage.relational.mapper.SecurableObjectMapper;@@ -56,14 +59,9 @@ public class TableMetaService {private TableMetaService() {}- // Table may be deleted, so the TablePO may be null.- public TablePO getTablePOById(Long tableId) {- TablePO tablePO =- SessionUtils.getWithoutCommit(- TableMetaMapper.class, mapper -> mapper.selectTableMetaById(tableId));- return tablePO;- }-+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getTableIdBySchemaIdAndName")public Long getTableIdBySchemaIdAndName(Long schemaId, String tableName) {Long tableId =SessionUtils.getWithoutCommit(@@ -79,6 +77,9 @@ public class TableMetaService {return tableId;}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getTableByIdentifier")public TableEntity getTableByIdentifier(NameIdentifier identifier) {NameIdentifierUtil.checkTable(identifier);@@ -93,6 +94,9 @@ public class TableMetaService {return POConverters.fromTableAndColumnPOs(tablePO, columnPOs, identifier.namespace());}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "listTablesByNamespace")public List<TableEntity> listTablesByNamespace(Namespace namespace) {NamespaceUtil.checkTable(namespace);@@ -105,6 +109,7 @@ public class TableMetaService {return POConverters.fromTablePOs(tablePOs, namespace);}+ @Monitored(metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME, baseMetricName = "insertTable")public void insertTable(TableEntity tableEntity, boolean overwrite) throws IOException {try {NameIdentifierUtil.checkTable(tableEntity.nameIdentifier());@@ -147,6 +152,7 @@ public class TableMetaService {}}+ @Monitored(metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME, baseMetricName = "updateTable")public <E extends Entity & HasIdentifier> TableEntity updateTable(NameIdentifier identifier, Function<E, E> updater) throws IOException {NameIdentifierUtil.checkTable(identifier);@@ -203,6 +209,7 @@ public class TableMetaService {}}+ @Monitored(metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME, baseMetricName = "deleteTable")public boolean deleteTable(NameIdentifier identifier) {NameIdentifierUtil.checkTable(identifier);@@ -254,6 +261,9 @@ public class TableMetaService {return deleteResult.get() > 0;}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "deleteTableMetasByLegacyTimeline")public int deleteTableMetasByLegacyTimeline(Long legacyTimeline, int limit) {return SessionUtils.doWithCommitAndFetchResult(TableMetaMapper.class,diff --git a/core/src/main/java/org/apache/gravitino/storage/relational/service/TagMetaService.java b/core/src/main/java/org/apache/gravitino/storage/relational/service/TagMetaService.javaindex c5481357df..5330e1bdfd 100644--- a/core/src/main/java/org/apache/gravitino/storage/relational/service/TagMetaService.java+++ b/core/src/main/java/org/apache/gravitino/storage/relational/service/TagMetaService.java@@ -18,6 +18,8 @@*/package org.apache.gravitino.storage.relational.service;+import static org.apache.gravitino.metrics.source.MetricsSource.GRAVITINO_RELATIONAL_STORE_METRIC_NAME;+import com.google.common.base.Preconditions;import com.google.common.collect.Lists;import java.io.IOException;@@ -38,6 +40,7 @@ import org.apache.gravitino.Namespace;import org.apache.gravitino.exceptions.NoSuchEntityException;import org.apache.gravitino.exceptions.NoSuchTagException;import org.apache.gravitino.meta.TagEntity;+import org.apache.gravitino.metrics.Monitored;import org.apache.gravitino.storage.relational.mapper.TagMetaMapper;import org.apache.gravitino.storage.relational.mapper.TagMetadataObjectRelMapper;import org.apache.gravitino.storage.relational.po.TagMetadataObjectRelPO;@@ -58,6 +61,9 @@ public class TagMetaService {private TagMetaService() {}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "listTagsByNamespace")public List<TagEntity> listTagsByNamespace(Namespace ns) {String metalakeName = ns.level(0);List<TagPO> tagPOs =@@ -68,12 +74,16 @@ public class TagMetaService {.collect(Collectors.toList());}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getTagByIdentifier")public TagEntity getTagByIdentifier(NameIdentifier ident) {String metalakeName = ident.namespace().level(0);TagPO tagPO = getTagPOByMetalakeAndName(metalakeName, ident.name());return POConverters.fromTagPO(tagPO, ident.namespace());}+ @Monitored(metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME, baseMetricName = "insertTag")public void insertTag(TagEntity tagEntity, boolean overwritten) throws IOException {Namespace ns = tagEntity.namespace();String metalakeName = ns.level(0);@@ -99,13 +109,14 @@ public class TagMetaService {}}+ @Monitored(metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME, baseMetricName = "updateTag")public <E extends Entity & HasIdentifier> TagEntity updateTag(- NameIdentifier ident, Function<E, E> updater) throws IOException {- String metalakeName = ident.namespace().level(0);+ NameIdentifier identifier, Function<E, E> updater) throws IOException {+ String metalakeName = identifier.namespace().level(0);try {- TagPO tagPO = getTagPOByMetalakeAndName(metalakeName, ident.name());- TagEntity oldTagEntity = POConverters.fromTagPO(tagPO, ident.namespace());+ TagPO tagPO = getTagPOByMetalakeAndName(metalakeName, identifier.name());+ TagEntity oldTagEntity = POConverters.fromTagPO(tagPO, identifier.namespace());TagEntity updatedTagEntity = (TagEntity) updater.apply((E) oldTagEntity);Preconditions.checkArgument(Objects.equals(oldTagEntity.id(), updatedTagEntity.id()),@@ -121,19 +132,20 @@ public class TagMetaService {POConverters.updateTagPOWithVersion(tagPO, updatedTagEntity), tagPO));if (result == null || result == 0) {- throw new IOException("Failed to update the entity: " + ident);+ throw new IOException("Failed to update the entity: " + identifier);}return updatedTagEntity;} catch (RuntimeException e) {- ExceptionUtils.checkSQLException(e, Entity.EntityType.TAG, ident.toString());+ ExceptionUtils.checkSQLException(e, Entity.EntityType.TAG, identifier.toString());throw e;}}- public boolean deleteTag(NameIdentifier ident) {- String metalakeName = ident.namespace().level(0);+ @Monitored(metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME, baseMetricName = "deleteTag")+ public boolean deleteTag(NameIdentifier identifier) {+ String metalakeName = identifier.namespace().level(0);int[] tagDeletedCount = new int[] {0};int[] tagMetadataObjectRelDeletedCount = new int[] {0};@@ -143,18 +155,22 @@ public class TagMetaService {SessionUtils.getWithoutCommit(TagMetaMapper.class,mapper ->- mapper.softDeleteTagMetaByMetalakeAndTagName(metalakeName, ident.name())),+ mapper.softDeleteTagMetaByMetalakeAndTagName(+ metalakeName, identifier.name())),() ->tagMetadataObjectRelDeletedCount[0] =SessionUtils.getWithoutCommit(TagMetadataObjectRelMapper.class,mapper ->mapper.softDeleteTagMetadataObjectRelsByMetalakeAndTagName(- metalakeName, ident.name())));+ metalakeName, identifier.name())));return tagDeletedCount[0] + tagMetadataObjectRelDeletedCount[0] > 0;}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "listTagsForMetadataObject")public List<TagEntity> listTagsForMetadataObject(NameIdentifier objectIdent, Entity.EntityType objectType)throws NoSuchTagException, IOException {@@ -184,6 +200,9 @@ public class TagMetaService {.collect(Collectors.toList());}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getTagForMetadataObject")public TagEntity getTagForMetadataObject(NameIdentifier objectIdent, Entity.EntityType objectType, NameIdentifier tagIdent)throws NoSuchEntityException, IOException {@@ -218,6 +237,9 @@ public class TagMetaService {return POConverters.fromTagPO(tagPO, NamespaceUtil.ofTag(metalake));}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "listAssociatedMetadataObjectsForTag")public List<MetadataObject> listAssociatedMetadataObjectsForTag(NameIdentifier tagIdent)throws IOException {String metalakeName = tagIdent.namespace().level(0);@@ -268,6 +290,9 @@ public class TagMetaService {}}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "associateTagsWithMetadataObject")public List<TagEntity> associateTagsWithMetadataObject(NameIdentifier objectIdent,Entity.EntityType objectType,@@ -352,6 +377,9 @@ public class TagMetaService {}}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "deleteTagMetasByLegacyTimeline")public int deleteTagMetasByLegacyTimeline(long legacyTimeline, int limit) {int[] tagDeletedCount = new int[] {0};int[] tagMetadataObjectRelDeletedCount = new int[] {0};diff --git a/core/src/main/java/org/apache/gravitino/storage/relational/service/TopicMetaService.java b/core/src/main/java/org/apache/gravitino/storage/relational/service/TopicMetaService.javaindex bd7f46763a..f467b0d364 100644--- a/core/src/main/java/org/apache/gravitino/storage/relational/service/TopicMetaService.java+++ b/core/src/main/java/org/apache/gravitino/storage/relational/service/TopicMetaService.java@@ -18,6 +18,8 @@*/package org.apache.gravitino.storage.relational.service;+import static org.apache.gravitino.metrics.source.MetricsSource.GRAVITINO_RELATIONAL_STORE_METRIC_NAME;+import com.google.common.base.Preconditions;import java.io.IOException;import java.util.List;@@ -30,6 +32,7 @@ import org.apache.gravitino.NameIdentifier;import org.apache.gravitino.Namespace;import org.apache.gravitino.exceptions.NoSuchEntityException;import org.apache.gravitino.meta.TopicEntity;+import org.apache.gravitino.metrics.Monitored;import org.apache.gravitino.storage.relational.mapper.OwnerMetaMapper;import org.apache.gravitino.storage.relational.mapper.PolicyMetadataObjectRelMapper;import org.apache.gravitino.storage.relational.mapper.SecurableObjectMapper;@@ -56,6 +59,7 @@ public class TopicMetaService {private TopicMetaService() {}+ @Monitored(metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME, baseMetricName = "insertTopic")public void insertTopic(TopicEntity topicEntity, boolean overwrite) throws IOException {try {NameIdentifierUtil.checkTopic(topicEntity.nameIdentifier());@@ -81,6 +85,9 @@ public class TopicMetaService {}}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "listTopicsByNamespace")public List<TopicEntity> listTopicsByNamespace(Namespace namespace) {NamespaceUtil.checkTopic(namespace);@@ -93,6 +100,7 @@ public class TopicMetaService {return POConverters.fromTopicPOs(topicPOs, namespace);}+ @Monitored(metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME, baseMetricName = "updateTopic")public <E extends Entity & HasIdentifier> TopicEntity updateTopic(NameIdentifier ident, Function<E, E> updater) throws IOException {NameIdentifierUtil.checkTopic(ident);@@ -146,14 +154,6 @@ public class TopicMetaService {return topicPO;}- // Topic may be deleted, so the TopicPO may be null.- public TopicPO getTopicPOById(Long topicId) {- TopicPO topicPO =- SessionUtils.getWithoutCommit(- TopicMetaMapper.class, mapper -> mapper.selectTopicMetaById(topicId));- return topicPO;- }-private void fillTopicPOBuilderParentEntityId(TopicPO.Builder builder, Namespace namespace) {NamespaceUtil.checkTopic(namespace);Long[] parentEntityIds =@@ -163,6 +163,9 @@ public class TopicMetaService {builder.withSchemaId(parentEntityIds[2]);}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getTopicByIdentifier")public TopicEntity getTopicByIdentifier(NameIdentifier identifier) {NameIdentifierUtil.checkTopic(identifier);@@ -174,6 +177,7 @@ public class TopicMetaService {return POConverters.fromTopicPO(topicPO, identifier.namespace());}+ @Monitored(metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME, baseMetricName = "deleteTopic")public boolean deleteTopic(NameIdentifier identifier) {NameIdentifierUtil.checkTopic(identifier);@@ -220,6 +224,9 @@ public class TopicMetaService {return true;}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "deleteTopicMetasByLegacyTimeline")public int deleteTopicMetasByLegacyTimeline(Long legacyTimeline, int limit) {return SessionUtils.doWithCommitAndFetchResult(TopicMetaMapper.class,@@ -228,6 +235,9 @@ public class TopicMetaService {});}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getTopicIdBySchemaIdAndName")public Long getTopicIdBySchemaIdAndName(Long schemaId, String topicName) {Long topicId =SessionUtils.getWithoutCommit(diff --git a/core/src/main/java/org/apache/gravitino/storage/relational/service/UserMetaService.java b/core/src/main/java/org/apache/gravitino/storage/relational/service/UserMetaService.javaindex 98e14fb734..97d616aa50 100644--- a/core/src/main/java/org/apache/gravitino/storage/relational/service/UserMetaService.java+++ b/core/src/main/java/org/apache/gravitino/storage/relational/service/UserMetaService.java@@ -18,6 +18,8 @@*/package org.apache.gravitino.storage.relational.service;+import static org.apache.gravitino.metrics.source.MetricsSource.GRAVITINO_RELATIONAL_STORE_METRIC_NAME;+import com.google.common.base.Preconditions;import com.google.common.collect.Lists;import com.google.common.collect.Sets;@@ -37,6 +39,7 @@ import org.apache.gravitino.authorization.AuthorizationUtils;import org.apache.gravitino.exceptions.NoSuchEntityException;import org.apache.gravitino.meta.RoleEntity;import org.apache.gravitino.meta.UserEntity;+import org.apache.gravitino.metrics.Monitored;import org.apache.gravitino.storage.relational.mapper.OwnerMetaMapper;import org.apache.gravitino.storage.relational.mapper.UserMetaMapper;import org.apache.gravitino.storage.relational.mapper.UserRoleRelMapper;@@ -73,6 +76,9 @@ public class UserMetaService {return userPO;}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getUserIdByMetalakeIdAndName")public Long getUserIdByMetalakeIdAndName(Long metalakeId, String userName) {Long userId =SessionUtils.getWithoutCommit(@@ -88,6 +94,9 @@ public class UserMetaService {return userId;}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "getUserByIdentifier")public UserEntity getUserByIdentifier(NameIdentifier identifier) {AuthorizationUtils.checkUser(identifier);@@ -99,6 +108,9 @@ public class UserMetaService {return POConverters.fromUserPO(userPO, rolePOs, identifier.namespace());}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "listUsersByRoleIdent")public List<UserEntity> listUsersByRoleIdent(NameIdentifier roleIdent) {RoleEntity roleEntity = RoleMetaService.getInstance().getRoleByIdentifier(roleIdent);List<UserPO> userPOs =@@ -114,6 +126,7 @@ public class UserMetaService {.collect(Collectors.toList());}+ @Monitored(metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME, baseMetricName = "insertUser")public void insertUser(UserEntity userEntity, boolean overwritten) throws IOException {try {AuthorizationUtils.checkUser(userEntity.nameIdentifier());@@ -157,6 +170,7 @@ public class UserMetaService {}}+ @Monitored(metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME, baseMetricName = "deleteUser")public boolean deleteUser(NameIdentifier identifier) {AuthorizationUtils.checkUser(identifier);@@ -180,6 +194,7 @@ public class UserMetaService {return true;}+ @Monitored(metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME, baseMetricName = "updateUser")public <E extends Entity & HasIdentifier> UserEntity updateUser(NameIdentifier identifier, Function<E, E> updater) throws IOException {AuthorizationUtils.checkUser(identifier);@@ -248,6 +263,9 @@ public class UserMetaService {return newEntity;}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "listUsersByNamespace")public List<UserEntity> listUsersByNamespace(Namespace namespace, boolean allFields) {AuthorizationUtils.checkUserNamespace(namespace);String metalakeName = namespace.level(0);@@ -278,6 +296,9 @@ public class UserMetaService {}}+ @Monitored(+ metricsSource = GRAVITINO_RELATIONAL_STORE_METRIC_NAME,+ baseMetricName = "deleteUserMetasByLegacyTimeline")public int deleteUserMetasByLegacyTimeline(long legacyTimeline, int limit) {int[] userDeletedCount = new int[] {0};int[] userRoleRelDeletedCount = new int[] {0};diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.tomlindex 9bf8fc916e..89dbbec979 100644--- a/gradle/libs.versions.toml+++ b/gradle/libs.versions.toml@@ -127,8 +127,10 @@ jcasbin = "1.81.0"ognl = "3.4.7"concurrent-trees = "2.6.0"jakarta-validation = "2.0.2"+aspectj = "1.9.24"[libraries]+aspectj-aspectjrt = { group = "org.aspectj", name = "aspectjrt", version.ref = "aspectj" }aws-iam = { group = "software.amazon.awssdk", name = "iam", version.ref = "awssdk" }aws-policy = { group = "software.amazon.awssdk", name = "iam-policy-builder", version.ref = "awssdk" }aws-s3 = { group = "software.amazon.awssdk", name = "s3", version.ref = "awssdk" }@@ -324,3 +326,4 @@ bom = {id = "org.cyclonedx.bom", version = "1.5.0"}errorprone = {id = "net.ltgt.errorprone", version.ref = "error-prone"}jcstress = { id = "io.github.reyerizo.gradle.jcstress", version.ref = "jcstress" }jmh = { id = "me.champeau.jmh", version.ref = "jmh-plugin" }+aspectj-post-compile-weaving = { id = "io.freefair.aspectj.post-compile-weaving", version = "8.14.2" }