All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.huaweicloud.sdk.apm.v1.model.ClientSpanInfo Maven / Gradle / Ivy

There is a newer version: 3.1.114
Show newest version
package com.huaweicloud.sdk.apm.v1.model;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.function.Consumer;

/**
 * span信息。
 */
public class ClientSpanInfo {

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "global_trace_id")

    private String globalTraceId;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "global_path")

    private String globalPath;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "trace_id")

    private String traceId;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "span_id")

    private String spanId;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "env_id")

    private Long envId;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "instance_id")

    private Long instanceId;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "app_id")

    private Long appId;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "biz_id")

    private Long bizId;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "domain_id")

    private Integer domainId;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "source")

    private String source;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "real_source")

    private String realSource;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "start_time")

    private Long startTime;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "time_used")

    private Long timeUsed;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "code")

    private Integer code;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "class_name")

    private String className;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "is_async")

    private Boolean isAsync;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "tags")

    private Map tags = null;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "has_error")

    private Boolean hasError;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "error_reasons")

    private String errorReasons;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "type")

    private String type;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "http_method")

    private String httpMethod;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "biz_code")

    private String bizCode;

    public ClientSpanInfo withGlobalTraceId(String globalTraceId) {
        this.globalTraceId = globalTraceId;
        return this;
    }

    /**
     * vTraceId,虚拟traceI。
     * @return globalTraceId
     */
    public String getGlobalTraceId() {
        return globalTraceId;
    }

    public void setGlobalTraceId(String globalTraceId) {
        this.globalTraceId = globalTraceId;
    }

    public ClientSpanInfo withGlobalPath(String globalPath) {
        this.globalPath = globalPath;
        return this;
    }

    /**
     * 虚拟traceId经过的path路径。
     * @return globalPath
     */
    public String getGlobalPath() {
        return globalPath;
    }

    public void setGlobalPath(String globalPath) {
        this.globalPath = globalPath;
    }

    public ClientSpanInfo withTraceId(String traceId) {
        this.traceId = traceId;
        return this;
    }

    /**
     * traceId。
     * @return traceId
     */
    public String getTraceId() {
        return traceId;
    }

    public void setTraceId(String traceId) {
        this.traceId = traceId;
    }

    public ClientSpanInfo withSpanId(String spanId) {
        this.spanId = spanId;
        return this;
    }

    /**
     * span id。
     * @return spanId
     */
    public String getSpanId() {
        return spanId;
    }

    public void setSpanId(String spanId) {
        this.spanId = spanId;
    }

    public ClientSpanInfo withEnvId(Long envId) {
        this.envId = envId;
        return this;
    }

    /**
     * 环境Iid。
     * @return envId
     */
    public Long getEnvId() {
        return envId;
    }

    public void setEnvId(Long envId) {
        this.envId = envId;
    }

    public ClientSpanInfo withInstanceId(Long instanceId) {
        this.instanceId = instanceId;
        return this;
    }

    /**
     * 实例id。
     * @return instanceId
     */
    public Long getInstanceId() {
        return instanceId;
    }

    public void setInstanceId(Long instanceId) {
        this.instanceId = instanceId;
    }

    public ClientSpanInfo withAppId(Long appId) {
        this.appId = appId;
        return this;
    }

    /**
     * 组件id。
     * @return appId
     */
    public Long getAppId() {
        return appId;
    }

    public void setAppId(Long appId) {
        this.appId = appId;
    }

    public ClientSpanInfo withBizId(Long bizId) {
        this.bizId = bizId;
        return this;
    }

    /**
     * 应用id。
     * @return bizId
     */
    public Long getBizId() {
        return bizId;
    }

    public void setBizId(Long bizId) {
        this.bizId = bizId;
    }

    public ClientSpanInfo withDomainId(Integer domainId) {
        this.domainId = domainId;
        return this;
    }

    /**
     * 租户id。
     * @return domainId
     */
    public Integer getDomainId() {
        return domainId;
    }

    public void setDomainId(Integer domainId) {
        this.domainId = domainId;
    }

    public ClientSpanInfo withSource(String source) {
        this.source = source;
        return this;
    }

    /**
     * 只有是根event也就是span的时候有值。
     * @return source
     */
    public String getSource() {
        return source;
    }

    public void setSource(String source) {
        this.source = source;
    }

    public ClientSpanInfo withRealSource(String realSource) {
        this.realSource = realSource;
        return this;
    }

    /**
     * 根event 的时候存在,实际调用的url。
     * @return realSource
     */
    public String getRealSource() {
        return realSource;
    }

    public void setRealSource(String realSource) {
        this.realSource = realSource;
    }

    public ClientSpanInfo withStartTime(Long startTime) {
        this.startTime = startTime;
        return this;
    }

    /**
     * 开始时间。
     * @return startTime
     */
    public Long getStartTime() {
        return startTime;
    }

    public void setStartTime(Long startTime) {
        this.startTime = startTime;
    }

    public ClientSpanInfo withTimeUsed(Long timeUsed) {
        this.timeUsed = timeUsed;
        return this;
    }

    /**
     * 耗时。
     * @return timeUsed
     */
    public Long getTimeUsed() {
        return timeUsed;
    }

    public void setTimeUsed(Long timeUsed) {
        this.timeUsed = timeUsed;
    }

    public ClientSpanInfo withCode(Integer code) {
        this.code = code;
        return this;
    }

    /**
     * 状态码,针对http的调用有效。
     * @return code
     */
    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public ClientSpanInfo withClassName(String className) {
        this.className = className;
        return this;
    }

    /**
     * 类名。
     * @return className
     */
    public String getClassName() {
        return className;
    }

    public void setClassName(String className) {
        this.className = className;
    }

    public ClientSpanInfo withIsAsync(Boolean isAsync) {
        this.isAsync = isAsync;
        return this;
    }

    /**
     * 是否异步。
     * @return isAsync
     */
    public Boolean getIsAsync() {
        return isAsync;
    }

    public void setIsAsync(Boolean isAsync) {
        this.isAsync = isAsync;
    }

    public ClientSpanInfo withTags(Map tags) {
        this.tags = tags;
        return this;
    }

    public ClientSpanInfo putTagsItem(String key, String tagsItem) {
        if (this.tags == null) {
            this.tags = new HashMap<>();
        }
        this.tags.put(key, tagsItem);
        return this;
    }

    public ClientSpanInfo withTags(Consumer> tagsSetter) {
        if (this.tags == null) {
            this.tags = new HashMap<>();
        }
        tagsSetter.accept(this.tags);
        return this;
    }

    /**
     * 包含用户自定义参数,header或body体里的内容,httpMethod, bizCode,以及后续可能新增参数。
     * @return tags
     */
    public Map getTags() {
        return tags;
    }

    public void setTags(Map tags) {
        this.tags = tags;
    }

    public ClientSpanInfo withHasError(Boolean hasError) {
        this.hasError = hasError;
        return this;
    }

    /**
     * 是否报错。
     * @return hasError
     */
    public Boolean getHasError() {
        return hasError;
    }

    public void setHasError(Boolean hasError) {
        this.hasError = hasError;
    }

    public ClientSpanInfo withErrorReasons(String errorReasons) {
        this.errorReasons = errorReasons;
        return this;
    }

    /**
     * 报错原因。
     * @return errorReasons
     */
    public String getErrorReasons() {
        return errorReasons;
    }

    public void setErrorReasons(String errorReasons) {
        this.errorReasons = errorReasons;
    }

    public ClientSpanInfo withType(String type) {
        this.type = type;
        return this;
    }

    /**
     * 类型,mysql,kafka等。
     * @return type
     */
    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public ClientSpanInfo withHttpMethod(String httpMethod) {
        this.httpMethod = httpMethod;
        return this;
    }

    /**
     * 这里的method实际上是tags里面的http_method,只有url监控项才有。
     * @return httpMethod
     */
    public String getHttpMethod() {
        return httpMethod;
    }

    public void setHttpMethod(String httpMethod) {
        this.httpMethod = httpMethod;
    }

    public ClientSpanInfo withBizCode(String bizCode) {
        this.bizCode = bizCode;
        return this;
    }

    /**
     * 业务状态码的采集。
     * @return bizCode
     */
    public String getBizCode() {
        return bizCode;
    }

    public void setBizCode(String bizCode) {
        this.bizCode = bizCode;
    }

    @Override
    public boolean equals(java.lang.Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || getClass() != obj.getClass()) {
            return false;
        }
        ClientSpanInfo that = (ClientSpanInfo) obj;
        return Objects.equals(this.globalTraceId, that.globalTraceId)
            && Objects.equals(this.globalPath, that.globalPath) && Objects.equals(this.traceId, that.traceId)
            && Objects.equals(this.spanId, that.spanId) && Objects.equals(this.envId, that.envId)
            && Objects.equals(this.instanceId, that.instanceId) && Objects.equals(this.appId, that.appId)
            && Objects.equals(this.bizId, that.bizId) && Objects.equals(this.domainId, that.domainId)
            && Objects.equals(this.source, that.source) && Objects.equals(this.realSource, that.realSource)
            && Objects.equals(this.startTime, that.startTime) && Objects.equals(this.timeUsed, that.timeUsed)
            && Objects.equals(this.code, that.code) && Objects.equals(this.className, that.className)
            && Objects.equals(this.isAsync, that.isAsync) && Objects.equals(this.tags, that.tags)
            && Objects.equals(this.hasError, that.hasError) && Objects.equals(this.errorReasons, that.errorReasons)
            && Objects.equals(this.type, that.type) && Objects.equals(this.httpMethod, that.httpMethod)
            && Objects.equals(this.bizCode, that.bizCode);
    }

    @Override
    public int hashCode() {
        return Objects.hash(globalTraceId,
            globalPath,
            traceId,
            spanId,
            envId,
            instanceId,
            appId,
            bizId,
            domainId,
            source,
            realSource,
            startTime,
            timeUsed,
            code,
            className,
            isAsync,
            tags,
            hasError,
            errorReasons,
            type,
            httpMethod,
            bizCode);
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("class ClientSpanInfo {\n");
        sb.append("    globalTraceId: ").append(toIndentedString(globalTraceId)).append("\n");
        sb.append("    globalPath: ").append(toIndentedString(globalPath)).append("\n");
        sb.append("    traceId: ").append(toIndentedString(traceId)).append("\n");
        sb.append("    spanId: ").append(toIndentedString(spanId)).append("\n");
        sb.append("    envId: ").append(toIndentedString(envId)).append("\n");
        sb.append("    instanceId: ").append(toIndentedString(instanceId)).append("\n");
        sb.append("    appId: ").append(toIndentedString(appId)).append("\n");
        sb.append("    bizId: ").append(toIndentedString(bizId)).append("\n");
        sb.append("    domainId: ").append(toIndentedString(domainId)).append("\n");
        sb.append("    source: ").append(toIndentedString(source)).append("\n");
        sb.append("    realSource: ").append(toIndentedString(realSource)).append("\n");
        sb.append("    startTime: ").append(toIndentedString(startTime)).append("\n");
        sb.append("    timeUsed: ").append(toIndentedString(timeUsed)).append("\n");
        sb.append("    code: ").append(toIndentedString(code)).append("\n");
        sb.append("    className: ").append(toIndentedString(className)).append("\n");
        sb.append("    isAsync: ").append(toIndentedString(isAsync)).append("\n");
        sb.append("    tags: ").append(toIndentedString(tags)).append("\n");
        sb.append("    hasError: ").append(toIndentedString(hasError)).append("\n");
        sb.append("    errorReasons: ").append(toIndentedString(errorReasons)).append("\n");
        sb.append("    type: ").append(toIndentedString(type)).append("\n");
        sb.append("    httpMethod: ").append(toIndentedString(httpMethod)).append("\n");
        sb.append("    bizCode: ").append(toIndentedString(bizCode)).append("\n");
        sb.append("}");
        return sb.toString();
    }

    /**
     * Convert the given object to string with each line indented by 4 spaces
     * (except the first line).
     */
    private String toIndentedString(java.lang.Object o) {
        if (o == null) {
            return "null";
        }
        return o.toString().replace("\n", "\n    ");
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy