Skip to content

Commit

Permalink
Fix LAL test query api. (apache#12206)
Browse files Browse the repository at this point in the history
  • Loading branch information
weixiang1862 authored May 10, 2024
1 parent 054d0e4 commit 19fba2d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
1 change: 1 addition & 0 deletions docs/en/changes/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#### OAP Server

* Fix LAL test query api.

#### UI

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ public void tag(final Map<String, ?> kv) {
.collect(Collectors.toList())
)
);
BINDING.get().log(logData);
}

@SuppressWarnings("unused")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

package org.apache.skywalking.oap.query.graphql.resolver;

import com.google.protobuf.InvalidProtocolBufferException;
import graphql.kickstart.tools.GraphQLQueryResolver;
import java.util.ArrayList;
import java.util.Arrays;
Expand All @@ -26,6 +27,7 @@
import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor;
import org.apache.skywalking.apm.network.logging.v3.LogData;
import org.apache.skywalking.apm.network.logging.v3.LogTags;
import org.apache.skywalking.oap.log.analyzer.dsl.Binding;
import org.apache.skywalking.oap.log.analyzer.dsl.DSL;
import org.apache.skywalking.oap.log.analyzer.module.LogAnalyzerModule;
Expand Down Expand Up @@ -88,7 +90,7 @@ public LogTestResponse test(LogTestRequest request) throws Exception {
}
l.setServiceId(it.getServiceId());
if (isNotBlank(it.getServiceInstanceId())) {
String name = IDManager.ServiceInstanceID.analysisId(it.getServiceId()).getName();
String name = IDManager.ServiceInstanceID.analysisId(it.getServiceInstanceId()).getName();
l.setServiceInstanceName(name);
}
l.setServiceInstanceId(it.getServiceInstanceId());
Expand All @@ -101,11 +103,18 @@ public LogTestResponse test(LogTestRequest request) throws Exception {
l.setTimestamp(it.getTimestamp());
l.setContentType(it.getContentType());
l.setContent(it.getContent());
final List<KeyValue> tags = it.getTags()
.stream()
.map(tag -> new KeyValue(tag.getKey(), tag.getValue()))
.collect(Collectors.toList());
l.getTags().addAll(tags);
if (it.getTagsRawData() != null) {
try {
final List<KeyValue> tags = LogTags.parseFrom(it.getTagsRawData())
.getDataList()
.stream()
.map(tag -> new KeyValue(tag.getKey(), tag.getValue()))
.collect(Collectors.toList());
l.getTags().addAll(tags);
} catch (InvalidProtocolBufferException e) {
// ignore
}
}

builder.log(l);
});
Expand Down

0 comments on commit 19fba2d

Please sign in to comment.