Code Monkey home page Code Monkey logo

tracingexample's Introduction

TracingExample

The aim of this repository, is to show how you can integrate distributaed tracing into your .NET based API app and worker service, using OpenTelemetry.

To collect tracing data, instead of directly sending data to Jager, an OTEL collector container is configured which then acts as a mediator to export trace data to Jager or whatever collector you would like to use.

In this way, when you configure exporter, you do not care about the type or protocol, because the OTEL collector will take care of it.

Structure of the solution

Tracing.Shared.TraceAndLong

This is a shared library that is responsible to configure logging and tracing. This way the tracing and logging is abstracted.

Tracing.Shared.Messages

Containt the message that will be send from API and be processed by worker service.

Tracing.WebAapi

It has a simple controller to use MassTransit send method and put the message in the queue.

Tracing.WorkerService

A configured MassTransit exist in the project to recieve all the messsages in the queue and process them.

How to see the traces

Open the http://localhost:16686/search in browser and find the service you want to see its traces. Click on "Find traces" and you dig deep into each trace. image

How to see logs

I could not find an easy to configure free log management tool, so I stick to Console Exporter, therefore you can see the logs by opening either "Tracing.WebAapi" or "Tracing.WorkerService" container, then navigate to "Logs" to see the logs. image

How to run

You need Visual Studio 2022 and Dokcer Desktop. After the solution loaded, run it using "Docker Compose" option.

An important note: I did not use MassTransit instrumention because the latest version (8) already has all the configuration, and you just need to call AddSource so the MAssTransit event can be traced. Read more : open-telemetry/opentelemetry-dotnet-contrib#326

tracingexample's People

Contributors

persiandeveloper avatar

Watchers

 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.