Skip to content

Commit

Permalink
merge conflicts resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
videnkz committed Nov 5, 2023
2 parents 5f27998 + 337f174 commit 2bc6c8d
Show file tree
Hide file tree
Showing 16 changed files with 252 additions and 64 deletions.
54 changes: 54 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,57 @@ updates:
- dependency-name: "com.amazonaws:aws-java-sdk-s3"
- dependency-name: "com.amazonaws:aws-java-sdk-dynamodb"
- dependency-name: "software.amazon.awssdk:*"

# GitHub actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
day: "sunday"
time: "22:00"
reviewers:
- "elastic/observablt-ci"
groups:
github-actions:
patterns:
- "*"

# GitHub composite actions
- package-ecosystem: "github-actions"
directory: "/.github/workflows/maven-goal"
schedule:
interval: "weekly"
day: "sunday"
time: "22:00"
reviewers:
- "elastic/observablt-ci"
groups:
github-actions:
patterns:
- "*"

- package-ecosystem: "github-actions"
directory: "/.github/workflows/stash"
schedule:
interval: "weekly"
day: "sunday"
time: "22:00"
reviewers:
- "elastic/observablt-ci"
groups:
github-actions:
patterns:
- "*"

- package-ecosystem: "github-actions"
directory: "/.github/workflows/unstash"
schedule:
interval: "weekly"
day: "sunday"
time: "22:00"
reviewers:
- "elastic/observablt-ci"
groups:
github-actions:
patterns:
- "*"
20 changes: 10 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ./.github/workflows/maven-goal
with:
command: ./mvnw install -DskipTests=true -Dmaven.javadoc.skip=true
Expand Down Expand Up @@ -129,7 +129,7 @@ jobs:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ./.github/workflows/unstash
with:
name: build
Expand All @@ -150,7 +150,7 @@ jobs:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ./.github/workflows/unstash
with:
name: build
Expand All @@ -176,15 +176,15 @@ jobs:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ./.github/workflows/unstash
with:
name: build
path: ${{ github.workspace }}
# As long as there are some space issues with the CI runners.
- name: Free Disk Space
continue-on-error: true
uses: jlumbroso/free-disk-space@f68fdb76e2ea636224182cfb7377ff9a1708f9b8
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be
with:
android: true
dotnet: true
Expand Down Expand Up @@ -215,15 +215,15 @@ jobs:
runs-on: ubuntu-20.04
needs: build
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ./.github/workflows/unstash
with:
name: build
path: ${{ github.workspace }}
# As long as there are some space issues with the CI runners.
- name: Free Disk Space
continue-on-error: true
uses: jlumbroso/free-disk-space@f68fdb76e2ea636224182cfb7377ff9a1708f9b8
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be
with:
android: true
dotnet: true
Expand All @@ -249,7 +249,7 @@ jobs:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ./.github/workflows/unstash
with:
name: build
Expand All @@ -270,7 +270,7 @@ jobs:
steps:
- name: Support longpaths
run: git config --system core.longpaths true
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ./.github/workflows/maven-goal
with:
command: ./mvnw install -DskipTests=true -Dmaven.javadoc.skip=true
Expand Down Expand Up @@ -304,7 +304,7 @@ jobs:
- version: 21
distribution: 'temurin'
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ./.github/workflows/maven-goal
with:
test-java-version: ${{ matrix.version }}
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
username: ${{ env.GIT_USER }}
email: ${{ env.GIT_EMAIL }}
token: ${{ env.GITHUB_TOKEN }}
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
token: ${{ env.GITHUB_TOKEN }}
Expand Down Expand Up @@ -114,7 +114,7 @@ jobs:
name: "Wait for artifacts to be available on maven central"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Await artifacts published in maven central
shell: bash
timeout-minutes: 120
Expand Down Expand Up @@ -143,7 +143,7 @@ jobs:
username: ${{ env.GIT_USER }}
email: ${{ env.GIT_EMAIL }}
token: ${{ env.GITHUB_TOKEN }}
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ env.TAG_NAME }}
token: ${{ env.GITHUB_TOKEN }}
Expand All @@ -168,7 +168,7 @@ jobs:
username: ${{ env.GIT_USER }}
email: ${{ env.GIT_EMAIL }}
token: ${{ env.GITHUB_TOKEN }}
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
token: ${{ env.GITHUB_TOKEN }}
Expand All @@ -186,7 +186,7 @@ jobs:
env:
SONATYPE_FALLBACK: 1
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ env.TAG_NAME }}
fetch-depth: 0 # Load entire history as it is required for the push-script
Expand Down Expand Up @@ -215,7 +215,7 @@ jobs:
# The default region does not matter, since we are publishing in all regions.
AWS_DEFAULT_REGION: eu-west-1
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ env.TAG_NAME }}
- name: Set up JDK ${{ env.JAVA_VERSION }}
Expand All @@ -226,7 +226,7 @@ jobs:
cache: 'maven'
- name: Build Lambda-layer zip using agent from maven-central
run: ./mvnw dependency:purge-local-repository package -pl apm-agent-lambda-layer
- uses: hashicorp/vault-action@v2.4.2
- uses: hashicorp/vault-action@v2.7.4
with:
url: ${{ secrets.VAULT_ADDR }}
method: approle
Expand Down Expand Up @@ -263,7 +263,7 @@ jobs:
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ env.TAG_NAME }}
- name: Await release-notes published
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/snapshoty.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
upload:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: ./.github/workflows/maven-goal
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/updatecli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
bump:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: elastic/apm-pipeline-library/.github/actions/updatecli@current
with:
vaultUrl: ${{ secrets.VAULT_ADDR }}
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Use subheadings with the "=====" level for adding notes for unreleased changes:
* Added protection against invalid timestamps provided by manual instrumentation - {pull}3363[#3363]
* Added support for AWS SDK 2.21 - {pull}3373[#3373]
* Capture bucket and object key to Lambda transaction as OTel attributes - `aws.s3.bueckt`, `aws.s3.key` - {pull}3364[#3364]
* Added `context_propagation_only` configuration option - {pull}3358[#3358]
* Added support for OpenTelemetry annotations - `WithSpan` and `CaptureAttribute` - {pull}3406[#3406]
[float]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,17 @@ public String toString(Collection<String> value) {
"is available somewhere in the classpath where it never gets loaded unless this matching is applied.")
.buildWithDefault(true);

private final ConfigurationOption<Boolean> contextPropagationOnly = ConfigurationOption.booleanOption()
.key("context_propagation_only")
.configurationCategory(CORE_CATEGORY)
.description("When set to true, disables log sending, metrics and trace collection.\n" +
"Trace context propagation and log correlation will stay active.\n"
+"Note that in contrast to <<config-disable-send, `disable_send`>> the agent will still" +
" connect to the APM-server for fetching configuration updates and health checks.")
.dynamic(true)
.tags("added[1.44.0]")
.buildWithDefault(false);

private final ConfigurationOption<List<WildcardMatcher>> classesExcludedFromInstrumentation = ConfigurationOption
.builder(new ValueConverter<List<WildcardMatcher>>() {

Expand Down Expand Up @@ -1147,6 +1158,10 @@ public List<WildcardMatcher> getBaggageToAttach() {
return baggateToAttach.get();
}

public boolean isContextPropagationOnly() {
return contextPropagationOnly.get();
}

public enum CloudProvider {
AUTO,
AWS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ public <T, C> Transaction startChildTransaction(@Nullable C headerCarrier, Heade
return startChildTransaction(headerCarrier, headersGetter, sampler, epochMicros, currentContext().getBaggage(), initiatingClassLoader);
}

@Nullable
private <T, C> Transaction startChildTransaction(@Nullable C headerCarrier, HeaderGetter<T, C> headersGetter, Sampler sampler,
long epochMicros, Baggage baseBaggage, @Nullable ClassLoader initiatingClassLoader) {
Transaction transaction = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class TracerConfiguration extends ConfigurationOptionProvider {
"When recording, the agent instruments incoming HTTP requests, tracks errors and collects and sends metrics.\n" +
"When not recording, the agent works as a noop, not collecting data and not communicating with the APM sever,\n" +
"except for polling the central configuration endpoint.\n" +
"Note that trace context propagation, baggage and log correlation will also be disabled when recording is disabled.\n"+
"As this is a reversible switch, agent threads are not being killed when inactivated, but they will be \n" +
"mostly idle in this state, so the overhead should be negligible.\n" +
"\n" +
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package co.elastic.apm.agent.impl.transaction;

import co.elastic.apm.agent.tracer.pooling.Recyclable;
import co.elastic.apm.agent.impl.ElasticApmTracer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.concurrent.atomic.AtomicInteger;

public abstract class AbstractRefCountedContext<T extends AbstractRefCountedContext<T>> extends ElasticContext<T> implements Recyclable {
private static final Logger logger = LoggerFactory.getLogger(AbstractRefCountedContext.class);

private final AtomicInteger references = new AtomicInteger();

protected AbstractRefCountedContext(ElasticApmTracer tracer) {
super(tracer);
}

@Override
public void incrementReferences() {
int referenceCount = references.incrementAndGet();
if (logger.isDebugEnabled()) {
logger.debug("increment references to {} ({})", this, referenceCount);
if (logger.isTraceEnabled()) {
logger.trace("incrementing references at",
new RuntimeException("This is an expected exception. Is just used to record where the reference count has been incremented."));
}
}
}

@Override
public void decrementReferences() {
int referenceCount = references.decrementAndGet();
if (logger.isDebugEnabled()) {
logger.debug("decrement references to {} ({})", this, referenceCount);
if (logger.isTraceEnabled()) {
logger.trace("decrementing references at",
new RuntimeException("This is an expected exception. Is just used to record where the reference count has been decremented."));
}
}
if (referenceCount == 0) {
recycle();
}
}

public boolean isReferenced() {
return references.get() > 0;
}

public int getReferenceCount() {
return references.get();
}

protected abstract void recycle();

@Override
public void resetState() {
references.set(0);
}
}
Loading

0 comments on commit 2bc6c8d

Please sign in to comment.