Hi Robert,
I have written basic steps needed to setup a sample application using linux docker containers.
Instructions for setting up sample environment for using Linux SDK - Step 1: Getting the Sample Code
mkdir MvcApp cd MvcApp dotnet new mvc
Step 2: Test the App if it is working fine
dotnet restore dotnet run Check in Browser -> http://localhost:5000
Step 3: Add Nuget Package in the Project -
dotnet add package AppDynamics.AgentSDK
Step 4: Modify your project to use the AppDynamics SDK - e.g: Edit HomeController.cs and add following -
using AppDynamics; ... namespace MvcApp.Controllers { public class HomeController : Controller { public IActionResult SomePage() { var currCtxId = AgentSDK.StartBusinessTransaction("DemoBT", "ASP_DOTNET", ""); // Code here calls to other ASP_DOTNET component ... AgentSDK.StopBusinessTransaction(currCtxId); return View(); } ...
For further reading and usage - https://docs.appdynamics.com/display/PRO45/.NET+Core+for+Linux+SDK+Use+Cases Step 5: Run "dotnet build" Note: This step should fail with warning-> "AppDynamicsConfig.json : warning APPD001: AppDynamics config was not updated" Step 6: Edit the AppDynamicsConfig.json file with the following information:
{ "controller": { "host": "<controller_host_name>", "port": <controller_port_name>, "account": "<controller_account_name>", "password": "<controller_account_key>", "ssl": <true if using https controller, or false> }, "application": { "name": "<application_name>", "tier": "<tier_name>", "node": "<node_name>" }, "log": { "directory": "<log_folder_path, e.g. /tmp/AppDLogs>", "level": "<log_level, e.g. INFO>" } }
Step 7: Create Dockerfile under MvcApp folder and Add Following -
#FROM microsoft/dotnet:2.0-sdk #FROM microsoft/aspnetcore-build:2.0 FROM microsoft/dotnet:2.0-sdk COPY . /app WORKDIR /app RUN ["dotnet", "restore"] RUN ["dotnet", "build"] #RUN ["apt-get","update"] #RUN ["apt-get", "install", "lsof"] ENV CORECLR_PROFILER="{57e1aa68-2229-41aa-9931-a6e93bbc64d8}" ENV CORECLR_ENABLE_PROFILING=1 ENV CORECLR_PROFILER_PATH="/<user,e.g:root>/.nuget/packages/appdynamics.agentsdk/4.5.0/runtimes/linux-x64/native/libappdprofiler.so" EXPOSE 5000/tcp ENV ASPNETCORE_URLS http://*:5000 ENTRYPOINT ["dotnet", "run"]
Note: For CORECLR_PROFILER_PATH refer the last section on https://docs.appdynamics.com/display/PRO45/Using+.NET+Core+for+Linux+SDK Step 8: Build the Image (make sure cd MvcApp, if not already the current directory)-
docker build -t appdsample:MvcApp .
Step 9: Launch the Image -
docker run -d -p 8088:5000 -t appdsample:MvcApp
Step 10: Apply Load on the application (http://localhost:8088/) and check the reporting in controller and logs under e.g. /tmp/AppDLogs Doc references -
https://docs.appdynamics.com/display/PRO45/.NET+Core+for+Linux+SDK
https://docs.appdynamics.com/display/PRO45/Using+.NET+Core+for+Linux+SDK
https://docs.appdynamics.com/display/PRO45/.NET+Core+for+Linux+SDK+Use+Cases
Please follow the instructions to setup the sample environment and do let us know if it works in your environment?
Also once verified, please perform needed changes into your original applications setup process and let us know if it works with your application as well or not ?
Thanks,
Kartikay
... View more