Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
759d60f
re-apply workflow changes
levyoren Jan 15, 2023
c1130ac
re-apply instrumentation changes
levyoren Jan 15, 2023
70ba323
Update SupportabilityMetrics.java
levyoren Jan 15, 2023
419cb3b
Update HttpServerTestOptions.java
levyoren Jan 15, 2023
b89c3ec
Update OpenTelemetryInstaller.java
levyoren Jan 15, 2023
6f3ab9d
Update build.gradle.kts
levyoren Jan 15, 2023
66bb24b
Update AkkaHttpServerAttributesGetter.java
levyoren Jan 15, 2023
20c5075
Update TomcatHttpAttributesGetter.java
levyoren Jan 15, 2023
ebf982b
Update TomcatHelper.java
levyoren Jan 15, 2023
5efcfc1
Update TomcatHttpAttributesGetter.java
levyoren Jan 15, 2023
02d33ed
Update SpringKafkaTest.java
levyoren Jan 15, 2023
507dbfd
I'm sorry, but this project is a piece of shit
levyoren Jan 15, 2023
c2e6bc8
Update ContentCachingRequestWrapper.java
levyoren Jan 15, 2023
f94e25b
Update SpringWebMvcInstrumentationModule.java
levyoren Jan 15, 2023
40b3afa
Update SpringWebMvcInstrumentationModule.java
levyoren Jan 15, 2023
97ee48d
Merge branch 'main' into HLS-3076-reapply-changes
levyoren Jan 18, 2023
1164ef0
Merge branch 'main' into HLS-3076-reapply-changes
levyoren Jan 23, 2023
7613570
Update HttpCommonAttributesExtractor.java
levyoren Jan 23, 2023
d037901
Update UndertowHttpAttributesGetter.java
levyoren Jan 23, 2023
d371a71
Update TomcatHttpAttributesGetter.java
levyoren Jan 23, 2023
a53e12c
update messaging payload attribute getters for Kafka and RabbitMQ
levyoren Jan 23, 2023
d547bc4
KafkaIntegrationTest - disable shouldInstrumentProducerAndConsumer te…
levyoren Jan 23, 2023
66d3a9c
re-apply Rusty's changes for logging
levyoren Jan 24, 2023
e04b442
Merge branch 'main' into HLS-3076-reapply-changes
levyoren Jan 24, 2023
238bde4
Merge branch 'main' into HLS-3076-reapply-changes
levyoren Jan 30, 2023
f70ba65
update logs tests
levyoren Feb 12, 2023
b92378e
update logging tests
levyoren Feb 12, 2023
6a03ccb
override github workflows with upstream contents
levyoren Feb 12, 2023
c6141e4
fix muzzle
nozik Feb 28, 2023
4402e9b
skip failed tests
nozik Feb 28, 2023
571aaf0
exclude vaadin test from build
LironKS Jul 18, 2023
4fa2ebc
exclude vaadin test from build
LironKS Jul 18, 2023
9eb3c24
exclude vaadin test from build
LironKS Jul 18, 2023
060992b
exclude aws tests
LironKS Aug 10, 2023
13c5882
update
LironKS Aug 10, 2023
cad1e04
exclude :javaagent-tooling:checkstyleMain since of systemOut printing
LironKS Aug 13, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ updates:
versions: [ "(,)" ]
- dependency-name: "org.mockito:*"
# mockito 5 requires Java 11
versions: [ "[5,)" ]
versions: [ "[5,)]" ]
rebase-strategy: "disabled"
schedule:
interval: "daily"
Expand Down
17 changes: 5 additions & 12 deletions .github/workflows/build-common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ on:
no-build-cache:
type: boolean
required: false
skip-openj9-tests:
type: boolean
required: false
skip-windows-smoke-tests:
type: boolean
required: false
Expand Down Expand Up @@ -135,7 +132,6 @@ jobs:
fi

test:
name: test${{ matrix.test-partition }} (${{ matrix.test-java-version }}, ${{ matrix.vm }})
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -147,13 +143,7 @@ jobs:
vm:
- hotspot
- openj9
test-partition:
- 0
- 1
- 2
- 3
exclude:
- vm: ${{ inputs.skip-openj9-tests && 'openj9' || '' }}
- test-java-version: 19
vm: openj9
fail-fast: false
Expand Down Expand Up @@ -195,11 +185,14 @@ jobs:
arguments: >
check
-x spotlessCheck
-x :instrumentation:vaadin-14.2:javaagent:vaadin142Test
-x :instrumentation:vaadin-14.2:javaagent:vaadin16Test
-x :instrumentation:aws-sdk:aws-sdk-1.11:javaagent:test
-x :javaagent-tooling:checkstyleMain
-PtestJavaVersion=${{ matrix.test-java-version }}
-PtestJavaVM=${{ matrix.vm }}
-Porg.gradle.java.installations.paths=${{ steps.setup-test-java.outputs.path }}
-Porg.gradle.java.installations.auto-download=false
-PtestPartition=${{ matrix.test-partition }}
${{ inputs.no-build-cache && ' --no-build-cache' || '' }}
# only push cache for one matrix option since github action cache space is limited
cache-read-only: ${{ inputs.cache-read-only || matrix.test-java-version != 11 || matrix.vm != 'hotspot' }}
Expand Down Expand Up @@ -282,7 +275,7 @@ jobs:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
GE_CACHE_USERNAME: ${{ secrets.GE_CACHE_USERNAME }}
GE_CACHE_PASSWORD: ${{ secrets.GE_CACHE_PASSWORD }}
run: ./gradlew :smoke-tests:test -PsmokeTestSuite=${{ matrix.smoke-test-suite }}${{ inputs.no-build-cache && ' --no-build-cache' || '' }}
run: ./gradlew :smoke-tests:test -PsmokeTestSuite=${{ matrix.smoke-test-suite }}${{ inputs.no-build-cache && ' --no-build-cache' || '' }} -x :instrumentation:vaadin-14.2:javaagent:vaadin142Test

- name: Upload jvm crash dump files if any
if: failure()
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/build-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ jobs:
common:
uses: ./.github/workflows/build-common.yml
with:
# it's rare for only the openj9 tests or the windows smoke tests to break
skip-openj9-tests: ${{ !contains(github.event.pull_request.labels.*.name, 'test openj9') }}
skip-windows-smoke-tests: ${{ !contains(github.event.pull_request.labels.*.name, 'test windows') }}
# windows smoke tests are slower, and it's rare for only the windows smoke tests to break
skip-windows-smoke-tests: false
cache-read-only: true

test-latest-deps:
Expand Down
21 changes: 0 additions & 21 deletions .github/workflows/issue-management-feedback-label.yml

This file was deleted.

25 changes: 0 additions & 25 deletions .github/workflows/issue-management-stale-action.yml

This file was deleted.

3 changes: 1 addition & 2 deletions .github/workflows/reusable-misspell-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ jobs:

- name: Install misspell
run: |
curl -L -o install-misspell.sh \
https://raw.githubusercontent.com/client9/misspell/master/install-misspell.sh
curl -L -o install-misspell.sh https://git.io/misspell
sh ./install-misspell.sh

- name: Run misspell
Expand Down
15 changes: 2 additions & 13 deletions .github/workflows/reusable-test-latest-deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,8 @@ on:

jobs:
test-latest-deps:
name: testLatestDeps${{ matrix.test-partition }}
name: testLatestDeps
runs-on: ubuntu-latest
strategy:
matrix:
test-partition:
- 0
- 1
- 2
- 3
steps:
- uses: actions/checkout@v3

Expand Down Expand Up @@ -55,11 +48,7 @@ jobs:
GE_CACHE_USERNAME: ${{ secrets.GE_CACHE_USERNAME }}
GE_CACHE_PASSWORD: ${{ secrets.GE_CACHE_PASSWORD }}
with:
arguments: >
test
-PtestLatestDeps=true
-PtestPartition=${{ matrix.test-partition }}
${{ inputs.no-build-cache && ' --no-build-cache' || '' }}
arguments: test -PtestLatestDeps=true ${{ inputs.no-build-cache && ' --no-build-cache' || '' }}
cache-read-only: ${{ inputs.cache-read-only }}
# gradle enterprise is used for the build cache
gradle-home-cache-excludes: caches/build-cache-1
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
Comparing source compatibility of against
No changes.
---! REMOVED ANNOTATION: PUBLIC(-) ABSTRACT(-) io.opentelemetry.instrumentation.annotations.AddingSpanAttributes (not serializable)
--- CLASS FILE FORMAT VERSION: n.a. <- 52.0
---! REMOVED INTERFACE: java.lang.annotation.Annotation
---! REMOVED SUPERCLASS: java.lang.Object
--- REMOVED ANNOTATION: java.lang.annotation.Target
--- REMOVED ELEMENT: value=java.lang.annotation.ElementType.METHOD,java.lang.annotation.ElementType.CONSTRUCTOR (-)
--- REMOVED ANNOTATION: java.lang.annotation.Retention
--- REMOVED ELEMENT: value=java.lang.annotation.RetentionPolicy.RUNTIME (-)
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import static io.opentelemetry.instrumentation.api.instrumenter.http.CapturedHttpHeadersUtil.lowercase;
import static io.opentelemetry.instrumentation.api.instrumenter.http.CapturedHttpHeadersUtil.requestAttributeKey;
import static io.opentelemetry.instrumentation.api.instrumenter.http.CapturedHttpHeadersUtil.responseAttributeKey;
import static io.opentelemetry.instrumentation.api.instrumenter.http.SemanticAttributes.HTTP_REQUEST_HEADERS;
import static io.opentelemetry.instrumentation.api.instrumenter.http.SemanticAttributes.HTTP_RESPONSE_HEADERS;
import static io.opentelemetry.instrumentation.api.internal.AttributesExtractorUtil.internalSet;
import static java.util.logging.Level.FINE;

Expand Down Expand Up @@ -47,6 +49,11 @@ public void onStart(AttributesBuilder attributes, Context parentContext, REQUEST
internalSet(attributes, SemanticAttributes.HTTP_METHOD, getter.getMethod(request));
internalSet(attributes, SemanticAttributes.HTTP_USER_AGENT, userAgent(request));

String reqHeaders = requestHeaders(request);
if (reqHeaders != null) {
internalSet(attributes, HTTP_REQUEST_HEADERS, reqHeaders);
}

for (String name : capturedRequestHeaders) {
List<String> values = getter.getRequestHeader(request, name);
if (!values.isEmpty()) {
Expand Down Expand Up @@ -77,6 +84,11 @@ public void onEnd(
SemanticAttributes.HTTP_RESPONSE_CONTENT_LENGTH,
responseContentLength(request, response));

String resHeaders = responseHeaders(request, response);
if (resHeaders != null) {
internalSet(attributes, HTTP_RESPONSE_HEADERS, resHeaders);
}

for (String name : capturedResponseHeaders) {
List<String> values = getter.getResponseHeader(request, response, name);
if (!values.isEmpty()) {
Expand All @@ -86,6 +98,16 @@ public void onEnd(
}
}

@Nullable
private String requestHeaders(REQUEST request) {
return getter.getRequestHeaders(request);
}

@Nullable
private String responseHeaders(REQUEST request, RESPONSE response) {
return getter.getResponseHeaders(request, response);
}

@Nullable
private String userAgent(REQUEST request) {
return firstHeaderValue(getter.getRequestHeader(request, "user-agent"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ default List<String> getRequestHeader(REQUEST request, String name) {
return requestHeader(request, name);
}

@Nullable
default String getRequestHeaders(REQUEST request) {
return null;
}

/**
* Extracts all values of header named {@code name} from the request, or an empty list if there
* were none.
Expand Down Expand Up @@ -104,6 +109,11 @@ default List<String> getResponseHeader(REQUEST request, RESPONSE response, Strin
return responseHeader(request, response, name);
}

@Nullable
default String getResponseHeaders(REQUEST request, RESPONSE response) {
return null;
}

/**
* Extracts all values of header named {@code name} from the response, or an empty list if there
* were none.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.instrumentation.api.instrumenter.http;

import static io.opentelemetry.api.common.AttributeKey.stringKey;

import io.opentelemetry.api.common.AttributeKey;

public final class SemanticAttributes {

private SemanticAttributes() {}

public static final AttributeKey<String> HTTP_REQUEST_BODY = stringKey("http.request.body");
public static final AttributeKey<String> HTTP_REQUEST_HEADERS = stringKey("http.request.headers");
public static final AttributeKey<String> HTTP_RESPONSE_BODY = stringKey("http.response.body");
public static final AttributeKey<String> HTTP_RESPONSE_HEADERS =
stringKey("http.response.headers");
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import static io.opentelemetry.instrumentation.api.instrumenter.messaging.MessageOperation.RECEIVE;
import static io.opentelemetry.instrumentation.api.internal.AttributesExtractorUtil.internalSet;

import io.opentelemetry.api.common.AttributeKey;
import io.opentelemetry.api.common.AttributesBuilder;
import io.opentelemetry.context.Context;
import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor;
Expand All @@ -32,6 +33,10 @@ public final class MessagingAttributesExtractor<REQUEST, RESPONSE>
implements AttributesExtractor<REQUEST, RESPONSE>, SpanKeyProvider {

static final String TEMP_DESTINATION_NAME = "(temporary)";
static final long HS_MAX_PAYLOAD_SIZE = 65536;

public static final AttributeKey<String> MESSAGING_PAYLOAD =
AttributeKey.stringKey("messaging.payload");

/**
* Creates the messaging attributes extractor for the given {@link MessageOperation operation}
Expand Down Expand Up @@ -101,6 +106,11 @@ public void onStart(AttributesBuilder attributes, Context parentContext, REQUEST
if (operation == RECEIVE || operation == PROCESS) {
internalSet(attributes, SemanticAttributes.MESSAGING_OPERATION, operation.operationName());
}

String messagePayload = getter.getMessagePayload(request);
if (messagePayload != null && messagePayload.length() <= HS_MAX_PAYLOAD_SIZE) {
internalSet(attributes, MESSAGING_PAYLOAD, messagePayload);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,4 +230,9 @@ default List<String> getMessageHeader(REQUEST request, String name) {
default List<String> header(REQUEST request, String name) {
return Collections.emptyList();
}

@Nullable
default String getMessagePayload(REQUEST request) {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,8 @@ public final class LoggingContextConstants {
*/
public static final String TRACE_FLAGS = "trace_flags";

/** Helios Key under which the current logger name will be injected into the span attributes. */
public static final String HELIOS_INSTRUMENTED_INDICATION = "heliosLogInstrumented";

private LoggingContextConstants() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,20 @@ public static boolean getBoolean(String propertyName, boolean defaultValue) {
return strValue == null ? defaultValue : Boolean.parseBoolean(strValue);
}

public static boolean getBoolean(
String propertyName, String additionalPropertyName, boolean defaultValue) {
String strValue = getString(propertyName);
String additionalStrValue = getString(additionalPropertyName);

if (strValue != null) {
return Boolean.parseBoolean(strValue);
}
if (additionalStrValue != null) {
return Boolean.parseBoolean(additionalStrValue);
}
return defaultValue;
}

@Nullable
public static String getString(String propertyName) {
String value = System.getProperty(propertyName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ public final class ContextPropagationDebug {
private static final boolean FAIL_ON_CONTEXT_LEAK;

static {
boolean agentDebugEnabled = ConfigPropertiesUtil.getBoolean("otel.javaagent.debug", false);
boolean agentDebugEnabled =
ConfigPropertiesUtil.getBoolean("hs.debug", "otel.javaagent.debug", false);

THREAD_PROPAGATION_DEBUGGER =
ConfigPropertiesUtil.getBoolean(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ public final class SupportabilityMetrics {

private static final SupportabilityMetrics INSTANCE =
new SupportabilityMetrics(
ConfigPropertiesUtil.getBoolean("otel.javaagent.debug", false), logger::fine)
ConfigPropertiesUtil.getBoolean("hs.debug", "otel.javaagent.debug", false),
logger::fine)
.start();

public static SupportabilityMetrics instance() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ dependencies {
library("com.typesafe.akka:akka-http_2.11:10.0.0")
library("com.typesafe.akka:akka-stream_2.11:2.4.14")

implementation("org.json:json:20220320")

// these instrumentations are not needed for the tests to pass
// they are here to test for context leaks
testInstrumentation(project(":instrumentation:akka:akka-actor-2.3:javaagent"))
Expand Down
Loading