Skip to content

Commit

Permalink
Move profiling-uploader to communications module
Browse files Browse the repository at this point in the history
  • Loading branch information
jbachorik committed Nov 2, 2023
1 parent efb1d29 commit 6dc54b0
Show file tree
Hide file tree
Showing 17 changed files with 38 additions and 62 deletions.
13 changes: 13 additions & 0 deletions communication/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,16 @@ dependencies {
api deps.okhttp
api group: 'com.squareup.moshi', name: 'moshi', version: versions.moshi
implementation group: 'com.datadoghq', name: 'java-dogstatsd-client', version: "${versions.dogstatsd}"
implementation group: 'org.lz4', name: 'lz4-java', version: '1.7.1'

testImplementation project(':utils:test-utils')
testImplementation project(':dd-java-agent:agent-profiling:profiling-testing')
testImplementation deps.junit5
testImplementation deps.truth
testImplementation deps.bytebuddy
testImplementation deps.mockito
testImplementation group: 'com.squareup.okhttp3', name: 'mockwebserver', version: versions.okhttp_legacy
testImplementation(group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.9.10')
testImplementation group: 'org.msgpack', name: 'msgpack-core', version: '0.8.20'
testImplementation group: 'org.msgpack', name: 'jackson-dataformat-msgpack', version: '0.8.20'
}
Expand All @@ -38,6 +43,14 @@ ext {
'datadog.communication.monitor.DDAgentStatsDConnection',
'datadog.communication.monitor.DDAgentStatsDConnection.*',
'datadog.communication.monitor.LoggingStatsDClient',
// The byte counting input/output stream are delegating most of their methods so it does not make sense to force the coverage there
'datadog.communication.profiling.ByteCountingInputStream',
'datadog.communication.profiling.ByteCountingOutputStream',
// A call-back inner class holds few enough instructions to make not testing with different log levels to breach the jacoco limits
'datadog.communication.profiling.ProfileUploader.1',
// When running on Java 8 without `jfr`, no code is executed
'datadog.communication.profiling.util.JfrCliHelper',
'datadog.communication.profiling.util.JfrCliHelper.Event'
]
excludedClassesBranchCoverage = ['datadog.communication.ddagent.TracerVersion',]
excludedClassesInstructionCoverage = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.datadog.profiling.uploader;
package datadog.communication.profiler;

import java.io.IOException;
import java.io.InputStream;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.datadog.profiling.uploader;
package datadog.communication.profiler;

import java.io.IOException;
import java.io.OutputStream;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.datadog.profiling.uploader;
package datadog.communication.profiler;

import datadog.trace.api.Platform;
import datadog.trace.api.profiling.RecordingInputStream;
import java.io.BufferedOutputStream;
import java.io.IOException;
Expand Down Expand Up @@ -321,8 +322,6 @@ private static void checkMarkSupported(@Nonnull final InputStream is) throws IOE

private static OutputStreamMappingFunction getOutputStreamMapper(
@Nonnull CompressionType compressionType) {
// currently only gzip and off are supported
// this needs to be updated once more compression types are added
switch (compressionType) {
case GZIP:
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.datadog.profiling.uploader;
package datadog.communication.profiler;

import java.util.Locale;
import org.slf4j.Logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.datadog.profiling.uploader;
package datadog.communication.profiler;

import static datadog.trace.util.AgentThreadFactory.AgentThread.PROFILER_HTTP_DISPATCHER;

import com.datadog.profiling.uploader.util.JfrCliHelper;
import com.squareup.moshi.JsonAdapter;
import com.squareup.moshi.JsonReader;
import com.squareup.moshi.JsonWriter;
import datadog.common.version.VersionInfo;
import datadog.communication.http.OkHttpUtils;
import datadog.communication.profiler.util.JfrCliHelper;
import datadog.trace.api.Config;
import datadog.trace.api.DDTags;
import datadog.trace.api.git.GitInfo;
Expand Down Expand Up @@ -353,7 +353,7 @@ private void handleResponse(
}

@SuppressFBWarnings("DCN_NULLPOINTER_EXCEPTION")
private IOLogger.Response getLoggerResponse(final okhttp3.Response response) {
private IOLogger.Response getLoggerResponse(final Response response) {
if (response != null) {
try {
final ResponseBody body = response.body();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.datadog.profiling.uploader.util;
package datadog.communication.profiler.util;

import static datadog.trace.util.AgentThreadFactory.AgentThread.PROFILER_HTTP_DISPATCHER;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
package com.datadog.profiling.uploader;

import static org.junit.jupiter.api.Assertions.*;
package datadog.communication.profiler;

import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.datadog.profiling.uploader;
package datadog.communication.profiler;

import static org.junit.jupiter.api.Assertions.assertEquals;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.datadog.profiling.uploader;
package datadog.communication.profiler;

import static com.datadog.profiling.uploader.ProfileUploader.V4_PROFILE_END_PARAM;
import static com.datadog.profiling.uploader.ProfileUploader.V4_PROFILE_START_PARAM;
import static datadog.communication.profiler.ProfileUploader.V4_PROFILE_END_PARAM;
import static datadog.communication.profiler.ProfileUploader.V4_PROFILE_START_PARAM;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.datadog.profiling.uploader.util;
package datadog.communication.profiler.util;

import static org.mockito.ArgumentMatchers.argThat;
import static org.mockito.ArgumentMatchers.eq;
Expand Down
3 changes: 2 additions & 1 deletion dd-java-agent/agent-profiling/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ apply from: "$rootDir/gradle/java.gradle"

dependencies {
api deps.slf4j
api project(':communication')
api project(':internal-api')

implementation project(path: ':dd-java-agent:agent-profiling:profiling-ddprof', configuration: 'shadow')
api project(':dd-java-agent:agent-profiling:profiling-auxiliary')
api project(':dd-java-agent:agent-profiling:profiling-auxiliary-ddprof')
api project(':dd-java-agent:agent-profiling:profiling-uploader')
api project(':dd-java-agent:agent-profiling:profiling-controller')
api project(':dd-java-agent:agent-profiling:profiling-controller-ddprof')
api project(':dd-java-agent:agent-profiling:profiling-controller-openjdk')
Expand All @@ -33,6 +33,7 @@ configurations {

shadowJar {
dependencies deps.excludeShared
relocate 'okhttp3', 'datadog.okhttp3'
}

jar {
Expand Down
41 changes: 0 additions & 41 deletions dd-java-agent/agent-profiling/profiling-uploader/build.gradle

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import com.datadog.profiling.controller.ControllerFactory;
import com.datadog.profiling.controller.ProfilingSystem;
import com.datadog.profiling.controller.UnsupportedEnvironmentException;
import com.datadog.profiling.uploader.ProfileUploader;
import datadog.communication.profiler.ProfileUploader;
import datadog.trace.api.Config;
import datadog.trace.api.Platform;
import datadog.trace.api.config.ProfilingConfig;
Expand Down
1 change: 0 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ include ':dd-java-agent:agent-profiling:profiling-controller-ddprof'
include ':dd-java-agent:agent-profiling:profiling-controller-openjdk'
include ':dd-java-agent:agent-profiling:profiling-controller-oracle'
include ':dd-java-agent:agent-profiling:profiling-testing'
include ':dd-java-agent:agent-profiling:profiling-uploader'
include ':dd-java-agent:agent-profiling:profiling-utils'

include ':dd-java-agent:agent-debugger:debugger-bootstrap'
Expand Down

0 comments on commit 6dc54b0

Please sign in to comment.