Skip to content

Commit 44188ec

Browse files
authored
Merge branch 'master' into mhlidd/migrate_http_server_instrumentations
2 parents 187f65c + 7c80dbe commit 44188ec

File tree

128 files changed

+3659
-689
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+3659
-689
lines changed

.circleci/config.continue.yml.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ instrumentation_modules: &instrumentation_modules "dd-java-agent/instrumentation
3636
debugger_modules: &debugger_modules "dd-java-agent/agent-debugger|dd-java-agent/agent-bootstrap|dd-java-agent/agent-builder|internal-api|communication|dd-trace-core"
3737
profiling_modules: &profiling_modules "dd-java-agent/agent-profiling"
3838

39-
default_system_tests_commit: &default_system_tests_commit b0b2e1f212f8c483b52aa3adc6ffd4132b1ba9b8
39+
default_system_tests_commit: &default_system_tests_commit 9049791de92dcb72b104e99a80f6f9914c1b96fb
4040

4141
parameters:
4242
nightly:

.github/workflows/check-ci-pipelines.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@ permissions:
1717

1818
jobs:
1919
check-ci-pipelines:
20-
name: Check CI Pipelines
20+
# Do not change this name, it must be equal to job id
21+
# https://github.com/DataDog/ensure-ci-success/blob/main/docs/limitations.md#do-not-set-a-name-to-the-job-shipping-ensure-ci-success
22+
name: check-ci-pipelines
2123
runs-on: ubuntu-latest
2224
steps:
2325
- name: Run Ensure CI Success
24-
uses: DataDog/ensure-ci-success@f40e6ffd8e60280d478b9b92209aaa30d3d56895
26+
uses: DataDog/ensure-ci-success@727e7fe39ae2e1ce7ea336ec85a7369ab0731754
2527
with:
2628
initial-delay-seconds: "1000"
2729
max-retries: "60"

.github/workflows/update-docker-build-image.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
sed -i 's|DOCKER_IMAGE_VERSION=.*|DOCKER_IMAGE_VERSION="${{ steps.define-tag.outputs.tag }}"|' .circleci/render_config.py
5656
- name: Update the Docker build image in GitLab CI config
5757
run: |
58-
sed -i 's|image: ghcr.io/datadog/dd-trace-java-docker-build:.*|image: ghcr.io/datadog/dd-trace-java-docker-build:${{ steps.define-tag.outputs.tag }}-base|' .gitlab-ci.yml
58+
sed -i 's|JAVA_BUILD_IMAGE_VERSION:.*|JAVA_BUILD_IMAGE_VERSION:"${{ steps.define-tag.outputs.tag }}"|' .gitlab-ci.yml
5959
- name: Commit and push changes
6060
env:
6161
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

components/json/src/main/java/datadog/json/JsonMapper.java

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
package datadog.json;
22

3+
import static java.util.Collections.emptyList;
4+
import static java.util.Collections.emptyMap;
5+
6+
import java.io.IOException;
7+
import java.util.ArrayList;
38
import java.util.Collection;
9+
import java.util.List;
410
import java.util.Map;
511

612
/** Utility class for simple Java structure mapping into JSON strings. */
@@ -103,4 +109,47 @@ public static String toJson(String[] items) {
103109
return writer.toString();
104110
}
105111
}
112+
113+
/**
114+
* Parses a JSON string into a {@link Map}.
115+
*
116+
* @param json The JSON string to parse.
117+
* @return A {@link Map} containing the parsed JSON object's key-value pairs.
118+
* @throws IOException If the JSON is invalid or a reader error occurs.
119+
*/
120+
@SuppressWarnings("unchecked")
121+
public static Map<String, Object> fromJsonToMap(String json) throws IOException {
122+
if (json == null || json.isEmpty() || "{}".equals(json) || "null".equals(json)) {
123+
return emptyMap();
124+
}
125+
try (JsonReader reader = new JsonReader(json)) {
126+
Object value = reader.nextValue();
127+
if (!(value instanceof Map)) {
128+
throw new IOException("Expected JSON object but was " + value.getClass().getSimpleName());
129+
}
130+
return (Map<String, Object>) value;
131+
}
132+
}
133+
134+
/**
135+
* Parses a JSON string array into a {@link List<String>}.
136+
*
137+
* @param json The JSON string array to parse.
138+
* @return A {@link List<String>} containing the parsed JSON strings.
139+
* @throws IOException If the JSON is invalid or a reader error occurs.
140+
*/
141+
public static List<String> fromJsonToList(String json) throws IOException {
142+
if (json == null || json.isEmpty() || "[]".equals(json) || "null".equals(json)) {
143+
return emptyList();
144+
}
145+
try (JsonReader reader = new JsonReader(json)) {
146+
List<String> list = new ArrayList<>();
147+
reader.beginArray();
148+
while (reader.hasNext()) {
149+
list.add(reader.nextString());
150+
}
151+
reader.endArray();
152+
return list;
153+
}
154+
}
106155
}

0 commit comments

Comments
 (0)