fix INEFFICIENT_KEYSET_ITERATOR (#5612)

* fix INEFFICIENT_KEYSET_ITERATOR
This commit is contained in:
Kdump 2020-10-06 21:44:23 +08:00 committed by GitHub
parent 117afff36f
commit a5f4052965
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 8 deletions

View File

@ -56,15 +56,14 @@ class BaseInterceptorMethods {
}
}
if (tags != null && !tags.isEmpty()) {
for (String key : tags.keySet()) {
String expression = tags.get(key);
spanTags.put(key, CustomizeExpression.parseExpression(expression, context));
for (Map.Entry<String, String> expression: tags.entrySet()) {
spanTags.put(expression.getKey(), CustomizeExpression.parseExpression(expression.getValue(), context));
}
}
if (logs != null && !logs.isEmpty()) {
for (String key : logs.keySet()) {
String expression = logs.get(key);
spanLogs.put(key, CustomizeExpression.parseExpression(expression, context));
for (Map.Entry<String, String> entries : logs.entrySet()) {
String expression = logs.get(entries.getKey());
spanLogs.put(entries.getKey(), CustomizeExpression.parseExpression(expression, context));
}
}
operationName = operationNameSuffix.insert(0, operationName).toString();

View File

@ -20,6 +20,7 @@ package org.apache.skywalking.oap.server.storage.plugin.elasticsearch.base;
import java.io.IOException;
import java.util.Map;
import org.apache.skywalking.oap.server.core.storage.AbstractDAO;
import org.apache.skywalking.oap.server.core.storage.type.StorageDataComplexObject;
import org.apache.skywalking.oap.server.library.client.elasticsearch.ElasticSearchClient;
@ -34,8 +35,9 @@ public abstract class EsDAO extends AbstractDAO<ElasticSearchClient> {
protected XContentBuilder map2builder(Map<String, Object> objectMap) throws IOException {
XContentBuilder builder = XContentFactory.jsonBuilder().startObject();
for (String key : objectMap.keySet()) {
Object value = objectMap.get(key);
for (Map.Entry<String, Object> entries: objectMap.entrySet()) {
Object value = entries.getValue();
String key = entries.getKey();
if (value instanceof StorageDataComplexObject) {
builder.field(key, ((StorageDataComplexObject) value).toStorageData());
} else {