Skip to content
Honeycomb.io client library for .NET
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Sample Moved to V1 and moved to netstandard2.0 Jun 10, 2019
docs Added index page for docs Jun 10, 2019
src Moved to V1 and moved to netstandard2.0 Jun 10, 2019
test/Honeycomb.Tests #4 Added AssemblyVersion and UserAgent Headers Feb 27, 2019
.gitignore Initial Commit Feb 6, 2019
README.md Fix method usage Feb 27, 2019
_config.yml Set theme jekyll-theme-minimal May 27, 2019

README.md

Honeycomb dotnet implementation

ASP.NET Core

Services Registration

    using Honeycomb.AspNetCore.Middleware;
    ...

    public void ConfigureServices(IServiceCollection services)
    {
    ...
        services.AddHoneycomb(Configuration);
    ...
    }

Middleware

Note the relative position to app.UseMvc()

    using Honeycomb.AspNetCore.Middleware;
    ...

    public void Configure(IApplicationBuilder app, IHostingEnvironment env)
    {
        ...
        app.UseHoneycomb();

        app.UseMvc();
        ...
    }

Configuration

Configuration can either be done through adding this to your appSettings.json

{
  "HoneycombSettings": {
    "TeamId": "blah",
    "DefaultDataSet": "MyTestDataSet",
    "BatchSize": 100,
    "SendFrequency": 10000
  }
}

Or alternatively, you can create an instance of HoneycombApiSettings and pass it directly to the Service registration:

    using Honeycomb.Models;
    ...

    services.AddHoneycomb(new HoneycombApiSettings {
        TeamId = "blah",
        DefaultDataSet = "MyTestDataSet"
        BatchSize = 100,
        SendFrequency = 10000,
    });

Usage

    public class HomeController : Controller
    {
        private readonly IHoneycombEventManager _eventManager;

        public HomeController(IHoneycombEventManager eventManager)
        {
            _eventManager = eventManager;
        }

        ...

        public IActionResult MyAction()
        {
            var stopWatch = new Stopwatch();
            stopWatch.Start();
            ...
            result = GetDataFromAPI();
            ...
            stopWatch.Stop();
            _eventManager.AddData("api_response_ms", stopWatch.ElapsedMilliseconds);

            return result;
        }
    }
You can’t perform that action at this time.