-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
164 additions
and
29 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,26 +77,43 @@ jobs: | |
include: | ||
- machine: windows-2022 | ||
distribution: windows | ||
log-dir: "/c/ProgramData/OpenTelemetry .NET AutoInstrumentation/logs" | ||
- machine: ubuntu-20.04 | ||
distribution: linux-glibc | ||
log-dir: "/var/log/opentelemetry/dotnet" | ||
- machine: ubuntu-20.04 | ||
distribution: linux-musl | ||
test-instrument: "false" | ||
- machine: macos-11 | ||
distribution: macos | ||
log-dir: "/var/log/opentelemetry/dotnet" | ||
runs-on: ${{ matrix.machine }} | ||
steps: | ||
- name: Run convenient installation Bash script | ||
- run: brew install coreutils | ||
if: ${{ runner.os == 'macOS' }} | ||
- name: Download OTel .NET AutoInstrumentation using download.sh | ||
shell: bash | ||
run: | | ||
set -o pipefail | ||
curl -sSfL https://raw.githubusercontent.com/${{ github.repository }}/${{ github.sha }}/download.sh | | ||
DISTRIBUTION=${{ matrix.distribution }} bash -s | ||
- name: Test if ./otel-dotnet-auto contains any files | ||
- name: Test download.sh - verify if binaries are downloaded | ||
shell: bash | ||
run: test "$(ls -A ./otel-dotnet-auto)" | ||
- uses: actions/[email protected] | ||
with: | ||
dotnet-version: 6.0.x | ||
- run: sudo mkdir -p ${{ matrix.log-dir }} && sudo chmod a+rwx ${{ matrix.log-dir }} # workaround before next release | ||
if: ${{ runner.os != 'Windows' && matrix.test-instrument != 'false' }} | ||
- name: Instrument dotnet using instrument.sh | ||
shell: bash | ||
run: | | ||
if [ -z "$(ls -A ./otel-dotnet-auto)" ]; then | ||
echo "Empty" | ||
exit 1 | ||
else | ||
echo "otel-dotnet-auto is installed" | ||
fi | ||
set -e | ||
curl -fL https://raw.githubusercontent.com/${{ github.repository }}/${{ github.sha }}/instrument.sh -O | ||
DISTRIBUTION=${{ matrix.distribution }} source ./instrument.sh | ||
dotnet help | ||
- name: Test instrument.sh - verify if internal logs are created | ||
if: ${{ matrix.test-instrument != 'false' }} | ||
shell: bash | ||
run: test "$(ls -A '${{ matrix.log-dir }}' )" | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
#!/bin/sh | ||
|
||
# validate input | ||
case "$DISTRIBUTION" in | ||
"linux-glibc"|"linux-musl"|"macos"|"windows") | ||
;; | ||
*) | ||
echo "Please specify the distribution by setting the DISTRIBUTION env var. Supported values: linux-glibc, linux-musl, macos, windows." >&2 | ||
return 2 | ||
;; | ||
esac | ||
|
||
case "$ENABLE_PROFILING" in | ||
"true"|"false") | ||
;; | ||
"") | ||
ENABLE_PROFILING="true" | ||
;; | ||
*) | ||
echo "Invalid ENABLE_PROFILING env var. Supported values: true, false." >&2 | ||
return 2 | ||
;; | ||
esac | ||
|
||
# set defaults | ||
test -z "$INSTALL_DIR" && INSTALL_DIR="./otel-dotnet-auto" | ||
|
||
|
||
# check $INSTALL_DIR and use it to set the absolute path $OTEL_DIR | ||
if [ -z "$(ls -A $INSTALL_DIR)" ]; then | ||
echo "There are no files under the location specified via INSTALL_DIR." | ||
return 1 | ||
fi | ||
if [ "$DISTRIBUTION" == "macos" ]; then | ||
OTEL_DIR=$(greadlink -fn $INSTALL_DIR) | ||
else | ||
OTEL_DIR=$(readlink -fn $INSTALL_DIR) | ||
fi | ||
if [ "$DISTRIBUTION" == "windows" ]; then | ||
OTEL_DIR=$(cygpath -w $OTEL_DIR) | ||
fi | ||
if [ -z "$OTEL_DIR" ]; then | ||
echo "Failed to get INSTALL_DIR absolute path. " | ||
return 1 | ||
fi | ||
|
||
if [ "$ENABLE_PROFILING" = "true" ]; then | ||
# Set the .NET CLR Profiler file sufix | ||
case "$DISTRIBUTION" in | ||
"linux-glibc"|"linux-musl") | ||
SUFIX="so" | ||
;; | ||
"macos") | ||
SUFIX="dylib" | ||
;; | ||
"windows") | ||
SUFIX="dll" | ||
;; | ||
*) | ||
echo "BUG: Unknown distribution. Please submit an issue in https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation." >&2 | ||
return 1 | ||
;; | ||
esac | ||
|
||
# Enable .NET Framework Profiling API | ||
if [ "$DISTRIBUTION" == "windows" ] | ||
then | ||
export COR_ENABLE_PROFILING="1" | ||
export COR_PROFILER="{918728DD-259F-4A6A-AC2B-B85E1B658318}" | ||
# Set paths for both bitness on Windows, see https://docs.microsoft.com/en-us/dotnet/core/run-time-config/debugging-profiling#profiler-location | ||
export COR_PROFILER_PATH_64="$OTEL_DIR/win-x64/OpenTelemetry.AutoInstrumentation.Native.$SUFIX" | ||
export COR_PROFILER_PATH_32="$OTEL_DIR/win-x86/OpenTelemetry.AutoInstrumentation.Native.$SUFIX" | ||
fi | ||
|
||
# Enable .NET Core Profiling API | ||
export CORECLR_ENABLE_PROFILING="1" | ||
export CORECLR_PROFILER="{918728DD-259F-4A6A-AC2B-B85E1B658318}" | ||
if [ "$DISTRIBUTION" == "windows" ] | ||
then | ||
# Set paths for both bitness on Windows, see https://docs.microsoft.com/en-us/dotnet/core/run-time-config/debugging-profiling#profiler-location | ||
export CORECLR_PROFILER_PATH_64="$OTEL_DIR/win-x64/OpenTelemetry.AutoInstrumentation.Native.$SUFIX" | ||
export CORECLR_PROFILER_PATH_32="$OTEL_DIR/win-x86/OpenTelemetry.AutoInstrumentation.Native.$SUFIX" | ||
else | ||
export CORECLR_PROFILER_PATH="$OTEL_DIR/OpenTelemetry.AutoInstrumentation.Native.$SUFIX" | ||
fi | ||
|
||
# Configure the bytecode instrumentation configuration file | ||
export OTEL_DOTNET_AUTO_INTEGRATIONS_FILE="$OTEL_DIR/integrations.json" | ||
fi | ||
|
||
# Configure .NET Core Runtime | ||
export DOTNET_ADDITIONAL_DEPS="$OTEL_DIR/AdditionalDeps" | ||
export DOTNET_SHARED_STORE="$OTEL_DIR/store" | ||
export DOTNET_STARTUP_HOOKS="$OTEL_DIR/netcoreapp3.1/OpenTelemetry.AutoInstrumentation.StartupHook.dll" | ||
|
||
# Configure OpenTelemetry .NET Auto-Instrumentation | ||
export OTEL_DOTNET_AUTO_HOME="$OTEL_DIR" |