Skip to content

Commit

Permalink
fix: HttpURLConnectionPlugin moved to package com.megaease.easeagent.…
Browse files Browse the repository at this point in the history
…plugin.httpurlconnection;
  • Loading branch information
lanxenet committed Sep 25, 2023
1 parent e83f491 commit 04e82e9
Show file tree
Hide file tree
Showing 11 changed files with 180 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ interface Namespace {
String WEB_CLIENT = "webclient";
String FEIGN_CLIENT = "feignClient";
String REST_TEMPLATE = "resTemplate";
String HTTPURLCONNECTION = "httpURLConnection";

String FORWARDED = "forwarded";
}
Expand Down
5 changes: 0 additions & 5 deletions plugins/httpclient/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@
<artifactId>plugin-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
Expand Down
50 changes: 50 additions & 0 deletions plugins/httpurlconnection/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2023, MegaEase
~ All rights reserved.
~
~ 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.
-->

<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">
<parent>
<artifactId>plugins</artifactId>
<groupId>com.megaease.easeagent</groupId>
<version>2.2.7</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>httpurlconnection</artifactId>


<dependencies>
<dependency>
<groupId>com.megaease.easeagent</groupId>
<artifactId>plugin-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.megaease.easeagent</groupId>
<artifactId>plugin-api-mock</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright (c) 2023, MegaEase
* All rights reserved.
*
* 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.megaease.easeagent.plugin.httpurlconnection;

import com.megaease.easeagent.plugin.AgentPlugin;
import com.megaease.easeagent.plugin.api.config.ConfigConst;

public class ForwardedPlugin implements AgentPlugin {
@Override
public String getNamespace() {
return ConfigConst.Namespace.FORWARDED;
}

@Override
public String getDomain() {
return ConfigConst.INTEGRABILITY;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright (c) 2023, MegaEase
* All rights reserved.
*
* 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.megaease.easeagent.plugin.httpurlconnection;

import com.megaease.easeagent.plugin.AgentPlugin;
import com.megaease.easeagent.plugin.api.config.ConfigConst;

public class HttpURLConnectionPlugin implements AgentPlugin {
@Override
public String getNamespace() {
return ConfigConst.Namespace.HTTPURLCONNECTION;
}

@Override
public String getDomain() {
return ConfigConst.OBSERVABILITY;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package com.megaease.easeagent.plugin.httpclient.advice;
package com.megaease.easeagent.plugin.httpurlconnection.advice;

import com.megaease.easeagent.plugin.Points;
import com.megaease.easeagent.plugin.matcher.ClassMatcher;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
* limitations under the License.
*/

package com.megaease.easeagent.plugin.httpclient.interceptor;
package com.megaease.easeagent.plugin.httpurlconnection.interceptor;

import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap;
import com.megaease.easeagent.plugin.annotation.AdviceTo;
import com.megaease.easeagent.plugin.api.Context;
import com.megaease.easeagent.plugin.api.trace.Span;
import com.megaease.easeagent.plugin.httpclient.HttpClientPlugin;
import com.megaease.easeagent.plugin.httpclient.advice.HttpURLConnectionGetResponseCodeAdvice;
import com.megaease.easeagent.plugin.httpurlconnection.HttpURLConnectionPlugin;
import com.megaease.easeagent.plugin.httpurlconnection.advice.HttpURLConnectionGetResponseCodeAdvice;
import com.megaease.easeagent.plugin.interceptor.MethodInfo;
import com.megaease.easeagent.plugin.tools.trace.BaseHttpClientTracingInterceptor;
import com.megaease.easeagent.plugin.tools.trace.HttpRequest;
Expand All @@ -35,7 +35,7 @@
import java.util.Map;


@AdviceTo(value = HttpURLConnectionGetResponseCodeAdvice.class, qualifier = "default", plugin = HttpClientPlugin.class)
@AdviceTo(value = HttpURLConnectionGetResponseCodeAdvice.class, qualifier = "default", plugin = HttpURLConnectionPlugin.class)
public class HttpURLConnectionGetResponseCodeInterceptor extends BaseHttpClientTracingInterceptor {
@Override
public Object getProgressKey() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
/*
* Copyright (c) 2023, Inspireso and/or its affiliates. All rights reserved.
* Copyright (c) 2023, MegaEase
* All rights reserved.
*
* 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.megaease.easeagent.plugin.httpclient.interceptor;
package com.megaease.easeagent.plugin.httpurlconnection.interceptor;

import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright (c) 2021, MegaEase
* All rights reserved.
*
* 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.megaease.easeagent.plugin.httpurlconnection.interceptor;

public class TestConst {
public static final String RESPONSE_TAG_NAME = "X-EG-Test";
public static final String RESPONSE_TAG_VALUE = "X-EG-Test-Value";
}
19 changes: 19 additions & 0 deletions plugins/httpurlconnection/src/test/resources/mock_agent.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#
# Copyright (c) 2023, MegaEase
# All rights reserved.
#
# 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.
#

easeagent.progress.forwarded.headers=X-Forwarded-For
observability.tracings.tag.response.headers.eg.0=X-EG-Test
1 change: 1 addition & 0 deletions plugins/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
<module>dubbo</module>
<module>motan</module>
<module>sofarpc</module>
<module>httpurlconnection</module>
</modules>

<dependencyManagement>
Expand Down

0 comments on commit 04e82e9

Please sign in to comment.