peachisai commented on code in PR #13943: URL: https://github.com/apache/skywalking/pull/13943#discussion_r3571627656
########## oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/genai/GenAIEvaluationRecord.java: ########## @@ -0,0 +1,162 @@ +/* + * 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.skywalking.oap.server.core.analysis.manual.genai; + +import lombok.Getter; +import lombok.Setter; +import org.apache.skywalking.oap.server.core.analysis.Stream; +import org.apache.skywalking.oap.server.core.analysis.record.Record; +import org.apache.skywalking.oap.server.core.analysis.worker.RecordStreamProcessor; +import org.apache.skywalking.oap.server.core.source.DefaultScopeDefine; +import org.apache.skywalking.oap.server.core.source.ScopeDeclaration; +import org.apache.skywalking.oap.server.core.storage.StorageID; +import org.apache.skywalking.oap.server.core.storage.annotation.BanyanDB; +import org.apache.skywalking.oap.server.core.storage.annotation.Column; +import org.apache.skywalking.oap.server.core.storage.annotation.ElasticSearch; +import org.apache.skywalking.oap.server.core.storage.annotation.SuperDataset; +import org.apache.skywalking.oap.server.core.storage.type.Convert2Entity; +import org.apache.skywalking.oap.server.core.storage.type.Convert2Storage; +import org.apache.skywalking.oap.server.core.storage.type.StorageBuilder; + +@Getter +@Setter +@SuperDataset +@ScopeDeclaration(id = DefaultScopeDefine.GEN_AI_EVALUATION_RECORD, name = "GenAIEvaluationRecord") +@Stream(name = GenAIEvaluationRecord.INDEX_NAME, scopeId = DefaultScopeDefine.GEN_AI_EVALUATION_RECORD, + builder = GenAIEvaluationRecord.Builder.class, processor = RecordStreamProcessor.class) [email protected](GenAIEvaluationRecord.EVALUATION_TIME) [email protected](streamGroup = BanyanDB.StreamGroup.RECORDS) +public class GenAIEvaluationRecord extends Record { + + public static final String INDEX_NAME = "gen_ai_evaluation_record"; + public static final String TRACE_ID = "trace_id"; + public static final String SERVICE_ID = "service_id"; + public static final String SERVICE_INSTANCE_ID = "service_instance_id"; + public static final String SEGMENT_ID = "segment_id"; + public static final String SPAN_ID = "span_id"; + public static final String SPAN_TYPE = "span_type"; + public static final String TASK_NAME = "task_name"; + public static final String VALUE_TYPE = "value_type"; + public static final String VALUE = "value"; + public static final String EVALUATION_LEVEL = "evaluation_level"; + public static final String REASON = "reason"; + public static final String JUDGE_MODEL = "judge_model"; + public static final String EVALUATION_TIME = "evaluation_time"; + + @Column(name = TRACE_ID, length = 150) + @BanyanDB.IndexRule(indexType = BanyanDB.IndexRule.IndexType.SKIPPING) + private String traceId; + + @ElasticSearch.EnableDocValues + @Column(name = SERVICE_ID, length = 150, storageOnly = true) + @BanyanDB.SeriesID(index = 0) + private String serviceId; + + @ElasticSearch.EnableDocValues + @Column(name = SERVICE_INSTANCE_ID, length = 150, storageOnly = true) + @BanyanDB.SeriesID(index = 1) + private String serviceInstanceId; + + @Column(name = SEGMENT_ID, length = 150, storageOnly = true) + private String segmentId; + + @Column(name = SPAN_ID, length = 150, storageOnly = true) + private String spanId; + + @Column(name = SPAN_TYPE, length = 64) + private String spanType; + + @ElasticSearch.EnableDocValues + @Column(name = TASK_NAME, length = 512) + private String taskName; + + @Column(name = VALUE_TYPE, length = 64, storageOnly = true) + private String valueType; + + @Column(name = VALUE, length = 4096, storageOnly = true) + private String value; + + @ElasticSearch.EnableDocValues + @Column(name = EVALUATION_LEVEL, length = 64) + @BanyanDB.IndexRule(indexType = BanyanDB.IndexRule.IndexType.SKIPPING) + private String evaluationLevel; + + @Column(name = REASON, length = 4096, storageOnly = true) + private String reason; + + @Column(name = JUDGE_MODEL, length = 64, storageOnly = true) + private String judgeModel; + + @ElasticSearch.EnableDocValues + @Column(name = EVALUATION_TIME) + private long evaluationTime; + + @Override + public StorageID id() { + return new StorageID() + .append(TRACE_ID, traceId) + .append(SERVICE_ID, serviceId) + .append(SERVICE_INSTANCE_ID, serviceInstanceId) + .append(SPAN_ID, spanId) + .append(SPAN_TYPE, spanType) + .append(TASK_NAME, taskName) + .append(EVALUATION_LEVEL, evaluationLevel) + .append(EVALUATION_TIME, evaluationTime); Review Comment: > This looks dangerous, could you ref to existing app log? I feel we have a uuid kind of thing? Fixed -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
