-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
10 changed files
with
186 additions
and
80 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
...ent4/src/main/java/com/navercorp/pinpoint/plugin/httpclient4/CommandContextFormatter.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,36 @@ | ||
/* | ||
* Copyright 2017 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.httpclient4; | ||
|
||
/** | ||
* @author Woonduk Kang(emeroad) | ||
*/ | ||
public class CommandContextFormatter { | ||
|
||
public static String format(HttpCallContext commandContext) { | ||
final StringBuilder sb = new StringBuilder(); | ||
sb.append("write=").append(commandContext.getWriteElapsedTime()); | ||
if (commandContext.isWriteFail()) { | ||
sb.append("(fail)"); | ||
} | ||
sb.append(", read=").append(commandContext.getReadElapsedTime()); | ||
if (commandContext.isReadFail()) { | ||
sb.append("(fail)"); | ||
} | ||
return sb.toString(); | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
...ns/httpclient4/src/main/java/com/navercorp/pinpoint/plugin/httpclient4/EndPointUtils.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,58 @@ | ||
/* | ||
* Copyright 2017 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.httpclient4; | ||
|
||
import org.apache.http.HttpHost; | ||
import org.apache.http.conn.routing.HttpRoute; | ||
|
||
/** | ||
* @author Woonduk Kang(emeroad) | ||
*/ | ||
public class EndPointUtils { | ||
|
||
|
||
public static String getHostAndPort(HttpRoute route) { | ||
final HttpHost proxyHost = route.getProxyHost(); | ||
if (proxyHost != null) { | ||
final String hostName = proxyHost.getHostName(); | ||
final int port = proxyHost.getPort(); | ||
if (port > 0) { | ||
return hostAndPort(hostName, port); | ||
} | ||
return hostName; | ||
} else { | ||
final HttpHost targetHost = route.getTargetHost(); | ||
if (targetHost != null) { | ||
final String hostName = targetHost.getHostName(); | ||
final int port = targetHost.getPort(); | ||
if (port > 0) { | ||
return hostAndPort(hostName, targetHost.getPort()); | ||
} | ||
return hostName; | ||
} | ||
} | ||
return ""; | ||
} | ||
|
||
public static String hostAndPort(String host, int port) { | ||
final StringBuilder sb = new StringBuilder(); | ||
sb.append(host); | ||
sb.append(':'); | ||
sb.append(port); | ||
return sb.toString(); | ||
} | ||
} |
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
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
Oops, something went wrong.