pub struct Treblle { /* private fields */ }

Implementations

Create the middleware and wrap your application with it.

HttpServer::new(|| {
    App::new()
        .wrap(actix_treblle::Treblle::new("project_id".to_string(), "api_key".to_string()))
        .route("/hello", web::get().to(|| async { "Hello World!" }))
})
.bind(("127.0.0.1", 8080))?
.run()
.await

Turn on the debug mode

WARNING: Turning this option ON can slow down your requests by 10 fold sometimes because we are waiting for the response from Treblle.com.

HttpServer::new(|| {
    App::new()
        .wrap(
            actix_treblle::Treblle::new("project_id".to_string(), "api_key".to_string())
               .debug()
        )
        .route("/hello", web::get().to(|| async { "Hello World!" }))
})
.bind(("127.0.0.1", 8080))?
.run()
.await

If you don’t wish to have default masking fields, or simply want to remove the default ones use this method when wrapping your application with this middleware.

HttpServer::new(|| {
    App::new()
        .wrap(
            actix_treblle::Treblle::new("project_id".to_string(), "api_key".to_string())
               .clear_masking_fields()
        )
        .route("/hello", web::get().to(|| async { "Hello World!" }))
})
.bind(("127.0.0.1", 8080))?
.run()
.await

Set masking fields that will be masked before the request leaves your application

Default masking fields:

  • “password”
  • “pwd”
  • “secret”
  • “password_confirmation”
  • “passwordConfirmation”
  • “cc”
  • “card_number”
  • “cardNumber”
  • “ccv”
  • “ssn”
  • “credit_score”
  • “creditScore”
HttpServer::new(|| {
    App::new()
        .wrap(
            actix_treblle::Treblle::new("project_id".to_string(), "api_key".to_string())
               .add_masking_fields(vec![
                   "password".to_string(),
                   "ssl_key".to_string(),
                   "cookie".to_string(),
                   "csrf".to_string(),
               ])
        )
        .route("/hello", web::get().to(|| async { "Hello World!" }))
})
.bind(("127.0.0.1", 8080))?
.run()
.await

Add routes that will be ignored for logging

Add a vector of route matching patterns, same as you would define them in your application.

HttpServer::new(|| {
    App::new()
        .wrap(
            actix_treblle::Treblle::new("project_id".to_string(), "api_key".to_string())
               .add_ignored_routes(vec![
                   "/users/{user_id}".to_string(),
                   "/users/{user_id}/change-password".to_string(),
               ])
        )
        .route("/hello", web::get().to(|| async { "Hello World!" }))
})
.bind(("127.0.0.1", 8080))?
.run()
.await

Trait Implementations

Responses produced by the service.

Errors produced by the service.

The TransformService value created by this factory

Errors produced while building a transform service.

The future response value.

Creates and returns a new Transform component, asynchronously

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more