Not a customer? Click the 'Start a free trial' link to begin a 30-day SaaS trial of our product and to join our community.
Existing Cisco AppDynamics customers should click the 'Sign In' button to authenticate to access the community
09-13-2018 02:52 PM
I am running into an issue when working with the .NET Core Microservices Agent for Windows agent. I have a sample webapi that I wrote that just has a couple of basic controllers in it. I am trying to follow the instructions listed in the below URL.
https://docs.appdynamics.com/display/PRO45/Install+the+.NET+Core+Microservices+Agent+for+Windows
I am able to install the nuget package identified, I was able to configure the config file and I can launch the application and see it added to the AppD dashboard. What I cannot do is add the reference "using AppDynamics" to any of my classes so that I can define a business transaction in my controllers. When I try to add it, intellisense cannot find the package and if I add it manually, I get a "missing namespace" error when I try to build the project.
Am I missing something in the setup? I know it is at least partially setup correctly or else I would not be able to the app in the Applications list on the website. Any guidance would be appreciated.
Thanks,
09-13-2018 09:37 PM
You don't have to manually add reference. I do not that mentioned as part of the documentation.
Just make sure to set Copy Always to True for each of the Agent files/dlls and then just publish your application after creating necessary environment variables. BTs will get identified OOTB.
On Windows, we support fully functional Agent. On Linux, we offer an SDK for now.
Thanks,
Raunak
09-14-2018 06:22 AM
09-14-2018 06:52 AM
09-17-2018 02:26 AM
Hi Robert,
The container itself is Windows or Linux ? I am talking about the actual container host on which application is hosted.
Thanks,
Raunak
09-17-2018 07:41 AM
Raunak,
Thanks for the response. This is an interesting scenario. I am developing on Windows but will be deploying into Microsoft's Ubuntu Linux container. I have been able to get the Windows Agent to work when running locally, not in a container, after making some adjustments to the configuration. I mostly wanted to verify that I can connect to the controller and that the settings were right. I then switched over to using the Linux SDK in the MS Linux Docker container. It was not working at all and there were no logs to tell me what was going on. So I took a step back and moved my code to an Ubuntu server and was trying to build the code there. I followed the instructions that I can see online (https://docs.appdynamics.com/display/PRO45/.NET+Core+for+Linux+SDK) for the linux SDK. At the bottong of that page there is a screenshot for adding the code to start and stop a business transaction though when I try to replicate that the "using" statement cannot find the namespace "AppDynamics". When I tried to build it fails. So I assumed that maybe it is like the Windows Agent plugin and does not need the transaction references, so I removed them.
Now when I build the project it builds without issues. When I try to run the project, on the other hand, it failed. I am getting the error
An assembly i the application dependencies manifest {project name} was not found: package: 'AppDynamics.AgentSDK', version: '4.5.1' path: 'lib/netstandard2.0/AppDynamics.Agent.SDK.dll'
Per the instructions, I copied the sdk files to a folder in the project, instead of mapping to the nuget location, called packages(./packages/appdynamics.agentsdk/4.5.1/....). I made sure that there was a reference in the csproj file to copy the sdk folders to the build location and I can verify that the path exists when the build process runs. The project builds fine and the files are copied to the build folder, but when I try to launch the project I get the previously mentioned error.
My next step was going to be moving the SDK folders down a few levels so that the lib and runtime folders are at the root of the project. Though I have not tried that yet.
Any advice would be welcome. If there is a sample project that you all have that shows how the project should be layed out and build and runs fine I would love to use that as a template.
09-17-2018 08:02 AM
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
09-17-2018 10:48 AM
09-17-2018 02:19 PM
Kartikay,
I tried to continue on with the instructions skipping step 4 (since it is not working). I am guessing that the instructionsare out of date since they reference the previous version of .net core (2.0 instead of 2.1) as well as the previous version of the sdk API (4.5.0 v 4.5.1). I also had to change a couple of items in the project file because by default it was using the URLs defined in the launchSettings.json file which does a redirect from port 5000 to 5001 and this was causing an issue with the exposed port in Docker (which was set to 5000 per the instructions).
After making all those changes, I was able to get the project to build and run in Docker, though the profiler still does not work. When I comment out the "ENTRYPOINT" command in the docker file and run the image in interactive mode and then build the solution I get the following warning messages from the build.
profiler(Warn): Failed to locate config file from
profiler(Warn): Failed to load configuration, profiler will not attach.
profiler(Warn): Failed to locate config file from
profiler(Warn): Failed to load configuration, profiler will not attach.
I verified that the nuget package existed in the docker image, and after updating the path to 4.5.1 that the path to the libappdprofiler.so file was correct. I also verified that the AppDynamicsConfig.json file with the correct settings was in the root of the project files (/app) and that it gets copied correctly to the build folder (though with a new name of MvcApp.AppDynamicsConfig.json in the /app/bin/Debug/netcoreapp2.1 folder).
I added a copy of the project to a public repo that I own (though I removed our controller connection details).
10-24-2018 01:45 PM
Thanks, this was very helpfull and I suggest you to update the official documentation with this guide. It is much better than the original one.
I still have an issue: since my application is running in containers, I have multiple instances of it. This means that I can't simply apply a fixed node-name, it needs to vary according to the container instance so it will be properly visible at appDynamics dashboards.
Any suggestions on how to do that?
Thanks,
Gabriel
Thank you! Your submission has been received!
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form