Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 2 additions & 0 deletions .buildkite/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ steps:
artifact_paths:
- "release.txt"
- "agent/build/libs/elastic-otel-javaagent-*.jar"
- "jvmti-access/build/libs/jvmti-access-.*.jar"
- "universal-profiling-integration/build/libs/universal-profiling-integration-.*.jar"
- "agentextension/build/libs/elastic-otel-agentextension-.*.jar"
- "common/build/libs/common-.*.jar"
- "inferred-spans/build/libs/inferred-spans-.*.jar"
Expand Down
2 changes: 2 additions & 0 deletions .buildkite/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ steps:
artifact_paths:
- "snapshot.txt"
- "agent/build/libs/elastic-otel-javaagent-*.jar"
- "jvmti-access/build/libs/jvmti-access-.*.jar"
- "universal-profiling-integration/build/libs/universal-profiling-integration-.*.jar"
- "agentextension/build/libs/elastic-otel-agentextension-.*.jar"
- "common/build/libs/common-.*.jar"
- "inferred-spans/build/libs/inferred-spans-.*.jar"
Expand Down
5 changes: 5 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,10 @@ A copy of the ASM license (3-Clause BSD License) is provided in the 'licenses/LI
This project depends on okhttp, which contains 'publicsuffixes.gz' that is licensed under the Mozilla Public License, v. 2.0 - https://mozilla.org/MPL/2.0/
A copy of the publicsuffixes.gz license (Mozilla Public License, v. 2.0) is provided in the 'licenses/LICENSE_mpl-2' file.

This project depends on HdrHistogram which is dual-licensed under the following licenses:
- 2-Clause BSD License - https://opensource.org/licenses/BSD-2-Clause
- Creative Commons Public Domain License - https://creativecommons.org/publicdomain/zero/1.0/
A copy of the HdrHistogram license is provided in the 'licenses/LICENSE_hdrhistogram_bsd-2-clause_cc0' file.

Details on the individual dependencies notices and licenses can be found in the 'licenses' folder.

Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
* 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.otel.common.config;

import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties;
import java.time.Duration;
import java.util.Arrays;
import java.util.List;
import java.util.function.Consumer;
import java.util.stream.Collectors;

public class PropertiesApplier {

private final ConfigProperties properties;

public PropertiesApplier(ConfigProperties properties) {
this.properties = properties;
}

public void applyBool(String configKey, Consumer<Boolean> funcToApply) {
applyValue(properties.getBoolean(configKey), funcToApply);
}

public void applyInt(String configKey, Consumer<Integer> funcToApply) {
applyValue(properties.getInt(configKey), funcToApply);
}

public void applyDuration(String configKey, Consumer<Duration> funcToApply) {
applyValue(properties.getDuration(configKey), funcToApply);
}

public void applyString(String configKey, Consumer<String> funcToApply) {
applyValue(properties.getString(configKey), funcToApply);
}

public void applyWildcards(
String configKey, Consumer<? super List<WildcardMatcher>> funcToApply) {
String wildcardListString = properties.getString(configKey);
if (wildcardListString != null && !wildcardListString.isEmpty()) {
List<WildcardMatcher> values =
Arrays.stream(wildcardListString.split(","))
.filter(str -> !str.isEmpty())
.map(WildcardMatcher::valueOf)
.collect(Collectors.toList());
if (!values.isEmpty()) {
funcToApply.accept(values);
}
}
}

private static <T> void applyValue(T value, Consumer<T> funcToApply) {
if (value != null) {
funcToApply.accept(value);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package co.elastic.otel.profiler.config;
package co.elastic.otel.common.config;

import java.util.ArrayList;
import java.util.Collections;
Expand Down
1 change: 1 addition & 0 deletions custom/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plugins {
dependencies {
implementation(project(":common"))
implementation(project(":inferred-spans"))
implementation(project(":universal-profiling-integration"))
compileOnly(project(":bootstrap"))
implementation(project(":resources"))
compileOnly("io.opentelemetry:opentelemetry-sdk")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,11 @@
*/
package co.elastic.otel.profiler;

import co.elastic.otel.profiler.config.WildcardMatcher;
import co.elastic.otel.common.config.PropertiesApplier;
import com.google.auto.service.AutoService;
import io.opentelemetry.sdk.autoconfigure.spi.AutoConfigurationCustomizer;
import io.opentelemetry.sdk.autoconfigure.spi.AutoConfigurationCustomizerProvider;
import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties;
import java.time.Duration;
import java.util.Arrays;
import java.util.List;
import java.util.function.Consumer;
import java.util.logging.Logger;
import java.util.stream.Collectors;

@AutoService(AutoConfigurationCustomizerProvider.class)
public class InferredSpansAutoConfig implements AutoConfigurationCustomizerProvider {
Expand Down Expand Up @@ -78,49 +72,4 @@ public void customize(AutoConfigurationCustomizer config) {
return providerBuilder;
});
}

private static class PropertiesApplier {

private final ConfigProperties properties;

private PropertiesApplier(ConfigProperties properties) {
this.properties = properties;
}

void applyBool(String configKey, Consumer<Boolean> funcToApply) {
applyValue(properties.getBoolean(configKey), funcToApply);
}

void applyInt(String configKey, Consumer<Integer> funcToApply) {
applyValue(properties.getInt(configKey), funcToApply);
}

void applyDuration(String configKey, Consumer<Duration> funcToApply) {
applyValue(properties.getDuration(configKey), funcToApply);
}

void applyString(String configKey, Consumer<String> funcToApply) {
applyValue(properties.getString(configKey), funcToApply);
}

void applyWildcards(String configKey, Consumer<? super List<WildcardMatcher>> funcToApply) {
String wildcardListString = properties.getString(configKey);
if (wildcardListString != null && !wildcardListString.isEmpty()) {
List<WildcardMatcher> values =
Arrays.stream(wildcardListString.split(","))
.filter(str -> !str.isEmpty())
.map(WildcardMatcher::valueOf)
.collect(Collectors.toList());
if (!values.isEmpty()) {
funcToApply.accept(values);
}
}
}

private static <T> void applyValue(T value, Consumer<T> funcToApply) {
if (value != null) {
funcToApply.accept(value);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package co.elastic.otel.profiler;

import co.elastic.otel.profiler.config.WildcardMatcher;
import co.elastic.otel.common.config.WildcardMatcher;
import java.time.Duration;
import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package co.elastic.otel.profiler;

import co.elastic.otel.profiler.config.WildcardMatcher;
import co.elastic.otel.common.config.WildcardMatcher;
import java.io.File;
import java.time.Duration;
import java.util.Arrays;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
import static java.nio.file.StandardOpenOption.READ;
import static java.nio.file.StandardOpenOption.WRITE;

import co.elastic.otel.common.config.WildcardMatcher;
import co.elastic.otel.common.util.ExecutorUtils;
import co.elastic.otel.profiler.asyncprofiler.AsyncProfiler;
import co.elastic.otel.profiler.asyncprofiler.JfrParser;
import co.elastic.otel.profiler.collections.Long2ObjectHashMap;
import co.elastic.otel.profiler.config.WildcardMatcher;
import co.elastic.otel.profiler.pooling.Allocator;
import co.elastic.otel.profiler.pooling.ObjectPool;
import com.lmax.disruptor.EventFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
*/
package co.elastic.otel.profiler.asyncprofiler;

import co.elastic.otel.common.config.WildcardMatcher;
import co.elastic.otel.profiler.StackFrame;
import co.elastic.otel.profiler.collections.Int2IntHashMap;
import co.elastic.otel.profiler.collections.Int2ObjectHashMap;
import co.elastic.otel.profiler.collections.Long2LongHashMap;
import co.elastic.otel.profiler.collections.Long2ObjectHashMap;
import co.elastic.otel.profiler.config.WildcardMatcher;
import co.elastic.otel.profiler.pooling.Recyclable;
import java.io.File;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.assertThat;
import static org.awaitility.Awaitility.await;

import co.elastic.otel.profiler.config.WildcardMatcher;
import co.elastic.otel.common.config.WildcardMatcher;
import co.elastic.otel.testing.AutoConfigTestProperties;
import co.elastic.otel.testing.AutoConfiguredDataCapture;
import co.elastic.otel.testing.DisabledOnAppleSilicon;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package co.elastic.otel.profiler.asyncprofiler;

import static co.elastic.otel.profiler.config.WildcardMatcher.caseSensitiveMatcher;
import static co.elastic.otel.common.config.WildcardMatcher.caseSensitiveMatcher;
import static org.assertj.core.api.Assertions.assertThat;

import co.elastic.otel.profiler.StackFrame;
Expand Down
4 changes: 4 additions & 0 deletions jvmti-access/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import java.util.*

plugins {
id("elastic-otel.library-packaging-conventions")
id("elastic-otel.sign-and-publish-conventions")
alias(catalog.plugins.dockerJavaApplication)
}

Expand All @@ -18,6 +19,9 @@ dependencies {
implementation(libs.findbugs.jsr305)
}

description = "Library for exposing JVMTI and JNI functionality to Java"


// we use Java 7 for this project so that it can be reused in the old elastic-apm-agent
// Subsequently, the newest Java compiler we can use is java 17
java {
Expand Down
6 changes: 6 additions & 0 deletions jvmti-access/src/main/java/co/elastic/otel/JvmtiAccess.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ static void setProfilingCorrelationCurrentThreadStorage(@Nullable ByteBuffer sto
JvmtiAccessImpl.setThreadProfilingCorrelationBuffer0(storage);
}

/**
* Starts the socket for receiving universal profiler messages on the given filepath. Note that
* the path has a limitation of about 100 characters, see <a
* href="https://unix.stackexchange.com/questions/367008/why-is-socket-path-length-limited-to-a-hundred-chars">this
* discussion</a> for details.
*/
static void startProfilerReturnChannelSocket(String filepath) {
ensureInitialized();
checkError(JvmtiAccessImpl.startProfilerReturnChannelSocket0(filepath));
Expand Down
41 changes: 41 additions & 0 deletions licenses/LICENSE_hdrhistogram_bsd-2-clause_cc0
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
The code in this repository code was Written by Gil Tene, Michael Barker,
and Matt Warren, and released to the public domain, as explained at
http://creativecommons.org/publicdomain/zero/1.0/

For users of this code who wish to consume it under the "BSD" license
rather than under the public domain or CC0 contribution text mentioned
above, the code found under this directory is *also* provided under the
following license (commonly referred to as the BSD 2-Clause License). This
license does not detract from the above stated release of the code into
the public domain, and simply represents an additional license granted by
the Author.

-----------------------------------------------------------------------------
** Beginning of "BSD 2-Clause License" text. **

Copyright (c) 2012, 2013, 2014, 2015, 2016 Gil Tene
Copyright (c) 2014 Michael Barker
Copyright (c) 2014 Matt Warren
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
35 changes: 31 additions & 4 deletions licenses/more-licences.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
**3** **Group:** `com.google.code.findbugs` **Name:** `jsr305` **Version:** `3.0.2`
> - **Manifest License**: Apache License, Version 2.0 (Not Packaged)
> - **POM Project URL**: [http://findbugs.sourceforge.net/](http://findbugs.sourceforge.net/)
> - **POM License**: Apache License, Version 2.0 - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
> - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0)

**4** **Group:** `com.lmax` **Name:** `disruptor` **Version:** `3.4.4`
> - **Project URL**: [http://lmax-exchange.github.com/disruptor](http://lmax-exchange.github.com/disruptor)
Expand Down Expand Up @@ -80,7 +80,7 @@

**19** **Group:** `io.opentelemetry.semconv` **Name:** `opentelemetry-semconv` **Version:** `1.23.1-alpha`
> - **POM Project URL**: [https://github.com/open-telemetry/semantic-conventions-java](https://github.com/open-telemetry/semantic-conventions-java)
> - **POM License**: Apache License, Version 2.0 - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
> - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0)

**20** **Group:** `net.bytebuddy` **Name:** `byte-buddy-dep` **Version:** `1.14.12`
> - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0)
Expand All @@ -106,16 +106,43 @@
> - **POM License**: Apache License, Version 2.0 - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
> - **POM License**: The 3-Clause BSD License - [https://opensource.org/licenses/BSD-3-Clause](https://opensource.org/licenses/BSD-3-Clause)

## Creative Commons Legal Code

**24** **Group:** `org.hdrhistogram` **Name:** `HdrHistogram` **Version:** `2.1.12`
Comment thread
JonasKunz marked this conversation as resolved.
> - **Manifest License**: The 2-Clause BSD License (Not Packaged)
> - **POM Project URL**: [http://hdrhistogram.github.io/HdrHistogram/](http://hdrhistogram.github.io/HdrHistogram/)
> - **POM License**: Creative Commons Legal Code - [https://creativecommons.org/publicdomain/zero/1.0/legalcode](https://creativecommons.org/publicdomain/zero/1.0/legalcode)
> - **POM License**: PUBLIC DOMAIN - [http://creativecommons.org/publicdomain/zero/1.0/](http://creativecommons.org/publicdomain/zero/1.0/)
> - **POM License**: The 2-Clause BSD License - [https://opensource.org/licenses/BSD-2-Clause](https://opensource.org/licenses/BSD-2-Clause)

## PUBLIC DOMAIN

**25** **Group:** `org.hdrhistogram` **Name:** `HdrHistogram` **Version:** `2.1.12`
> - **Manifest License**: The 2-Clause BSD License (Not Packaged)
> - **POM Project URL**: [http://hdrhistogram.github.io/HdrHistogram/](http://hdrhistogram.github.io/HdrHistogram/)
> - **POM License**: Creative Commons Legal Code - [https://creativecommons.org/publicdomain/zero/1.0/legalcode](https://creativecommons.org/publicdomain/zero/1.0/legalcode)
> - **POM License**: PUBLIC DOMAIN - [http://creativecommons.org/publicdomain/zero/1.0/](http://creativecommons.org/publicdomain/zero/1.0/)
> - **POM License**: The 2-Clause BSD License - [https://opensource.org/licenses/BSD-2-Clause](https://opensource.org/licenses/BSD-2-Clause)

## The 2-Clause BSD License

**26** **Group:** `org.hdrhistogram` **Name:** `HdrHistogram` **Version:** `2.1.12`
> - **Manifest License**: The 2-Clause BSD License (Not Packaged)
> - **POM Project URL**: [http://hdrhistogram.github.io/HdrHistogram/](http://hdrhistogram.github.io/HdrHistogram/)
> - **POM License**: Creative Commons Legal Code - [https://creativecommons.org/publicdomain/zero/1.0/legalcode](https://creativecommons.org/publicdomain/zero/1.0/legalcode)
> - **POM License**: PUBLIC DOMAIN - [http://creativecommons.org/publicdomain/zero/1.0/](http://creativecommons.org/publicdomain/zero/1.0/)
> - **POM License**: The 2-Clause BSD License - [https://opensource.org/licenses/BSD-2-Clause](https://opensource.org/licenses/BSD-2-Clause)

## The 3-Clause BSD License

**24** **Group:** `org.ow2.asm` **Name:** `asm` **Version:** `9.6`
**27** **Group:** `org.ow2.asm` **Name:** `asm` **Version:** `9.6`
> - **Manifest Project URL**: [http://asm.ow2.org](http://asm.ow2.org)
> - **Manifest License**: The 3-Clause BSD License (Not Packaged)
> - **POM Project URL**: [http://asm.ow2.io/](http://asm.ow2.io/)
> - **POM License**: Apache License, Version 2.0 - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
> - **POM License**: The 3-Clause BSD License - [https://opensource.org/licenses/BSD-3-Clause](https://opensource.org/licenses/BSD-3-Clause)

**25** **Group:** `org.ow2.asm` **Name:** `asm-commons` **Version:** `9.6`
**28** **Group:** `org.ow2.asm` **Name:** `asm-commons` **Version:** `9.6`
> - **Manifest Project URL**: [http://asm.ow2.org](http://asm.ow2.org)
> - **Manifest License**: The 3-Clause BSD License (Not Packaged)
> - **POM Project URL**: [http://asm.ow2.io/](http://asm.ow2.io/)
Expand Down
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ include("testing-common")
include("universal-profiling-integration")
include("testing:integration-tests:inferred-spans-test")
include("testing:integration-tests:agent-internals")
include("testing:integration-tests:universal-profiling-test")

dependencyResolutionManagement {
versionCatalogs {
Expand Down
Loading