Skip to content

Commit

Permalink
Merge with master
Browse files Browse the repository at this point in the history
  • Loading branch information
Mariovido committed Jan 15, 2025
2 parents cc3f5ef + 8b63e5a commit ec09325
Show file tree
Hide file tree
Showing 244 changed files with 3,300 additions and 1,323 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.continue.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ instrumentation_modules: &instrumentation_modules "dd-java-agent/instrumentation
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"
profiling_modules: &profiling_modules "dd-java-agent/agent-profiling"

default_system_tests_commit: &default_system_tests_commit c6e54d143cfdf97b2f0a815f22f53247c119f635
default_system_tests_commit: &default_system_tests_commit 2d531d6f809cfcdd5d6d375f92bda86202dea332

parameters:
nightly:
Expand Down
60 changes: 60 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: "Bug Report (Low Priority)"
description: "Create a public Bug Report. Note that these may not be addressed as it depeonds on capacity and that looking up account information will be difficult."
labels: "type: bug"
body:
- type: input
attributes:
label: Tracer Version(s)
description: "Version(s) of the tracer affected by this bug"
placeholder: "1.44.0"
validations:
required: true

- type: input
attributes:
label: Java Version(s)
description: "Version(s) of Java (`java --version`) that you've encountered this bug with"
placeholder: 21.0.4
validations:
required: true

- type: dropdown
attributes:
label: JVM Vendor
description: "Which JVM vendor does your application use"
options:
- Oracle JDK
- Alibaba Dragonwell
- Amazon Corretto
- Azul Zing / Zulu
- BellSoft Liberica JDK
- Eclipse Adoptium / Temurin
- Eclipse OpenJ9
- IBM SDK / Semeru
- Oracle GraalVM
- RedHat JDK
- SapMachine
- Other (please specify in comments)
validations:
required: true

- type: textarea
attributes:
label: Bug Report
description: Please add a clear and concise description of the bug here
validations:
required: true

- type: textarea
attributes:
label: Expected Behavior
description: What is the expected behavior
validations:
required: true

- type: textarea
attributes:
label: Reproduction Code
description: Please add code here to help us reproduce the problem
validations:
required: false
10 changes: 5 additions & 5 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
blank_issues_enabled: true
blank_issues_enabled: false
contact_links:
- name: Bug Report
- name: Bug Report (High Priority)
url: https://help.datadoghq.com/hc/en-us/requests/new?tf_1260824651490=pt_product_type:apm&tf_1900004146284=pt_apm_language:java
about: This option creates an expedited Bug Report via the helpdesk (no login required). This will allow us to look up your account and allows you to provide additional information in private.
- name: Feature Request
about: Create an expedited Bug Report via the helpdesk (no login required). This will allow us to look up your account and allows you to provide additional information in private.
- name: Feature Request (High Priority)
url: https://help.datadoghq.com/hc/en-us/requests/new?tf_1260824651490=pt_product_type:apm&tf_1900004146284=pt_apm_language:java&tf_1260825272270=pt_apm_category_feature_request
about: This option creates an expedited Feature Request via the helpdesk (no login required). This helps with prioritization and allows you to provide additional information in private.
about: Create an expedited Feature Request via the helpdesk (no login required). This helps with prioritization and allows you to provide additional information in private.
49 changes: 49 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Feature Request (Low Priority)
description: Create a public Feature Request. Note that these may not be addressed as it depeonds on capacity and that looking up account information will be difficult.
labels: "type: feature request"
body:
- type: input
attributes:
label: Library Name
description: "If your feature request is to add instrumentation support for a library please provide the name here"
placeholder: "spring-boot"
validations:
required: false

- type: input
attributes:
label: Library Version(s)
description: "If your feature request is to add instrumentation support for a library please provide the version you use"
placeholder: "1.2"
validations:
required: false

- type: textarea
attributes:
label: Describe the feature you'd like
description: A clear and concise description of what you want to happen.
validations:
required: true

- type: textarea
attributes:
label: Is your feature request related to a problem?
description: |
Please add a clear and concise description of your problem.
E.g. I'm unable to instrument my database queries...
validations:
required: false

- type: textarea
attributes:
label: Describe alternatives you've considered
description: A clear and concise description of any alternative solutions or features you've considered
validations:
required: false

- type: textarea
attributes:
label: Additional context
description: Add any other context or screenshots about the feature request here
validations:
required: false
1 change: 1 addition & 0 deletions .github/workflows/check-pull-requests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
- release/v*
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check_pull_requests:
name: Check pull requests
Expand Down
6 changes: 6 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,12 @@ onboarding_tests_k8s_injection:
parallel:
matrix:
- WEBLOG_VARIANT: [dd-lib-java-init-test-app]
SCENARIO: [K8S_LIB_INJECTION, K8S_LIB_INJECTION_UDS, K8S_LIB_INJECTION_NO_AC, K8S_LIB_INJECTION_NO_AC_UDS, K8S_LIB_INJECTION_PROFILING_DISABLED, K8S_LIB_INJECTION_PROFILING_ENABLED, K8S_LIB_INJECTION_PROFILING_OVERRIDE]
K8S_CLUSTER_VERSION: ['7.56.2', '7.57.0', '7.59.0']

- WEBLOG_VARIANT: [dd-djm-spark-test-app]
SCENARIO: [K8S_LIB_INJECTION_SPARK_DJM]
K8S_CLUSTER_VERSION: ['7.57.0', '7.59.0']

create_key:
stage: generate-signing-key
Expand Down
12 changes: 9 additions & 3 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Security
# Security Policy

## Security Vulnerabilities
This document outlines the security policy for the Datadog Java client library (aka Java tracer) and what to do if you discover a security vulnerability in the project.
Most notably, please do not share the details in a public forum (such as in a discussion, issue, or pull request) but instead reach out to us with the details.
This gives us an opportunity to release a fix for others to benefit from by the time details are made public.

If you have found a security issue, please contact the security team directly at security@datadoghq.com.
## Reporting a Vulnerability

If you discover a vulnerability in the Datadog Java client library (or any Datadog product for that matter) please submit details to the following email address:

* [security@datadoghq.com](mailto:security@datadoghq.com)
2 changes: 0 additions & 2 deletions components/context/src/main/java/datadog/context/Context.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import static datadog.context.ContextProviders.manager;

import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;

/**
* Immutable context scoped to an execution unit or carrier object.
Expand Down Expand Up @@ -36,7 +35,6 @@
*
* @see ContextKey
*/
@ParametersAreNonnullByDefault
public interface Context {
/**
* Returns the root context.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package datadog.context;

import javax.annotation.ParametersAreNonnullByDefault;

/** Binds context to carrier objects. */
@ParametersAreNonnullByDefault
public interface ContextBinder {
/**
* Returns the context attached to the given carrier object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
public final class ContextKey<T> {
private static final AtomicInteger NEXT_INDEX = new AtomicInteger(0);
/** The key name, for debugging purpose only . */
/** The key name, for debugging purpose only. */
private final String name;
/** The key unique context, related to {@link IndexedContext} implementation. */
final int index;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ParametersAreNonnullByDefault
package datadog.context;

import javax.annotation.ParametersAreNonnullByDefault;
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package datadog.context.propagation;

import javax.annotation.Nullable;

@FunctionalInterface
public interface CarrierSetter<C> {
/**
* Sets a carrier key/value pair.
*
* @param carrier the carrier to store key/value into.
* @param key the key to set.
* @param value the value to set.
*/
void set(@Nullable C carrier, String key, String value);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package datadog.context.propagation;

import java.util.function.BiConsumer;

/**
* This interface represents the capacity of walking through a carrier content, iterating over its
* key/value pairs.
*
* <p>Walking through carrier is preferred to direct access to carrier key/value pairs as some
* carrier implementations do not have built-in direct access and require walking over the full
* carrier structure to find the requested key/value pair, leading to multiple walks when multiple
* keys are requested, whereas the visitor is expected to walk through only once, and the
* propagators to keep the data they need using the visitor callback.
*
* @param <C> the type of carrier.
*/
@FunctionalInterface
public interface CarrierVisitor<C> {
/**
* Iterates over the carrier content and calls the visitor callback for every key/value found.
*
* @param carrier the carrier to iterate over.
* @param visitor the callback to call for each carrier key/value pair found.
*/
void forEachKeyValue(C carrier, BiConsumer<String, String> visitor);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package datadog.context.propagation;

import datadog.context.Context;
import java.util.ArrayList;
import java.util.List;
import java.util.function.BiConsumer;

class CompositePropagator implements Propagator {
private final Propagator[] propagators;

CompositePropagator(Propagator[] propagators) {
this.propagators = propagators;
}

@Override
public <C> void inject(Context context, C carrier, CarrierSetter<C> setter) {
for (Propagator propagator : this.propagators) {
propagator.inject(context, carrier, setter);
}
}

@Override
public <C> Context extract(Context context, C carrier, CarrierVisitor<C> visitor) {
// Extract and cache carrier key/value pairs
CarrierCache carrierCache = new CarrierCache();
visitor.forEachKeyValue(carrier, carrierCache);
// Run the multiple extractions on cache
for (Propagator propagator : this.propagators) {
context = propagator.extract(context, carrierCache, carrierCache);
}
return context;
}

static class CarrierCache implements BiConsumer<String, String>, CarrierVisitor<CarrierCache> {
/** Cached key/values from carrier (even indexes are keys, odd indexes are values). */
private final List<String> keysAndValues;

public CarrierCache() {
this.keysAndValues = new ArrayList<>(32);
}

@Override
public void accept(String key, String value) {
this.keysAndValues.add(key);
this.keysAndValues.add(value);
}

@Override
public void forEachKeyValue(CarrierCache carrier, BiConsumer<String, String> visitor) {
for (int i = 0; i < carrier.keysAndValues.size() - 1; i += 2) {
visitor.accept(carrier.keysAndValues.get(i), carrier.keysAndValues.get(i + 1));
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package datadog.context.propagation;

import static java.util.Objects.requireNonNull;

import datadog.context.Context;

/** This class defines a cross-cutting concern to be propagated from a {@link Context}. */
public class Concern {
/** The concern default priority. */
public static final int DEFAULT_PRIORITY = 100;
/** The concern name, for debugging purpose only. */
private final String name;
/** The concern priority, lower value means higher priority. */
private final int priority;

/**
* Creates a concern.
*
* @param name the concern name, for debugging purpose only.
* @return The created concern.
*/
public static Concern named(String name) {
return new Concern(name, DEFAULT_PRIORITY);
}

/**
* Creates a concern with a specific priority.
*
* @param name the concern name, for debugging purpose only.
* @param priority the concern priority (lower value means higher priority, while the default is
* {@link #DEFAULT_PRIORITY}),
* @return The created concern.
*/
public static Concern withPriority(String name, int priority) {
return new Concern(name, priority);
}

private Concern(String name, int priority) {
requireNonNull(name, "Concern name cannot be null");
if (priority < 0) {
throw new IllegalArgumentException("Concern priority cannot be negative");
}
this.name = name;
this.priority = priority;
}

int priority() {
return this.priority;
}

// We want identity equality, so no need to override equals().

@Override
public String toString() {
return this.name;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package datadog.context.propagation;

import datadog.context.Context;

final class NoopPropagator implements Propagator {
static final NoopPropagator INSTANCE = new NoopPropagator();

private NoopPropagator() {}

@Override
public <C> void inject(Context context, C carrier, CarrierSetter<C> setter) {
// noop
}

@Override
public <C> Context extract(Context context, C carrier, CarrierVisitor<C> visitor) {
return context;
}
}
Loading

0 comments on commit ec09325

Please sign in to comment.