Deploy the Package using Visual Studio

  1. From your editor, open ServiceManifest.xml in each folder in the published application root.
  2. Add the following environment variables in each CodePackage:
    <CodePackage ...>
      <EntryPoint>
        ...
      </EntryPoint>
      <EnvironmentVariables>
        <EnvironmentVariable Name="COR_ENABLE_PROFILING" Value="1" />
        <EnvironmentVariable Name="COR_PROFILER" Value="{39AEABC1-56A5-405F-B8E7-C3668490DB4A}" />
        <EnvironmentVariable Name="COR_PROFILER_PATH" Value="<PathToDeploymentFolder>/AppDynamics.Profiler_x64.dll" />
      </EnvironmentVariables>
    </CodePackage>
  3. Make a copy of the AppDynamicsConfig.json file and rename it to <executable_name>.AppDynamicsConfig.json.
    For example, <servicefabricapplicationname> .AppDynamicsConfig.json.
    Note: When you rename the .json file to the application name, do not include .exe at the end of your application name.
  4. Copy AppDynamics.Agent.dll, AppDynamics.Profiler_x64.dll, AppDynamicsAgentLog.config, AppDynamicsConfig.json from <nuget_package>\content\AppDynamics, then go to your Visual Studio solution "Solution Items" subfolder.
  5. Right-click on the Splunk AppDynamics related files and select Copy Always in Properties.
  6. Update <executable_name>.AppDynamicsConfig.json with your configuration information:
    Do not specify node; it will be assigned automatically; Specifying tier is optional, it could be assigned automatically.
    {
     "controller":
     {
     "host":"",
     "port":0,
     "account":"",
     "password":""
     },
     "application":
     {
     "name":""
     }
    }

The next steps are optional and should only be used if you need per service-instance control of the controller/application/tier.

  1. Add the following environment variables to each CodePackage:
    <EnvironmentVariable Name="appdynamics.controller.hostName" Value="< >" />
    <EnvironmentVariable Name="appdynamics.controller.port" Value="<  >" />
    <EnvironmentVariable Name="appdynamics.agent.accountName" Value="<  >" />
    <EnvironmentVariable Name="appdynamics.agent.accountAccessKey" Value="<  >" />
    <EnvironmentVariable Name="appdynamics.agent.applicationName" Value="<  >" />
    <EnvironmentVariable Name="appdynamics_agent_tier_name" Value="<  >" />
  2. Modify ApplicationManifest.xml.

    In each ServiceManifestImport and CodePackage folder add:

    • In ServiceManifestImport:
      <EnvironmentOverrides CodePackageRef="Code">
        <EnvironmentVariable Name="appdynamics.controller.hostName" Value="<AppD_ControllerHostName>" />
        <EnvironmentVariable Name="appdynamics.controller.port" Value="<AppD_ControllerPort>" />
        <EnvironmentVariable Name="appdynamics.agent.accountName" Value="<AppD_AccountName>" />
        <EnvironmentVariable Name="appdynamics.agent.accountAccessKey" Value="<AppD_AccountAccessKey>" />
        <EnvironmentVariable Name="appdynamics.agent.applicationName" Value="<AppD_ApplicationName>" />
        <EnvironmentVariable Name="appdynamics_agent_tier_name" Value="<AppD_Service_Name_TierName>" />
      </EnvironmentOverrides>
    • In Parameters:
      <Parameter Name="AppD_ControllerHostName" DefaultValue="<Your_Controller_Name>" />
      <Parameter Name="AppD_ControllerPort" DefaultValue="<Your_Controller_Port>" />
      <Parameter Name="AppD_AccountName" DefaultValue="<Your_Controller_Account_Name>" />
      <Parameter Name="AppD_AccountAccessKey" DefaultValue="<Your_Controller_Access_Key>" />
      <Parameter Name="AppD_ApplicationName" DefaultValue="<Your_Controller_App_Name>" />
    • For each service: <Parameter Name="AppD_%SERVICE_NAME%_TierName" DefaultValue="<Tier_Name_For_Service>" />
  3. If you need to provide the Splunk AppDynamics configuration during application package deployment, you can now do it using the -ApplicationParameter switch of the New-ServiceFabricApplication cmdlet.