From 1b6b76e86f4131c767fa25a34000e5ba76d95eed Mon Sep 17 00:00:00 2001 From: littleaj <1690572+littleaj@users.noreply.github.com> Date: Thu, 7 Dec 2017 11:42:14 -0800 Subject: [PATCH 1/3] reworked 'provided' configuration so it works properly (should not be repackaged in our jars) --- gradle/provided-configuration.gradle | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/gradle/provided-configuration.gradle b/gradle/provided-configuration.gradle index 4aa7fe351b7..a87e81bc3e8 100644 --- a/gradle/provided-configuration.gradle +++ b/gradle/provided-configuration.gradle @@ -19,21 +19,18 @@ * DEALINGS IN THE SOFTWARE. */ -// Adding the "provided" configuration - -ext { - PROVIDED_CONFIGURATION_NAME = "provided" +// Defines the "provided" configuration for dependencies that the client is responsible for including on the classpath +configurations { + provided } -configurations { - provided { - // Remove the provided dependencies from the default configuration so - // these dependencies won't be derived by projects that has a dependency on - // the project using the provided scope - dependencies.all { dep -> - configurations.default.exclude group: dep.group, module: dep.name - } +sourceSets { + main { + compileClasspath += configurations.provided + runtimeClasspath += configurations.provided + } + test { + compileClasspath += configurations.provided + runtimeClasspath += configurations.provided } - compile.extendsFrom provided } - From d005fc5abe6861936c37d75386d39d6def2c4001 Mon Sep 17 00:00:00 2001 From: littleaj <1690572+littleaj@users.noreply.github.com> Date: Thu, 7 Dec 2017 11:44:15 -0800 Subject: [PATCH 2/3] removed references to the agent package (previously incorrectly included in the jar) --- .../FixedRateSamplingTelemetryProcessor.java | 7 ++++--- .../channel/samplingV2/SamplingScoreGeneratorV2.java | 6 +++--- .../FixedRateSamplingTelemetryProcessorTest.java | 10 +++++----- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/core/src/main/java/com/microsoft/applicationinsights/internal/channel/samplingV2/FixedRateSamplingTelemetryProcessor.java b/core/src/main/java/com/microsoft/applicationinsights/internal/channel/samplingV2/FixedRateSamplingTelemetryProcessor.java index 9b556860df9..0e293672515 100644 --- a/core/src/main/java/com/microsoft/applicationinsights/internal/channel/samplingV2/FixedRateSamplingTelemetryProcessor.java +++ b/core/src/main/java/com/microsoft/applicationinsights/internal/channel/samplingV2/FixedRateSamplingTelemetryProcessor.java @@ -1,6 +1,5 @@ package com.microsoft.applicationinsights.internal.channel.samplingV2; -import com.microsoft.applicationinsights.agent.internal.common.StringUtils; import com.microsoft.applicationinsights.extensibility.TelemetryProcessor; import com.microsoft.applicationinsights.internal.annotation.BuiltInProcessor; import com.microsoft.applicationinsights.internal.logger.InternalLogger; @@ -12,6 +11,8 @@ import java.util.Map; import java.util.Set; +import org.apache.commons.lang3.StringUtils; + /** * This processor is used to Perform Sampling on User specified sampling rate *
@@ -99,9 +100,9 @@ public Set> depende
processor.setSamplingPercentage(String.valueOf(samplingRate));
if (includeTypes != null) {
for (String includeType : includeTypes) {
- if (!StringUtils.isNullOrEmpty(includeType)) {
+ if (!StringUtils.isEmpty(includeType)) {
processor.addToIncludedType(includeType);
}
}
@@ -521,7 +521,7 @@ private void testSampling(TelemetryClient client , List
> depende
if (excludeTypes != null) {
for (String excludeType : excludeTypes) {
- if (!StringUtils.isNullOrEmpty(excludeType)) {
+ if (!StringUtils.isEmpty(excludeType)) {
processor.addToExcludedType(excludeType);
}
}
@@ -559,7 +559,7 @@ private void testNoSampling(TelemetryClient client , List
> depen
processor.setSamplingPercentage(String.valueOf(samplingRate));
if (includeTypes != null) {
for (String includeType : includeTypes) {
- if (!StringUtils.isNullOrEmpty(includeType)) {
+ if (!StringUtils.isEmpty(includeType)) {
processor.addToIncludedType(includeType);
}
}
@@ -567,7 +567,7 @@ private void testNoSampling(TelemetryClient client , List
> depen
if (excludeTypes != null) {
for (String excludeType : excludeTypes) {
- if (!StringUtils.isNullOrEmpty(excludeType)) {
+ if (!StringUtils.isEmpty(excludeType)) {
processor.addToExcludedType(excludeType);
}
}
From fa63a1844ff4deee576a98bdd2109a90d02a384c Mon Sep 17 00:00:00 2001
From: littleaj <1690572+littleaj@users.noreply.github.com>
Date: Thu, 7 Dec 2017 11:44:46 -0800
Subject: [PATCH 3/3] reclassified dependency only used in tests
---
web/build.gradle | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/web/build.gradle b/web/build.gradle
index d113d68c398..bc7c8cba560 100644
--- a/web/build.gradle
+++ b/web/build.gradle
@@ -32,7 +32,6 @@ dependencies {
provided (project(':agent')) { transitive = false }
compile (project(':core')) { transitive = false }
compile ([group: 'org.apache.commons', name: 'commons-lang3', version: '3.7'])
- compile ([group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.3'])
provided 'com.opensymphony:xwork:2.0.4' // Struts 2
provided 'org.springframework:spring-webmvc:3.1.0.RELEASE'
provided group: 'javax.servlet', name: 'servlet-api', version: '2.5'
@@ -45,11 +44,11 @@ dependencies {
testCompile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.1'
testCompile group: 'org.json', name:'json', version:'20090211'
testCompile group: 'com.microsoft.azure', name: 'azure-storage', version: '2.1.0'
+ testCompile ([group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.3'])
}
shadowJar {
classifier=''
- relocate 'org.apache.http', 'com.microsoft.applicationinsights.web.dependencies.http'
relocate 'org.apache.commons', 'com.microsoft.applicationinsights.web.dependencies.apachecommons'
}