Repository: apache/dubbo
File: dubbo-metrics/dubbo-metrics-api/src/main/java/org/apache/dubbo/metrics/model/MetricsSupport.java (Java)

Code before:
import static org.apache.dubbo.metrics.MetricsConstants.INVOCATION;
import static org.apache.dubbo.metrics.MetricsConstants.METHOD_METRICS;
import static org.apache.dubbo.metrics.MetricsConstants.SELF_INCREMENT_SIZE;

public class MetricsSupport {

    private static final String version = Version.getVersion();

    private static final String commitId = Version.getLastCommitId();


    public static Map<String, String> applicationTags(ApplicationModel applicationModel) {
        return applicationTags(applicationModel, null);
    }

    public static Map<String, String> applicationTags(ApplicationModel applicationModel, @Nullable Map<String, String> extraInfo) {
        Map<String, String> tags = new HashMap<>();
        tags.put(TAG_APPLICATION_NAME, applicationModel.getApplicationName());
        tags.put(TAG_APPLICATION_MODULE, applicationModel.getInternalId());
        tags.put(TAG_APPLICATION_VERSION_KEY, version);
        if (CollectionUtils.isNotEmptyMap(extraInfo)) {
            tags.putAll(extraInfo);
        }
        return tags;
    }
    public static Map<String, String> applicationPrivateTags(ApplicationModel applicationModel, Map<String, String> tags) {
        tags.put(TAG_IP, getLocalHost());
        tags.put(TAG_HOSTNAME, getLocalHostName());
        tags.put(MetricsKey.METADATA_GIT_COMMITID_METRIC.getName(), commitId);
        return tags;
    }

    public static Map<String, String> serviceTags(ApplicationModel applicationModel, String serviceKey, Map<String, String> extraInfo) {
        Map<String, String> tags = applicationTags(applicationModel, extraInfo);
        tags.put(TAG_INTERFACE_KEY, serviceKey);
        return tags;
    }

    public static Map<String, String> methodTags(ApplicationModel applicationModel, String serviceKey, String methodName) {
        Map<String, String> tags = applicationTags(applicationModel);
        tags.put(TAG_INTERFACE_KEY, serviceKey);
        tags.put(TAG_METHOD_KEY, methodName);
        return tags;
    }

    public static MetricsKey getMetricsKey(Throwable throwable) {
        MetricsKey targetKey = MetricsKey.METRIC_REQUESTS_FAILED;
        if (throwable instanceof RpcException) {
            RpcException e = (RpcException) throwable;
            if (e.isTimeout()) {
                targetKey = MetricsKey.METRIC_REQUESTS_TIMEOUT;

Review comment (suggestion):
```suggestion
    public static Map<String, String> hostInfoTags(ApplicationModel applicationModel, Map<String, String> tags) {
```

Code after:
import static org.apache.dubbo.metrics.MetricsConstants.INVOCATION;
import static org.apache.dubbo.metrics.MetricsConstants.METHOD_METRICS;
import static org.apache.dubbo.metrics.MetricsConstants.SELF_INCREMENT_SIZE;

public class MetricsSupport {

    private static final String version = Version.getVersion();

    private static final String commitId = Version.getLastCommitId();


    public static Map<String, String> applicationTags(ApplicationModel applicationModel) {
        return applicationTags(applicationModel, null);
    }

    public static Map<String, String> applicationTags(ApplicationModel applicationModel, @Nullable Map<String, String> extraInfo) {
        Map<String, String> tags = new HashMap<>();
        tags.put(TAG_APPLICATION_NAME, applicationModel.getApplicationName());
        tags.put(TAG_APPLICATION_MODULE, applicationModel.getInternalId());
        if (CollectionUtils.isNotEmptyMap(extraInfo)) {
            tags.putAll(extraInfo);
        }
        return tags;
    }
    public static Map<String, String> gitTags(Map<String, String> tags) {
        tags.put(MetricsKey.METADATA_GIT_COMMITID_METRIC.getName(), commitId);
        tags.put(TAG_APPLICATION_VERSION_KEY, version);
        return tags;
    }
    public static Map<String, String> hostTags( Map<String, String> tags) {
        tags.put(TAG_IP, getLocalHost());
        tags.put(TAG_HOSTNAME, getLocalHostName());
        return tags;
    }

    public static Map<String, String> serviceTags(ApplicationModel applicationModel, String serviceKey, Map<String, String> extraInfo) {
        Map<String, String> tags = applicationTags(applicationModel, extraInfo);
        tags.put(TAG_INTERFACE_KEY, serviceKey);
        return tags;
    }

    public static Map<String, String> methodTags(ApplicationModel applicationModel, String serviceKey, String methodName) {
        Map<String, String> tags = applicationTags(applicationModel);
        tags.put(TAG_INTERFACE_KEY, serviceKey);
        tags.put(TAG_METHOD_KEY, methodName);
        return tags;
    }

    public static MetricsKey getMetricsKey(Throwable throwable) {
        MetricsKey targetKey = MetricsKey.METRIC_REQUESTS_FAILED;
        if (throwable instanceof RpcException) {