Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
252 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
plugins/mongodb/src/main/java/com/navercorp/pinpoint/plugin/mongo/NormalizedBson.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* Copyright 2019 NAVER Corp. | ||
* | ||
* Licensed 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 com.navercorp.pinpoint.plugin.mongo; | ||
|
||
/** | ||
* @author Woonduk Kang(emeroad) | ||
*/ | ||
public class NormalizedBson { | ||
|
||
private final String normalizedBson; | ||
private final String parameter; | ||
|
||
public NormalizedBson(String normalizedBson, String parameter) { | ||
this.normalizedBson = normalizedBson; | ||
this.parameter = parameter; | ||
} | ||
|
||
public String getNormalizedBson() { | ||
return normalizedBson; | ||
} | ||
|
||
public String getParameter() { | ||
return parameter; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "NormalizedBson{" + | ||
"normalizedBson='" + normalizedBson + '\'' + | ||
", parameter='" + parameter + '\'' + | ||
'}'; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (!(o instanceof NormalizedBson)) return false; | ||
|
||
NormalizedBson that = (NormalizedBson) o; | ||
|
||
if (normalizedBson != null ? !normalizedBson.equals(that.normalizedBson) : that.normalizedBson != null) return false; | ||
return parameter != null ? parameter.equals(that.parameter) : that.parameter == null; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
int result = normalizedBson != null ? normalizedBson.hashCode() : 0; | ||
result = 31 * result + (parameter != null ? parameter.hashCode() : 0); | ||
return result; | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
...godb/src/main/java/com/navercorp/pinpoint/plugin/mongo/interceptor/DatabaseInfoUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright 2019 NAVER Corp. | ||
* | ||
* Licensed 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 com.navercorp.pinpoint.plugin.mongo.interceptor; | ||
|
||
import com.navercorp.pinpoint.bootstrap.context.DatabaseInfo; | ||
import com.navercorp.pinpoint.bootstrap.plugin.jdbc.DatabaseInfoAccessor; | ||
import com.navercorp.pinpoint.bootstrap.plugin.jdbc.UnKnownDatabaseInfo; | ||
|
||
/** | ||
* @author Woonduk Kang(emeroad) | ||
*/ | ||
public final class DatabaseInfoUtils { | ||
private DatabaseInfoUtils() { | ||
} | ||
|
||
public static DatabaseInfo getDatabaseInfo(Object target, DatabaseInfo defaultDatabaseInfo) { | ||
if (target instanceof DatabaseInfoAccessor) { | ||
final DatabaseInfo databaseInfo = ((DatabaseInfoAccessor) target)._$PINPOINT$_getDatabaseInfo(); | ||
if (databaseInfo != null) { | ||
return databaseInfo; | ||
} | ||
} | ||
return defaultDatabaseInfo; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.