languages | products | page_type | description | |||
---|---|---|---|---|---|---|
|
|
sample |
The quickstart contains an application with multiple services demonstrating the concepts of service communication and use of reliable dictionaries, in conjunction with Datadog installation. |
Datadog.Trace.Bundle NuGet package.
NOTE: This document is outdated. The recommended way to deploy the tracer in Service Fabric is with theService Fabric .NET Tracer Quickstart
This repository contains an quickstart project for Microsoft Azure Service Fabric. The quickstart project contains a single application with multiple services demonstrating the basic concepts of service communication and use of reliable dictionaries.
For a guided tour with the quickstart: Service Fabric .NET quickstart
More info on Service Fabric:
This guide does not include how-to on setting up and configuring an Azure Service Fabric Cluster.
Create a Service Fabric application
Start with a stateless ASP.NET Core application, and use MVC as a template.
Setting up the Datadog Agent
Add a new Service Fabric Service to the solution.
Replace the ServiceManifest.xml
with this:
<?xml version="1.0" encoding="utf-8"?>
<ServiceManifest Name="DatadogAgentPkg" Version="1.0.0" xmlns="http://schemas.microsoft.com/2011/01/fabric" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ServiceTypes>
<StatelessServiceType ServiceTypeName="DatadogAgentType" UseImplicitHost="true" />
</ServiceTypes>
<CodePackage Name="Code" Version="1.0.0">
<EntryPoint>
<ContainerHost>
<ImageName>datadog/agent</ImageName>
</ContainerHost>
</EntryPoint>
<EnvironmentVariables>
<EnvironmentVariable Name="DD_API_KEY" Value="API_KEY_GOES_HERE"/>
<EnvironmentVariable Name="DD_ENV" Value="apm-reliability-testing"/>
<EnvironmentVariable Name="DD_APM_ENABLED" Value="true"/>
<EnvironmentVariable Name="DD_APM_NON_LOCAL_TRAFFIC" Value="true"/>
<EnvironmentVariable Name="DD_DOGSTATSD_NON_LOCAL_TRAFFIC" Value="true"/>
<EnvironmentVariable Name="DD_HEALTH_PORT" Value="5002"/>
</EnvironmentVariables>
</CodePackage>
<ConfigPackage Name="Config" Version="1.0.0" />
<Resources>
<Endpoints>
<Endpoint Name="DatadogTypeEndpoint" UriScheme="http" Port="5002" Protocol="http"/>
<Endpoint Name="DatadogTraceEndpoint" UriScheme="http" Port="8126" Protocol="http"/>
<Endpoint Name="DatadogStatsEndpoint" UriScheme="udp" Port="8125" Protocol="udp"/>
</Endpoints>
</Resources>
</ServiceManifest>
Add the corresponding port bindings to the ServiceManfestImport
section in ApplicationManifest.xml
:
<ServiceManifestImport>
<ServiceManifestRef ServiceManifestName="DatadogAgentPkg" ServiceManifestVersion="1.0.0" />
<ConfigOverrides />
<Policies>
<ContainerHostPolicies CodePackageRef="Code">
<PortBinding ContainerPort="5002" EndpointRef="DatadogTypeEndpoint" />
<PortBinding ContainerPort="8126" EndpointRef="DatadogTraceEndpoint" />
<PortBinding ContainerPort="8125" EndpointRef="DatadogStatsEndpoint" />
</ContainerHostPolicies>
</Policies>
</ServiceManifestImport>
Installing the .NET Tracer
Installing the tracer requires machine administrator permissions.
Add the SetupAdminUser
to the Principals
section in ApplicationManifest.xml
. If the Principals
section is missing, add it.
<Principals>
<Users>
<User Name="SetupAdminUser">
<MemberOf>
<SystemGroup Name="Administrators" />
</MemberOf>
</User>
</Users>
</Principals>
In the ServiceManifestImport
section of the service responsible for deploying the tracer to the cluster, set SetupAdminUser
as the executing user for the Setup
script.
<ServiceManifestImport>
<ServiceManifestRef ServiceManifestName="ServiceThatDeploysDatadogTracerPkg" ServiceManifestVersion="1.0.0" />
<ConfigOverrides />
<Policies>
<RunAsPolicy CodePackageRef="Code" UserRef="SetupAdminUser" EntryPointType="Setup" />
</Policies>
</ServiceManifestImport>
In the ServiceManifest.xml
of the service responsible for deploying the tracer, add the reference to the install script:
<CodePackage Name="Code" Version="1.0.0">
<SetupEntryPoint>
<ExeHost>
<Program>DatadogInstall.bat</Program>
<WorkingFolder>CodePackage</WorkingFolder>
</ExeHost>
</SetupEntryPoint>
<EntryPoint>
<ExeHost>
<Program>ServiceThatDeploysDatadogTracer.exe</Program>
<WorkingFolder>CodePackage</WorkingFolder>
</ExeHost>
</EntryPoint>
</CodePackage>
Include the DatadogInstall.bat
and DatadogInstall.ps1
scripts in the project responsible for deploying the tracer.
In the file properties of both scripts, set them to be copied to the output directory.
The latest representation of this install process is here: https://github.com/DataDog/dd-trace-dotnet-asf-sample/tree/master/VotingWeb