Add a convenient Bash script for installation (#1243)

This commit is contained in:
Robert Pająk 2022-09-21 09:34:56 +02:00 committed by GitHub
parent 5c6974cbbe
commit a5fce34828
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 103 additions and 21 deletions

View File

@ -11,15 +11,18 @@ HKLM
LINQ
metricsexporter
mkdir
mktemp
MSMQ
Npgsql
omnisharp
OTEL_DOTNET_AUTO_FLUSH_ON_UNHANDLEDEXCEPTION
OWIN
pipefail
proto
protobuf
protos
Serilog
TMPDIR
tracesexporter
unencrypted
UNENCRYPTEDSUPPORT

View File

@ -69,3 +69,34 @@ jobs:
path: bin/tracer-home
if: (${{ job.status }} != 'cancelled')
continue-on-error: true
install-script:
strategy:
fail-fast: false
matrix:
include:
- machine: windows-2022
distribution: windows
- machine: ubuntu-20.04
distribution: linux-glibc
- machine: ubuntu-20.04
distribution: linux-musl
- machine: macos-11
distribution: macos
runs-on: ${{ matrix.machine }}
steps:
- name: Run convenient installation Bash script
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
shell: bash
run: |
if [ -z "$(ls -A ./otel-dotnet-auto)" ]; then
echo "Empty"
exit 1
else
echo "otel-dotnet-auto is installed"
fi

3
.gitignore vendored
View File

@ -301,3 +301,6 @@ src/OpenTelemetry.AutoInstrumentation.Native/cmake_install.cmake
# ignore verify .received files
*.received.*
# install.sh downloaded artifacts
/otel-dotnet-auto/

View File

@ -92,7 +92,23 @@ See [config.md#instrumented-libraries-and-frameworks](config.md#instrumented-lib
Download and extract the appropriate binaries from
[the latest release](https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/releases/latest).
> The path where you put the binaries is referenced as `%InstallationLocation%`
> The path where you put the binaries is referenced as `$INSTALL_DIR`
You can also use the [download.sh](../download.sh) script with the following parameters:
| Parameter | Description | Required | Default value |
|----------------|-------------------------------------------------------------------|----------|-----------------------------------------------------------------------------------|
| `DISTRIBUTION` | Possible values: `linux-glibc`, `linux-musl`, `macos`, `windows`. | Yes | |
| `INSTALL_DIR` | Location where binaries are to be installed | No | `./otel-dotnet-auto` |
| `RELEASES_URL` | GitHub releases URL | No | `https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/releases` |
| `TMPDIR` | Temporary directory used when downloading the files | No | `$(mktemp -d)` |
| `VERSION` | Version to download | No | `v0.3.1-beta.1` |
```sh
( set -o pipefail
curl -sSfL https://raw.githubusercontent.com/open-telemetry/opentelemetry-dotnet-instrumentation/main/download.sh |
VERSION=v0.3.1-beta.1 DISTRIBUTION=linux-glibc bash -s )
```
### Instrument a .NET application
@ -104,32 +120,32 @@ COR_ENABLE_PROFILING=1
COR_PROFILER={918728DD-259F-4A6A-AC2B-B85E1B658318}
CORECLR_ENABLE_PROFILING=1
CORECLR_PROFILER={918728DD-259F-4A6A-AC2B-B85E1B658318}
DOTNET_ADDITIONAL_DEPS=%InstallationLocation%/AdditionalDeps
DOTNET_SHARED_STORE=%InstallationLocation%/store
DOTNET_STARTUP_HOOKS=%InstallationLocation%/netcoreapp3.1/OpenTelemetry.AutoInstrumentation.StartupHook.dll
OTEL_DOTNET_AUTO_HOME=%InstallationLocation%
OTEL_DOTNET_AUTO_INTEGRATIONS_FILE=%InstallationLocation%/integrations.json
DOTNET_ADDITIONAL_DEPS=$INSTALL_DIR/AdditionalDeps
DOTNET_SHARED_STORE=$INSTALL_DIR/store
DOTNET_STARTUP_HOOKS=$INSTALL_DIR/netcoreapp3.1/OpenTelemetry.AutoInstrumentation.StartupHook.dll
OTEL_DOTNET_AUTO_HOME=$INSTALL_DIR
OTEL_DOTNET_AUTO_INTEGRATIONS_FILE=$INSTALL_DIR/integrations.json
```
On **Windows** you need to additionally set:
```env
COR_PROFILER_PATH_32=%InstallationLocation%/win-x86/OpenTelemetry.AutoInstrumentation.Native.dll
COR_PROFILER_PATH_64=%InstallationLocation%/win-x64/OpenTelemetry.AutoInstrumentation.Native.dll
CORECLR_PROFILER_PATH_32=%InstallationLocation%/win-x86/OpenTelemetry.AutoInstrumentation.Native.dll
CORECLR_PROFILER_PATH_64=%InstallationLocation%/win-x64/OpenTelemetry.AutoInstrumentation.Native.dll
COR_PROFILER_PATH_32=$INSTALL_DIR/win-x86/OpenTelemetry.AutoInstrumentation.Native.dll
COR_PROFILER_PATH_64=$INSTALL_DIR/win-x64/OpenTelemetry.AutoInstrumentation.Native.dll
CORECLR_PROFILER_PATH_32=$INSTALL_DIR/win-x86/OpenTelemetry.AutoInstrumentation.Native.dll
CORECLR_PROFILER_PATH_64=$INSTALL_DIR/win-x64/OpenTelemetry.AutoInstrumentation.Native.dll
```
On **Linux** you need to additionally set:
```env
CORECLR_PROFILER_PATH=%InstallationLocation%/OpenTelemetry.AutoInstrumentation.Native.so
CORECLR_PROFILER_PATH=$INSTALL_DIR/OpenTelemetry.AutoInstrumentation.Native.so
```
On **macOS** you need to additionally set:
```env
CORECLR_PROFILER_PATH=%InstallationLocation%/OpenTelemetry.AutoInstrumentation.Native.dylib
CORECLR_PROFILER_PATH=$INSTALL_DIR/OpenTelemetry.AutoInstrumentation.Native.dylib
```
Configure application's resources. For example:

View File

@ -197,9 +197,9 @@ for more information.
|-|-|-|-|
| `COR_ENABLE_PROFILING` | `CORECLR_ENABLE_PROFILING` | Enables the profiler. | `1` |
| `COR_PROFILER` | `CORECLR_PROFILER` | CLSID of the profiler. | `{918728DD-259F-4A6A-AC2B-B85E1B658318}` |
| `COR_PROFILER_PATH` | `CORECLR_PROFILER_PATH` | Path to the profiler. | `%InstallationLocation%/OpenTelemetry.AutoInstrumentation.Native.dll` for Windows, `%InstallationLocation%/OpenTelemetry.AutoInstrumentation.Native.so` for Linux, `%InstallationLocation%/OpenTelemetry.AutoInstrumentation.Native.dylib` for macOS |
| `COR_PROFILER_PATH_32` | `CORECLR_PROFILER_PATH_32` | Path to the 32-bit profiler. Bitness-specific paths take precedence over generic paths. | `%InstallationLocation%/win-x86/OpenTelemetry.AutoInstrumentation.Native.dll` for Windows |
| `COR_PROFILER_PATH_64` | `CORECLR_PROFILER_PATH_64` | Path to the 64-bit profiler. Bitness-specific paths take precedence over generic paths. | `%InstallationLocation%/win-x64/OpenTelemetry.AutoInstrumentation.Native.dll` for Windows |
| `COR_PROFILER_PATH` | `CORECLR_PROFILER_PATH` | Path to the profiler. | `$INSTALL_DIR/OpenTelemetry.AutoInstrumentation.Native.dll` for Windows, `$INSTALL_DIR/OpenTelemetry.AutoInstrumentation.Native.so` for Linux, `$INSTALL_DIR/OpenTelemetry.AutoInstrumentation.Native.dylib` for macOS |
| `COR_PROFILER_PATH_32` | `CORECLR_PROFILER_PATH_32` | Path to the 32-bit profiler. Bitness-specific paths take precedence over generic paths. | `$INSTALL_DIR/win-x86/OpenTelemetry.AutoInstrumentation.Native.dll` for Windows |
| `COR_PROFILER_PATH_64` | `CORECLR_PROFILER_PATH_64` | Path to the 64-bit profiler. Bitness-specific paths take precedence over generic paths. | `$INSTALL_DIR/win-x64/OpenTelemetry.AutoInstrumentation.Native.dll` for Windows |
## .NET Runtime
@ -212,7 +212,7 @@ are used to mitigate assembly version conflicts in .NET Core.
| Environment variable | Required value |
|-|-|
| `DOTNET_STARTUP_HOOKS` | `%InstallationLocation%/netcoreapp3.1/OpenTelemetry.AutoInstrumentation.StartupHook.dll` |
| `DOTNET_ADDITIONAL_DEPS` | `%InstallationLocation%/AdditionalDeps` |
| `DOTNET_SHARED_STORE` | `%InstallationLocation%/store` |
| `DOTNET_STARTUP_HOOKS` | `$INSTALL_DIR/netcoreapp3.1/OpenTelemetry.AutoInstrumentation.StartupHook.dll` |
| `DOTNET_ADDITIONAL_DEPS` | `$INSTALL_DIR/AdditionalDeps` |
| `DOTNET_SHARED_STORE` | `$INSTALL_DIR/store` |
| `ASPNETCORE_HOSTINGSTARTUPASSEMBLIES` | `OpenTelemetry.AutoInstrumentation.AspNetCoreBootstrapper` |

View File

@ -2,6 +2,8 @@
1. Update the version in the following files:
- [`download.sh`](../download.sh)
- [`docs/README.md`](./README.md)
- [`src/OpenTelemetry.AutoInstrumentation.Loader/OpenTelemetry.AutoInstrumentation.Loader.csproj`](../src/OpenTelemetry.AutoInstrumentation.Loader/OpenTelemetry.AutoInstrumentation.Loader.csproj)
- [`src/OpenTelemetry.AutoInstrumentation.Native/CMakeLists.txt`](../src/OpenTelemetry.AutoInstrumentation.Native/CMakeLists.txt)
- [`src/OpenTelemetry.AutoInstrumentation.Native/Resource.rc`](../src/OpenTelemetry.AutoInstrumentation.Native/Resource.rc)
@ -9,9 +11,6 @@
- [`src/OpenTelemetry.AutoInstrumentation.Native/version.h`](../src/OpenTelemetry.AutoInstrumentation.Native/version.h)
- [`src/OpenTelemetry.AutoInstrumentation/OpenTelemetry.AutoInstrumentation.csproj`](../src/OpenTelemetry.AutoInstrumentation/OpenTelemetry.AutoInstrumentation.csproj)
- ['src/OpenTelemetry.AutoInstrumentation\Constants.cs'](../src/OpenTelemetry.AutoInstrumentation\Constants.cs)
(Version tag)
1. Update the documentation link on the [README.md](./README.md) file.
1. Update the [CHANGELOG.md](../CHANGELOG.md) with the new release.
@ -43,4 +42,6 @@
- Use the [CHANGELOG.md](../CHANGELOG.md) content in the description.
- Add the artifacts from [the `release` GitHub workflow](https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/actions/workflows/release.yml).
1. Update version in `install-script` job in [`.github/workflows/ci.yml`](../.github/workflows/ci.yml).
1. Update version under [OpenTelemetry Operator](https://github.com/open-telemetry/opentelemetry-operator/blob/main/autoinstrumentation/dotnet/version.txt).

28
download.sh Executable file
View File

@ -0,0 +1,28 @@
#!/bin/sh
set -e
test -z "$DISTRIBUTION" && {
echo "Please specify the distribution by setting the DISTRIBUTION env var." >&2
echo "Supported values:" >&2
echo " linux-glibc" >&2
echo " linux-musl" >&2
echo " macos" >&2
echo " windows" >&2
exit 1
}
test -z "$INSTALL_DIR" && INSTALL_DIR="./otel-dotnet-auto"
test -z "$RELEASES_URL" && RELEASES_URL="https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/releases"
test -z "$TMPDIR" && TMPDIR="$(mktemp -d)"
test -z "$VERSION" && VERSION="v0.3.1-beta.1"
ARCHIVE="opentelemetry-dotnet-instrumentation-$DISTRIBUTION.zip"
TMPFILE="$TMPDIR/$ARCHIVE"
(
cd "$TMPDIR"
echo "Downloading $VERSION for $DISTRIBUTION..."
curl -sSfLo "$TMPFILE" "$RELEASES_URL/download/$VERSION/$ARCHIVE"
)
rm -rf "$INSTALL_DIR"
unzip -q "$TMPFILE" -d "$INSTALL_DIR"