Git Product home page Git Product logo

autofac.diagnostics.dotgraph's Introduction

Autofac.Diagnostics.DotGraph

Autofac diagnostics support to enable DOT graph visualization of resolve requests.

Build status

Please file issues and pull requests for this package in this repository rather than in the Autofac core repo.

Quick Start

After building your container, attach the Autofac.Diagnostics.DotGraph.DotDiagnosticTracer to the container. When every resolve operation completes (success or failure) you'll get a trace. It's up to you to determine what to do with that trace - write it to a file, render it to an image, etc.

// Build a container with some registrations.
var containerBuilder = new ContainerBuilder();
containerBuilder.Register(ctx => "Hello");
var container = containerBuilder.Build();

// Attach a DotDiagnosticTracer to the container.
// Handle the OperationCompleted event to deal
// with the trace output.
var tracer = new DotDiagnosticTracer();
tracer.OperationCompleted += (sender, args) =>
{
  using var file = File.OpenWrite(Guid.NewGuid().ToString() + ".dot");
  using var writer = new StreamWriter(file);
  writer.WriteLine(args.TraceContent);
};
container.SubscribeToDiagnostics(tracer);

// Resolve some things and look at the graphs!
// You can use graphviz to render a PNG like:
// dot -T png -O filename.dot
using var scope = container.BeginLifetimeScope();
scope.Resolve<string>();

Tracing graphs is expensive! Getting a graph trace is convenient but does have a performance and memory/resource impact. It's recommended you only enable this in a development/troubleshooting situation.

Get Help

Need help with Autofac? We have a documentation site as well as API documentation. We're ready to answer your questions on Stack Overflow or check out the discussion forum.

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.