Giter Site home page Giter Site logo

whilke / pyroscope-dotnet Goto Github PK

View Code? Open in Web Editor NEW

This project forked from grafana/pyroscope-dotnet

0.0 0.0 0.0 72.17 MB

Dotnet profiler

License: Apache License 2.0

Shell 0.28% JavaScript 1.33% C++ 24.17% Perl 0.10% C 5.74% Objective-C 0.01% C# 67.68% Assembly 0.01% PowerShell 0.07% Logos 0.02% CSS 0.02% Pawn 0.03% HTML 0.17% CMake 0.16% Batchfile 0.03% Dockerfile 0.10% TSQL 0.06% Visual Basic .NET 0.01% ASP.NET 0.02%

pyroscope-dotnet's Introduction

Pyroscope .NET Agent

The Java profiling agent for Pyroscope.io. Based on dd-trace-dotnet with some key improvements:

  • support for memory profiling
  • support for wall (wall-clock) time profiling
  • support for exceptions profiling
  • support for dynamic tags

Supported .NET versions:

  • .NET 6.0

Supported platforms

Spy Name Type Linux macOS Windows Docker
dotnetspy embedded โœ…

Running the .NET profiler

  1. Download Pyroscope.Profiler.Native.so and Pyroscope.Linux.ApiWrapper.x64.so from latest release

  2. Set the following required environment variables to enable profiler

PYROSCOPE_APPLICATION_NAME=rideshare.dotnet.app
PYROSCOPE_SERVER_ADDRESS=http://localhost:4040
PYROSCOPE_AUTH_TOKEN="psx-..." # optional auth token
PYROSCOPE_PROFILING_ENABLED=1
CORECLR_ENABLE_PROFILING=1
CORECLR_PROFILER={BD1A650D-AC5D-4896-B64F-D6FA25D6B26A}
CORECLR_PROFILER_PATH=Pyroscope.Profiler.Native.so
LD_PRELOAD=Pyroscope.Linux.ApiWrapper.x64.so

Dynamic labels

It is possible to add labels to the profiling data. These labels can be used to filter the data in the UI.

  1. Add dependency
dotnet add package Pyroscope
  1. Create a LabelSet and wrap a piece of code with Pyroscope.LabelsWrapper
var labels = Pyroscope.LabelSet.Empty.BuildUpon()
    .Add("key1", "value1")
    .Build();
Pyroscope.LabelsWrapper.Do(labels, () =>
{
  SlowCode();
});

Labels can be nested. For nesting LabelSets use LabelSet.BuildUpon on non-empty set.

var labels = Pyroscope.LabelSet.Empty.BuildUpon()
    .Add("key1", "value1")
    .Build();
Pyroscope.LabelsWrapper.Do(labels, () =>
{
  var labels2 = labels.BuildUpon()
    .Add("key2", "value2")
    .Build();
  Pyroscope.LabelsWrapper.Do(labels2, () =>
  {
    SlowCode();
  });
  FastCode();
});

Configuration

ENVIRONMENT VARIABLE Type DESCRIPTION
PYROSCOPE_PROFILING_LOG_DIR String Sets the directory for .NET Profiler logs. Defaults to /var/log/pyroscope/ .
PYROSCOPE_LABELS String Static labels to apply to an uploaded profile. Must be a list of key:value separated by commas such as: layer:api,team:intake.
PYROSCOPE_PROFILING_ENABLED Boolean If set to true, enables the .NET Profiler. Defaults to false.
PYROSCOPE_PROFILING_WALLTIME_ENABLED Boolean If set to false, disables the Wall time profiling. Defaults to true.
PYROSCOPE_PROFILING_CPU_ENABLED Boolean If set to false, disables the CPU profiling. Defaults to true.
PYROSCOPE_PROFILING_EXCEPTION_ENABLED Boolean If set to true, enables the Exceptions profiling (beta). Defaults to false.
PYROSCOPE_PROFILING_ALLOCATION_ENABLED Boolean If set to true, enables the Allocations profiling (beta). Defaults to false.
PYROSCOPE_PROFILING_LOCK_ENABLED Boolean If set to true, enables the Lock Contention profiling (beta). Defaults to false.

Copyright

Copyright (c) 2017 Datadog https://www.datadoghq.com

Copyright (c) 2022 Pyroscope

License

See license information.

Contact us

Security Vulnerabilities

If you have found a security issue, please contact the security team directly at [email protected].

pyroscope-dotnet's People

Contributors

andrewlock avatar lucaspimentel avatar kevingosse avatar tonyredondo avatar zacharycmontoya avatar colin-higgins avatar bmermet avatar gleocadie avatar pierotibou avatar robertpi avatar dd-caleb avatar github-actions[bot] avatar anna-git avatar chrisnas avatar shurivich avatar omerraviv avatar macrogreg avatar greenmatan avatar bobuva avatar bouwkast avatar korniltsev avatar dudikeleti avatar link04 avatar nachoechevarria avatar daniel-romano-dd avatar maxday avatar dependabot[bot] avatar petethepig avatar boydc7 avatar albertvaka 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.