Code Monkey home page Code Monkey logo

azureservicefabric-dotnet-tracing-sample's Introduction

languages products page_type description
csharp
azure
azure-service-fabric
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.

NOTE: This document is outdated. The recommended way to deploy the tracer in Service Fabric is with the Datadog.Trace.Bundle NuGet package.

Service 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

Create a Service Fabric project

Start with a stateless ASP.NET Core application, and use MVC as a template.

Create a stateleess ASP.NET Core application

Setting up the Datadog Agent

Add a new Service Fabric Service to the solution.

Add new Service Fabric Service

Setup the agent container

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.

Copy to output directory

The latest representation of this install process is here: https://github.com/DataDog/dd-trace-dotnet-asf-sample/tree/master/VotingWeb


azureservicefabric-dotnet-tracing-sample's People

Contributors

colin-higgins avatar lucaspimentel avatar rossdotpink avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.