Skip to content

Commit cf45093

Browse files
committed
[#4849] Mongo Plugin update for Front-End
1 parent 5820a18 commit cf45093

File tree

5 files changed

+9
-7
lines changed

5 files changed

+9
-7
lines changed

agent-it/src/test/java/com/navercorp/pinpoint/plugin/mongodb/MongoDBBase.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public void insertData(PluginTestVerifier verifier, MongoCollection<Document> co
9797
verifier.verifyTrace(event(MONGO_EXECUTE_QUERY, insertOne, null, MONGODB_ADDRESS, null
9898
, new ExpectedAnnotation(MongoConstants.MONGO_COLLECTION_INFO.getName(), collectionInfo)
9999
, new ExpectedAnnotation(MongoConstants.MONGO_COLLECTION_OPTION.getName(), collectionOption)
100-
, new ExpectedAnnotation(MongoConstants.MONGO_JSON.getName(), parsedBson)));
100+
, new ExpectedAnnotation(MongoConstants.MONGO_JSON_DATA.getName(), parsedBson)));
101101
}
102102

103103
public void updateData(PluginTestVerifier verifier, MongoCollection<Document> collection, Class<?> mongoDatabaseImpl) {
@@ -123,7 +123,7 @@ public void updateData(PluginTestVerifier verifier, MongoCollection<Document> co
123123
verifier.verifyTrace(event(MONGO_EXECUTE_QUERY, updateOne, null, MONGODB_ADDRESS, null
124124
, new ExpectedAnnotation(MongoConstants.MONGO_COLLECTION_INFO.getName(), "customers")
125125
, new ExpectedAnnotation(MongoConstants.MONGO_COLLECTION_OPTION.getName(), "MAJORITY")
126-
, new ExpectedAnnotation(MongoConstants.MONGO_JSON.getName(), parsedBson)));
126+
, new ExpectedAnnotation(MongoConstants.MONGO_JSON_DATA.getName(), parsedBson)));
127127
}
128128

129129

@@ -174,7 +174,7 @@ public void deleteData(PluginTestVerifier verifier, MongoCollection<Document> co
174174
verifier.verifyTrace(event(MONGO_EXECUTE_QUERY, deleteMany, null, MONGODB_ADDRESS, null
175175
, new ExpectedAnnotation(MongoConstants.MONGO_COLLECTION_INFO.getName(), "customers")
176176
, new ExpectedAnnotation(MongoConstants.MONGO_COLLECTION_OPTION.getName(), "MAJORITY")
177-
, new ExpectedAnnotation(MongoConstants.MONGO_JSON.getName(), parsedBson)));
177+
, new ExpectedAnnotation(MongoConstants.MONGO_JSON_DATA.getName(), parsedBson)));
178178

179179
Assert.assertEquals(1, deleteResult.getDeletedCount());
180180
}

plugins/mongodb/src/main/java/com/navercorp/pinpoint/plugin/mongo/MongoConstants.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ private MongoConstants() {
3131

3232
public static final String MONGO_SCOPE = "MONGO_JAVA_DRIVER";
3333

34-
public static final AnnotationKey MONGO_JSON = AnnotationKeyFactory.of(51, "MONGO-JSON");
34+
public static final AnnotationKey MONGO_JSON_DATA = AnnotationKeyFactory.of(51, "MONGO-JSON-Data");
3535
public static final AnnotationKey MONGO_COLLECTION_INFO = AnnotationKeyFactory.of(52, "Collection-Info", VIEW_IN_RECORD_SET);
3636
public static final AnnotationKey MONGO_COLLECTION_OPTION = AnnotationKeyFactory.of(53, "Collection-Option");
37-
public static final AnnotationKey MONGO_JSON_BINDVALUE = AnnotationKeyFactory.of(54, "MONGO-JSON-BindValue", VIEW_IN_RECORD_SET);
37+
public static final AnnotationKey MONGO_JSON = AnnotationKeyFactory.of(54, "MONGO-JSON", VIEW_IN_RECORD_SET);
38+
public static final AnnotationKey MONGO_JSON_BINDVALUE = AnnotationKeyFactory.of(55, "MONGO-JSON-BindValue", VIEW_IN_RECORD_SET);
3839

3940
public static final ServiceType MONGODB = ServiceTypeFactory.of(2650, "MONGO", TERMINAL, INCLUDE_DESTINATION_ID);
4041
public static final ServiceType MONGO_EXECUTE_QUERY = ServiceTypeFactory.of(2651, "MONGO_EXECUTE_QUERY", "MONGO", TERMINAL, RECORD_STATISTICS, INCLUDE_DESTINATION_ID);

plugins/mongodb/src/main/java/com/navercorp/pinpoint/plugin/mongo/MongoTypeProvider.java

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public void setup(TraceMetadataSetupContext context) {
2929
context.addServiceType(MongoConstants.MONGODB, AnnotationKeyMatchers.exact(AnnotationKey.ARGS0));
3030
context.addServiceType(MongoConstants.MONGO_EXECUTE_QUERY, AnnotationKeyMatchers.exact(AnnotationKey.ARGS0));
3131

32+
context.addAnnotationKey(MongoConstants.MONGO_JSON_DATA);
3233
context.addAnnotationKey(MongoConstants.MONGO_COLLECTION_INFO);
3334
context.addAnnotationKey(MongoConstants.MONGO_COLLECTION_OPTION);
3435
context.addAnnotationKey(MongoConstants.MONGO_JSON);

plugins/mongodb/src/main/java/com/navercorp/pinpoint/plugin/mongo/MongoUtil.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public static String getWriteConcern0(WriteConcern writeConcern) {
4848

4949
public static void recordParsedBson(SpanEventRecorder recorder, StringStringValue stringStringValue) {
5050
if (stringStringValue != null) {
51-
recorder.recordAttribute(MongoConstants.MONGO_JSON, stringStringValue);
51+
recorder.recordAttribute(MongoConstants.MONGO_JSON_DATA, stringStringValue);
5252
}
5353
}
5454

web/src/main/java/com/navercorp/pinpoint/web/service/SpanServiceImpl.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ public void replacement(SpanAlign spanAlign, List<AnnotationBo> annotationBoList
226226
collectionInfo.setValue(stringBuilder);
227227
}
228228

229-
AnnotationBo jsonAnnotation = findAnnotation(annotationBoList, MongoConstants.MONGO_JSON.getCode());
229+
AnnotationBo jsonAnnotation = findAnnotation(annotationBoList, MongoConstants.MONGO_JSON_DATA.getCode());
230230
if (jsonAnnotation == null) {
231231
return;
232232
}

0 commit comments

Comments
 (0)