Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elc logger #862

Open
wants to merge 46 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
8f168ad
[brotli] Add brotli support backed by org.brotli.dec
Fohlen Sep 30, 2018
e4dbaa1
Merge pull request #1 from eventzimmer/add_brotli_support
antonu17 Jan 31, 2019
4863fa8
update jackson bindings
Jan 31, 2019
0bbe743
Merge pull request #2 from hellofresh/jackson_binding
kirillbilchenko Jan 31, 2019
dd49e1a
promote release version
Jan 31, 2019
e86f225
2.1.7-SNAPSHOT
Jan 31, 2019
89217aa
Merge pull request #3 from hellofresh/version_promote
kirillbilchenko Jan 31, 2019
dae00cd
added statsD metrics to gather failed requests
Feb 20, 2019
cfa12b3
Update base prefix and namespace
Feb 20, 2019
41a9af3
Promote snapshot version
Feb 20, 2019
0dba43e
Merge pull request #4 from hellofresh/stats_d_metrics
kirillbilchenko Feb 20, 2019
6d131c5
Fix metrics (#5)
kirillbilchenko Feb 21, 2019
accde93
2.1.9 release (#6)
kirillbilchenko Feb 25, 2019
1da281b
BrowserMob 0 response metrics (#7)
kirillbilchenko Feb 25, 2019
aeb2a18
Release 2.1.11 fix stats d metrics (#8)
kirillbilchenko Feb 25, 2019
57f6c42
Libs pormotion (#11)
kirillbilchenko Mar 5, 2019
3dabce1
[PT-3269] 500 errors to graylog (#12)
kirillbilchenko Mar 19, 2019
d177850
promote browser mob, and fix logs duplication (#13)
kirillbilchenko Mar 19, 2019
b44c839
BMP and little proxy promote (#14)
kirillbilchenko Mar 25, 2019
22afbd3
initial commit (#15)
kirillbilchenko Apr 2, 2019
68b3842
added proxy 0 responses logged in (#16)
kirillbilchenko Apr 3, 2019
6191a41
Memory consumption fix (#17)
kirillbilchenko Apr 4, 2019
3362a38
BMP_2.1.24 release (#18)
kirillbilchenko Apr 5, 2019
a811bef
BMP_2.1.27 promotion (#19)
kirillbilchenko Apr 8, 2019
5b601c2
minor change
Apr 8, 2019
42c7cf3
BMP 2.1.28 promotion (#20)
kirillbilchenko May 3, 2019
226f271
Update logs handling and statsd (#21)
kirillbilchenko May 8, 2019
99992b4
Bmp 2.1.30 (#22)
kirillbilchenko May 10, 2019
3558f12
Update statsD client creation process and filtering (#23)
kirillbilchenko May 21, 2019
2337f7f
small restructuring of stats d (#24)
kirillbilchenko Jun 7, 2019
195c44a
BMP 2.1.33 (#25)
kirillbilchenko Aug 26, 2019
f67c671
Fix header injection for rest module and promote version (#26)
kirillbilchenko Aug 27, 2019
ef3b41c
2.1.35 (#27)
kirillbilchenko Oct 17, 2019
b285fc5
Configure WhiteSource for GitHub.com (#28)
mend-for-github-com[bot] Aug 20, 2020
8a3c252
BMP_2.1.36 (#29)
kirillbilchenko Aug 20, 2020
00b04f7
Open jdk 11 (#30)
kirillbilchenko Aug 20, 2020
c7dac9f
Migrate .whitesource configuration file to inheritance mode (#32)
mend-for-github-com[bot] Aug 20, 2020
0b18144
Added fluentD logger
kirillbilchenko Aug 20, 2020
bd05297
Naming fix
kirillbilchenko Aug 20, 2020
9b32c62
Logic fix
kirillbilchenko Aug 20, 2020
29bcac7
Added fluentD logger (#33)
kirillbilchenko Aug 20, 2020
0a26374
Update littleproxy-1.1.7.jar (#35)
kirillbilchenko Aug 24, 2020
9ef5cbc
Added ELC logger (#36)
kirillbilchenko Aug 24, 2020
ffd4b11
Revert little proxy to 1.1.6 (#37)
kirillbilchenko Aug 24, 2020
aa7c195
Update ELC logger
kirillbilchenko Aug 24, 2020
a0e99a5
Merge branch 'master' into ELC_logger
kirillbilchenko Aug 24, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
sudo: false

language: java
dist: bionic
jdk:
# Not running tests against openjdk7, since the SunEC is not included in travis-ci's version of openjdk7.
# Not running tests against oraclejdk7, since travis-ci no longer provides it.
# - openjdk7
- oraclejdk8
- openjdk11

cache:
directories:
Expand Down
3 changes: 3 additions & 0 deletions .whitesource
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"settingsInheritedFrom": "hellofresh/whitesource-config@master"
}
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ Set a URL to blacklist | PUT | */proxy/[port]/blacklist* |<p>*regex* - The black
Clears all URL patterns from the blacklist | DELETE | */proxy/[port]/blacklist* ||
Limit the bandwidth through the proxy on the *[port]* | PUT | */proxy/[port]/limit* |<p>*downstreamKbps* - Sets the downstream bandwidth limit in kbps. Optional.</p><p>*upstreamKbps* - Sets the upstream bandwidth limit kbps. Optional, by default unlimited.</p><p>*downstreamMaxKB* - Specifies how many kilobytes in total the client is allowed to download through the proxy. Optional, by default unlimited.</p><p>*upstreamMaxKB* - Specifies how many kilobytes in total the client is allowed to upload through the proxy. Optional, by default unlimited.</p><p>*latency* - Add the given latency to each HTTP request. Optional, by default all requests are invoked without latency.</p><p>*enable* - A boolean that enable bandwidth limiter. Optional, by default to "false", but setting any of the properties above will implicitly enable throttling</p><p>*payloadPercentage* - Specifying what percentage of data sent is payload, e.g. use this to take into account overhead due to tcp/ip. Optional.</p><p>*maxBitsPerSecond* - The max bits per seconds you want this instance of StreamManager to respect. Optional.</p>
Displays the amount of data remaining to be uploaded/downloaded until the limit is reached | GET | */proxy/[port]/limit* ||
Set and override HTTP Request headers | POST | */proxy/[port]/headers* | Payload data should be **JSON** encoded set of headers. Where key is a header name (such as "User-Agent") and value is a value of HTTP header to setup (such as "BrowserMob-Agent"). Example: `{"User-Agent": "BrowserMob-Agent"}`|
Set and override HTTP Request headers | POST | */proxy/[port]/headers* | Payload data should be **JSON** encoded set of headers and optionally `headersFilterRegexp: .*.*` . Where key is a header name (such as "User-Agent") and value is a value of HTTP header to setup (such as "BrowserMob-Agent"). Example: `{"User-Agent": "BrowserMob-Agent"}`|
Overrides normal DNS lookups and remaps the given hosts with the associated IP address | POST | */proxy/[port]/hosts* | Payload data should be **JSON** encoded set of hosts. Where key is a host name (such as "example.com") and value is a IP address which associatied with host hame (such as "1.2.3.4"'). Example: `{"example.com": "1.2.3.4"}`|
Sets automatic basic authentication for the specified domain | POST | */proxy/[port]/auth/basic/[domain]* | Payload data should be **JSON** encoded username and password name/value pairs. Example: `{"username": "myUsername", "password": "myPassword"}`|
Wait till all request are being made | PUT | */proxy/[port]/wait* |<p>*quietPeriodInMs* - Wait till all request are being made. Optional.</p><p>*timeoutInMs* - Sets quiet period in milliseconds. Optional.</p>|
Expand Down Expand Up @@ -190,6 +190,7 @@ system properties will be used to specify the upstream proxy.
- -proxyPortRange \<from\>-\<to\>
- Range of ports reserved for proxies. Only applies if *port* parameter is not supplied in the POST request. Default values are \<port\>+1 to \<port\>+500+1.
- -ttl \<seconds\>
- -maxResponseSizeBytes max size of response in bytes by default 2097152 (2 MB)
- Proxy will be automatically deleted after a specified time period. Off by default.

### Embedded Mode
Expand Down Expand Up @@ -395,7 +396,7 @@ When you build the latest code from source, you'll have access to the latest sna
<dependency>
<groupId>net.lightbody.bmp</groupId>
<artifactId>browsermob-core</artifactId>
<version>2.1.6-SNAPSHOT</version>
<version>2.1.38</version>
<scope>test</scope>
</dependency>
```
40 changes: 31 additions & 9 deletions browsermob-core/pom.xml
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<packaging>jar</packaging>

<parent>
<artifactId>browsermob-proxy</artifactId>
<groupId>net.lightbody.bmp</groupId>
<version>2.1.6-SNAPSHOT</version>
<version>2.1.38</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>browsermob-core</artifactId>
<name>BrowserMob Proxy Core (LittleProxy) Module</name>

<properties>
<unit-test-jetty.version>7.6.16.v20140903</unit-test-jetty.version>
<unit-test-jetty.version>9.4.21.v20190926</unit-test-jetty.version>
</properties>

<build>
Expand Down Expand Up @@ -41,15 +42,15 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-Xmx1g -XX:MaxPermSize=256m</argLine>
<argLine>-Xmx1g</argLine>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>net.lightbody.bmp</groupId>
<groupId>org.littleshoot</groupId>
<artifactId>littleproxy</artifactId>
<exclusions>
<exclusion>
Expand All @@ -68,6 +69,12 @@
<artifactId>jackson-core</artifactId>
</dependency>

<dependency>
<groupId>co.elastic.logging</groupId>
<artifactId>log4j2-ecs-layout</artifactId>
</dependency>


<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
Expand All @@ -86,7 +93,7 @@
<dependency>
<groupId>dnsjava</groupId>
<artifactId>dnsjava</artifactId>
<version>2.1.8</version>
<version>2.1.9</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -133,12 +140,24 @@
<artifactId>bcpkix-jdk15on</artifactId>
</dependency>

<dependency>
<groupId>com.timgroup</groupId>
<artifactId>java-statsd-client</artifactId>
</dependency>

<dependency>
<groupId>net.lightbody.bmp</groupId>
<artifactId>mitm</artifactId>
<version>${project.version}</version>
</dependency>

<!-- use google brotli for brotli decoding-->
<dependency>
<groupId>org.brotli</groupId>
<artifactId>dec</artifactId>
<version>0.1.2</version>
</dependency>

<!-- Netty will use javassist to improve performance if it is present on the classpath, but it is not required -->
<dependency>
<groupId>org.javassist</groupId>
Expand All @@ -149,12 +168,10 @@
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
Expand Down Expand Up @@ -242,7 +259,12 @@

<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<artifactId>hamcrest</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public interface BrowserMobProxy {
* Starts the proxy on the specified port. The proxy will listen for connections on the network interface specified by the bindAddress, and will
* also initiate connections to upstream servers on the same network interface.
*
* @param port port to listen on
* @param port port to listen on
* @param bindAddress address of the network interface on which the proxy will listen for connections and also attempt to connect to upstream servers.
* @throws java.lang.IllegalStateException if the proxy has already been started
*/
Expand All @@ -49,7 +49,7 @@ public interface BrowserMobProxy {
* Starts the proxy on the specified port. The proxy will listen for connections on the network interface specified by the clientBindAddress, and will
* initiate connections to upstream servers from the network interface specified by the serverBindAddress.
*
* @param port port to listen on
* @param port port to listen on
* @param clientBindAddress address of the network interface on which the proxy will listen for connections
* @param serverBindAddress address of the network interface on which the proxy will connect to upstream servers
* @throws java.lang.IllegalStateException if the proxy has already been started
Expand All @@ -68,7 +68,7 @@ public interface BrowserMobProxy {
* @throws java.lang.IllegalStateException if the proxy has not been started.
*/
void stop();

/**
* Like {@link #stop()}, shuts down the proxy server and no longer accepts incoming connections, but does not wait for any existing
* network traffic to cease. Any existing connections to clients or to servers may be force-killed immediately.
Expand Down Expand Up @@ -125,7 +125,7 @@ public interface BrowserMobProxy {
/**
* Starts a new HAR file with the specified page name and page title. Enables HAR capture if it was not previously enabled.
*
* @param initialPageRef initial page name of the new HAR file
* @param initialPageRef initial page name of the new HAR file
* @param initialPageTitle initial page title of the new HAR file
* @return existing HAR file, or null if none exists or HAR capture was disabled
*/
Expand Down Expand Up @@ -215,7 +215,7 @@ public interface BrowserMobProxy {
* Starts a new HAR page using the specified pageRef as the page name and the pageTitle as the page title. Populates the
* {@link net.lightbody.bmp.core.har.HarPageTimings#onLoad} value based on the amount of time the current page has been captured.
*
* @param pageRef name of the new page
* @param pageRef name of the new page
* @param pageTitle title of the new page
* @return the HAR as it existed immediately after ending the current page
* @throws java.lang.IllegalStateException if HAR capture has not been enabled via {@link #newHar()} or {@link #newHar(String)}
Expand Down Expand Up @@ -258,7 +258,7 @@ public interface BrowserMobProxy {
* The minimum amount of time that will elapse between the time the proxy begins receiving a response from the server and the time the
* proxy begins sending the response to the client.
*
* @param latency minimum latency, or 0 for no minimum
* @param latency minimum latency, or 0 for no minimum
* @param timeUnit TimeUnit for the latency
*/
void setLatency(long latency, TimeUnit timeUnit);
Expand All @@ -268,7 +268,7 @@ public interface BrowserMobProxy {
* specified time, the proxy will respond with an HTTP 502 Bad Gateway. The default value is 60 seconds.
*
* @param connectionTimeout maximum time to wait to establish a connection to a server, or 0 to wait indefinitely
* @param timeUnit TimeUnit for the connectionTimeout
* @param timeUnit TimeUnit for the connectionTimeout
*/
void setConnectTimeout(int connectionTimeout, TimeUnit timeUnit);

Expand All @@ -279,7 +279,7 @@ public interface BrowserMobProxy {
* connection to the client <i>may</i> be closed abruptly. The default value is 60 seconds.
*
* @param idleConnectionTimeout maximum time to allow a connection to remain idle, or 0 to wait indefinitely.
* @param timeUnit TimeUnit for the idleConnectionTimeout
* @param timeUnit TimeUnit for the idleConnectionTimeout
*/
void setIdleConnectionTimeout(int idleConnectionTimeout, TimeUnit timeUnit);

Expand All @@ -290,15 +290,15 @@ public interface BrowserMobProxy {
* connection to the client <i>may</i> be closed abruptly. The default value is 0 (wait indefinitely).
*
* @param requestTimeout maximum time to wait for an HTTP response, or 0 to wait indefinitely
* @param timeUnit TimeUnit for the requestTimeout
* @param timeUnit TimeUnit for the requestTimeout
*/
void setRequestTimeout(int requestTimeout, TimeUnit timeUnit);

/**
* Enables automatic authorization for the specified domain and auth type. Every request sent to the specified domain will contain the
* specified authorization information.
*
* @param domain domain automatically send authorization information to
* @param domain domain automatically send authorization information to
* @param username authorization username
* @param password authorization password
* @param authType authorization type
Expand Down Expand Up @@ -340,7 +340,7 @@ public interface BrowserMobProxy {
* For example, the following rewrite rule:
*
* <pre> {@code proxy.rewriteUrl("http://www\\.(yahoo|bing)\\.com/\\?(\\w+)=(\\w+)", "http://www.google.com/?originalDomain=$1&$2=$3");}</pre>
*
* <p>
* will match an HTTP request (but <i>not</i> HTTPS!) to www.yahoo.com or www.bing.com with exactly 1 query parameter,
* and replace it with a call to www.google.com with an 'originalDomain' query parameter, as well as the original query parameter.
* <p/>
Expand All @@ -353,7 +353,7 @@ public interface BrowserMobProxy {
* will result in the proxy making a request to:
* <pre> {@code http://www.google.com?originalDomain=bing&anotherParam=anotherValue}</pre>
*
* @param urlPattern URL-matching regular expression
* @param urlPattern URL-matching regular expression
* @param replacementExpression an expression, which may optionally contain capture groups, which will replace any URL which matches urlPattern
*/
void rewriteUrl(String urlPattern, String replacementExpression);
Expand Down Expand Up @@ -410,8 +410,8 @@ public interface BrowserMobProxy {
* <p/>
* See {@link #blacklistRequests(String, int)} for details on the URL the urlPattern will match.
*
* @param urlPattern URL-matching regular expression to blacklist
* @param statusCode HTTP status code to return
* @param urlPattern URL-matching regular expression to blacklist
* @param statusCode HTTP status code to return
* @param httpMethodPattern regular expression matching a request's HTTP method
*/
void blacklistRequests(String urlPattern, int statusCode, String httpMethodPattern);
Expand Down Expand Up @@ -447,7 +447,7 @@ public interface BrowserMobProxy {
* whitelist response code.
*
* @param urlPatterns URL-matching regular expressions to whitelist; null or an empty collection will enable an empty whitelist
* @param statusCode HTTP status code to return to clients when a URL matches a pattern
* @param statusCode HTTP status code to return to clients when a URL matches a pattern
*/
void whitelistRequests(Collection<String> urlPatterns, int statusCode);

Expand Down Expand Up @@ -501,11 +501,18 @@ public interface BrowserMobProxy {
/**
* Adds a new HTTP header to every request. If the header already exists on the request, it will be replaced with the specified header.
*
* @param name name of the header to add
* @param name name of the header to add
* @param value new header's value
*/
void addHeader(String name, String value);

/**
* Header filter regexp.
*
* @param headerFilterRegexp the header filter regexp
*/
void headerFilterRegexp(String headerFilterRegexp);

/**
* Removes a header previously added with {@link #addHeader(String name, String value)}.
*
Expand Down Expand Up @@ -545,8 +552,8 @@ public interface BrowserMobProxy {
* for the quiet period within the specified timeout, otherwise returns false.
*
* @param quietPeriod amount of time after which network traffic will be considered "stopped"
* @param timeout maximum amount of time to wait for network traffic to stop
* @param timeUnit TimeUnit for the quietPeriod and timeout
* @param timeout maximum amount of time to wait for network traffic to stop
* @param timeUnit TimeUnit for the quietPeriod and timeout
* @return true if network traffic is stopped, otherwise false
*/
boolean waitForQuiescence(long quietPeriod, long timeout, TimeUnit timeUnit);
Expand Down Expand Up @@ -587,7 +594,7 @@ public interface BrowserMobProxy {
* {@link org.littleshoot.proxy.HttpFilters} instance (typically, a subclass of {@link org.littleshoot.proxy.HttpFiltersAdapter}).
* To disable or bypass a filter on a per-request basis, the filterRequest() method may return null.
*
* @param filterFactory factory to generate HttpFilters
* @param filterFactory factory to generate HttpFilters
*/
void addLastHttpFilterFactory(HttpFiltersSource filterFactory);

Expand Down
Loading