SeaLights CD Agent for .Net Application
Onboarding the .Net CD Agent
These steps outline the onboarding steps needed on the environment, with the CD agent, added to each component that builds up the Application Under Test.
Configuration steps
Download an Agent Token from the dashboard and make it available to each component configured with our agent.
This can be done by placing it in a file accessible to the agent or through an environment variable directly or through a secret manager.
Download the CD agent and make it available to each component by copying it in, downloading it during startup, or mounting an external volume containing the agent. Please refer to the dedicated section below for details.
Create an “Integration Build Lab ID” entry of type “CD only” in the dashboard for the tested application (see picture on the right).
Do so in the settings of the SeaLights dashboard, under 'Cockpit & Onboarding → Integration Build Labs → CD Only'
The lab ID from this integration build entry needs to be provided to the CD agent through an environment variable.
Add the CD agent to your environment to attach it as a Profiler to your Application Under Test.
Set the relevant parameters and/or environment variables to be used (See samples below)
When the application is up and running and the Sealights CD Agent configured, you can see it is properly running from the Cockpit -> Live Agents Monitor screen.
Spinning up with environment variables
|
|
---|---|
| Instructs the runtime to enable profiling |
| Instructs the runtime which profiler to use |
| Instructs the runtime where to find the 32 bit version of the profiler |
| Instructs the runtime where to find the 64 bit version of the profiler |
| Instructs the runtime to enable profiling for .NET Core |
| Instructs the runtime which profiler to use for .NET Core |
| Instructs the runtime where to find the 32 bit version of the profiler for .NET Core |
| Instructs the runtime where to find the 64 bit version of the profiler for .NET Core |
| Instructs the Sealights profiler to initialize its own collector when starting up |
| Instructs the Sealights profiler in which mode to start up |
| Instructs the Sealights profiler what blocking connection type to use during startup |
| Provides the Sealights agent the token to work with |
| Name of the component |
| Source branch of the component |
| The build label/version of the current artifact |
| Identifier of the current application under test. |
| Path to the scanned folder where all binary files are located |
| Comma-separated list of namespaces to include in the scan. |
| Comma-separated list of namespaces to include in the scan. |
| Set to |
| Folder to save the log files to |
| Log level. Default and Recommended value is
|
| Set to |
| Set to |
| File name to save the log to |
Sample configuration in a docker file
ENV COR_ENABLE_PROFILING=1
ENV COR_PROFILER="{3B1DAA64-89D4-4999-ABF4-6A979B650B7D}"
ENV COR_PROFILER_PATH_32=/sealights/libSL.DotNet.ProfilerLib.Linux.so
ENV COR_PROFILER_PATH_64=/sealights/libSL.DotNet.ProfilerLib.Linux.so
ENV CORECLR_ENABLE_PROFILING=1
ENV CORECLR_PROFILER="{3B1DAA64-89D4-4999-ABF4-6A979B650B7D}"
ENV CORECLR_PROFILER_PATH_32=/sealights/libSL.DotNet.ProfilerLib.Linux.so
ENV CORECLR_PROFILER_PATH_64=/sealights/libSL.DotNet.ProfilerLib.Linux.so
ENV SL_PROFILER_INITIALIZECOLLECTOR=1
ENV SL_PROFILER_INITIALIZECOLLECTOR_MODE="cdAgent"
ENV SL_PROFILER_BLOCKING_CONNECTION_STARTUP="ASYNC"
ARG BUILD_NUMBER
ENV SL_SESSION_TOKENFILE=/sealights/sltoken.txt
ENV SL_GENERAL_APPNAME="otel_cartservice"
ENV SL_GENERAL_BRANCHNAME="main"
ENV SL_GENERAL_BUILDNAME=$BUILD_NUMBER
ENV SL_LABID="my_lab"
ENV SL_SCAN_BINDIR="/app"
ENV SL_SCAN_INCLUDENAMESPACES_0="cartservice.*"
ENV SL_SCAN_INCLUDEASSEMBLIES="*cartservice"
ENV SL_FEATURES_IDENTIFYMETHODSBYFQN="true"
Agent’s Parameters Reference
Mandatory parameters
Property (CLI) | Required | Description | Env variable | JSON |
---|---|---|---|---|
| Yes | Name of the target application |
| "general": {
"appName": ""
} |
| Yes | The source branch of the application |
| "general": {
"branchName": ""
} |
| Yes | The build label/version of the current artifact The exact same value must be provided for the same version of the service being deployed multiple times |
| |
| Yes | CD-only lab id |
| |
| Yes | Path to the scanned folder where all binary files are located |
| |
| Yes | Comma-separated list of namespaces to include in the scan. |
|
Optional parameters
These parameters may be required due to your specific configuration or environment’s limitations (e.g., proxy).
Property | Description | Env variable | JSON |
---|---|---|---|
| Comma-separated list of namespaces to exclude from the scan. Supports wildcard ( Default value: |
|
|
| Comma-separated list of files to include in scan. Supports wildcard ( Default value: |
|
|
| Comma-separated list of files to exclude from the scan. Supports wildcard ( |
|
|
| Comma-separated list of assemblies to include. Supports wildcard ( |
|
|
| Comma-separated list of assemblies to exclude from the scan. Supports wildcard ( Default value: |
|
|
| The project source root directory, where all paths will be made relative to |
| |
| The name of the target application that will be started |
|
|
| Arguments to be passed to the target process |
|
|
| The path to the working directory. By default, it’s using current working directory. |
|
|
Logging parameters
To enable logs, you can set the following parameters
Parameter (CLI) | Description | Env variable | JSON |
---|---|---|---|
| Log level. Default and Recommended value is
|
|
|
| Enables logging profiler data to file. Requires LogLevel to be specified. |
|
Sample Commands
Downloading the agent
The different available options to download the agent are documented in a dedicated central page: https://sealights.atlassian.net/l/cp/g0omvaoL
For example, you can use the following commands to automate the process
Linux | |
---|---|
Windows |
Configuration commands
Simple Web App (Desktop, Windows)
This simple use case illustrates how to collect coverage with the CD agent from a web application started without parameters.
Microservice (Alpine-based docker file)
DockerFile
Startup script