Skip to content

The official Treblle SDK for .NET. Seamlessly integrate Treblle to manage communication with your dashboard, send errors, and secure sensitive data.

Notifications You must be signed in to change notification settings

Treblle/treblle-net

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Treblle .NET SDK

Treblle API Intelligence

WebsiteDocumentationPricing

Treblle is an API intelligence platform that helps developers, teams and organizations understand their APIs from a single integration point.


Table of Contents


Requirements

  • .NET Framework 4.6.2 or higher
  • ASP.NET Web API 5.2.7+ (for Web API support)
  • WCF / System.ServiceModel (for WCF support)
  • Newtonsoft.Json 13.0.3+

Installation

Via NuGet Package Manager Console

Install-Package Treblle.Net

Via .NET CLI

dotnet add package Treblle.Net

Via NuGet Package Manager UI

  1. Right-click on your project in Solution Explorer
  2. Select "Manage NuGet Packages"
  3. Search for "Treblle.Net"
  4. Click "Install"

During installation, you'll be prompted to enter your API Key and Project ID. You can find these in your Treblle Dashboard.


Quick Start

ASP.NET Web API

Add the [Treblle] attribute to track API controllers or methods:

Track entire controller:

using Treblle.Net;

[Treblle]
public class ProductsController : ApiController
{
    public IHttpActionResult Get()
    {
        var products = _productService.GetAll();
        return Ok(products);
    }

    public IHttpActionResult Get(int id)
    {
        var product = _productService.GetById(id);
        return Ok(product);
    }
}

Track specific methods:

public class OrdersController : ApiController
{
    [Treblle]
    public IHttpActionResult Get(int id)
    {
        // This endpoint is tracked
        return Ok(_orderService.GetById(id));
    }

    public IHttpActionResult GetInternal(int id)
    {
        // This endpoint is NOT tracked
        return Ok(_orderService.GetInternalOrder(id));
    }
}

WCF Services

Add the [TreblleBehavior] attribute to track WCF service operations:

Track entire service:

using Treblle.Net;

[TreblleBehavior]
public class UserService : IUserService
{
    // All operations are tracked
    public UserResponse GetUser(int id)
    {
        return _repository.GetUser(id);
    }

    public async Task<UserResponse> CreateUserAsync(UserRequest request)
    {
        return await _repository.CreateAsync(request);
    }
}

Track specific operations:

public class UserService : IUserService
{
    [TreblleBehavior]
    public UserResponse GetUser(int id)
    {
        // This operation is tracked
        return _repository.GetUser(id);
    }

    public UserResponse GetInternalUser(int id)
    {
        // This operation is NOT tracked
        return _repository.GetInternalUser(id);
    }
}

WCF Web.config example:

<system.serviceModel>
  <services>
    <service name="YourNamespace.UserService">
      <endpoint address=""
                binding="basicHttpBinding"
                contract="YourNamespace.IUserService" />
    </service>
  </services>
  <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
</system.serviceModel>

Note: The SDK supports both synchronous and asynchronous WCF operations, including Task-based async methods.


Configuration

The SDK requires two configuration values in your Web.config or app.config:

<configuration>
  <appSettings>
    <add key="TreblleApiKey" value="{Your_API_Key}" />
    <add key="TreblleProjectId" value="{Your_Project_Id}" />
  </appSettings>
</configuration>

Get your credentials: Visit your Treblle Dashboard → Select your project → Copy API Key and Project ID

Additional Field Masking

To mask additional fields beyond the defaults, add them as a comma-separated list:

<configuration>
  <appSettings>
    <add key="TreblleApiKey" value="{Your_API_Key}" />
    <add key="TreblleProjectId" value="{Your_Project_Id}" />
    <add key="AdditionalFieldsToMask" value="customSecret,internalId,apiToken" />
  </appSettings>
</configuration>

Data Masking

The SDK automatically masks sensitive fields before sending data to Treblle. This happens on your server before any data leaves your infrastructure.

Default Masked Fields

The following fields are automatically masked with *****:

  • password, pwd
  • secret
  • password_confirmation, passwordConfirmation
  • cc, card_number, cardNumber, ccv
  • ssn
  • credit_score, creditScore
  • email
  • account.*
  • user.email, user.dob, user.password, user.ss
  • user.payments.cc

Masking Strategies

Different field types use different masking strategies:

  • Passwords/Secrets: Completely replaced with *****
  • Credit Cards: Partially masked (e.g., ****-****-****-1234)
  • Emails: Partially masked (e.g., j***@example.com)
  • SSN: Partially masked (e.g., ***-**-1234)

Support

If you have problems of any kind feel free to reach out:


License

Copyright 2025, Treblle Inc. Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php

About

The official Treblle SDK for .NET. Seamlessly integrate Treblle to manage communication with your dashboard, send errors, and secure sensitive data.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 8