-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Indrajit Banerjee <banerind@amazon.com>
- Loading branch information
Showing
59 changed files
with
2,022 additions
and
527 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,29 @@ | ||
name: Gradle Precommit | ||
name: Gradle Precommit and Asssemble | ||
on: [pull_request] | ||
|
||
jobs: | ||
precommit: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [windows-latest, macos-latest] # precommit on ubuntu-latest is run as a part of the gradle-check workflow | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v2 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: 11 | ||
distribution: adopt | ||
- name: Run Gradle | ||
distribution: temurin | ||
cache: gradle | ||
- name: Run Gradle (precommit) | ||
run: | | ||
./gradlew javadoc precommit --parallel | ||
- name: Setup docker (missing on MacOS) | ||
if: runner.os == 'macos' | ||
run: | | ||
brew install docker | ||
colima start | ||
sudo ln -sf $HOME/.colima/default/docker.sock /var/run/docker.sock | ||
- name: Run Gradle (assemble) | ||
run: | | ||
./gradlew assemble --parallel |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
libs/telemetry/src/main/java/org/opensearch/telemetry/tracing/SpanContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.telemetry.tracing; | ||
|
||
/** | ||
* Wrapped Span will be exposed to the code outside of tracing package for sharing the {@link Span} without having access to | ||
* its properties. | ||
*/ | ||
public final class SpanContext { | ||
private final Span span; | ||
|
||
/** | ||
* Constructor. | ||
* @param span span to be wrapped. | ||
*/ | ||
public SpanContext(Span span) { | ||
this.span = span; | ||
} | ||
|
||
Span getSpan() { | ||
return span; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
.../telemetry/src/main/java/org/opensearch/telemetry/tracing/runnable/TraceableRunnable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.telemetry.tracing.runnable; | ||
|
||
import org.opensearch.telemetry.tracing.SpanContext; | ||
import org.opensearch.telemetry.tracing.SpanScope; | ||
import org.opensearch.telemetry.tracing.Tracer; | ||
|
||
/** | ||
* Wraps the runnable and add instrumentation to trace the {@link Runnable} | ||
*/ | ||
public class TraceableRunnable implements Runnable { | ||
private final Runnable runnable; | ||
private final SpanContext parent; | ||
private final Tracer tracer; | ||
private final String spanName; | ||
|
||
/** | ||
* Constructor. | ||
* @param tracer tracer | ||
* @param spanName spanName | ||
* @param parent parent Span. | ||
* @param runnable runnable. | ||
*/ | ||
public TraceableRunnable(Tracer tracer, String spanName, SpanContext parent, Runnable runnable) { | ||
this.tracer = tracer; | ||
this.spanName = spanName; | ||
this.parent = parent; | ||
this.runnable = runnable; | ||
} | ||
|
||
@Override | ||
public void run() { | ||
try (SpanScope spanScope = tracer.startSpan(spanName, parent)) { | ||
runnable.run(); | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
libs/telemetry/src/main/java/org/opensearch/telemetry/tracing/runnable/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
/** | ||
* Contains tracing related classes | ||
*/ | ||
package org.opensearch.telemetry.tracing.runnable; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.