What’s new in Treblle 3.0: WSO2 Integration

Observability is key to optimizing APIs. With Treblle 3.0’s integration with WSO2 API Manager, you gain real-time insights and streamline workflows. This powerful pairing simplifies API tracking, enhances visibility, and helps you spot issues faster—taking your API performance to the next level.

2 minutes ago   •   8 min read

By Rahul Khinchi
Table of contents

Introduction

If you've worked with APIs at any level, you know how important it is to understand what's happening under the hood. 

Observability is a lifeline for debugging, monitoring, and improving APIs. 

With Treblle 3.0, we’ve taken a significant step forward by introducing integration support for WSO2, one of the most popular API gateways. 

What is WSO2?

WSO2 API Manager is an open-source API gateway that’s widely used in enterprises for creating, publishing, and managing APIs. It supports the entire API lifecycle and integrates well with existing enterprise systems.

 If your organization uses WSO2, you’re likely already aware of its robust API governance features and capability to scale with your needs. However, while WSO2 excels at API management, it doesn’t natively offer the level of observability that modern developers demand.

What Does WSO2 Integration with Treblle Mean?

What’s especially exciting about this integration is how easy it is to get started. Treblle now supports WSO2 API Manager versions 3.2.0 and 4.3.0, so you can adopt it using an older or latest setup. Within minutes, you can start collecting insights about your APIs, which might take days or weeks to configure manually.

How Will This Integration Optimize Your API Gateway?

The core value here is simplicity and visibility. With this integration, you can:

  • Monitor Requests in Real Time: The Treblle dashboard lets you see every request and response in detail, including headers, payloads, and execution times.
  • Detect Problems Faster: Spot misconfigured endpoints, missing parameters, or failing requests without sifting through server logs.
  • Improve API Compliance: Treblle checks your APIs against best practices, highlighting areas where you might fall short, like missing documentation or improper status codes.
  • Customize Insights: You control what data you track, ensuring it’s relevant to your team without adding unnecessary noise.
  • API Governance and Security: With Treblle's built-in governance and security features, you can enforce API policies, ensure compliance, and protect sensitive data. 

This means developers no longer rely solely on WSO2 logs or third-party tools that require complex setups.

Step-by-Step Guide: WSO2 Integration with Treblle 3.0

Prerequisites

Before beginning, make sure you have the following:

  1. Java 8 or later (check with java -version).
  2. Maven 3.6.0 or later (check with mvn -version).

Step 1: Installing WSO2 API Manager 

WSO2 API Manager homepage
  1. Download the latest version of WSO2 API Manager 4.3.0 from here.
  2. After downloading, unzip the archive to your desired directory.
unzip wso2am-4.3.0.zip
cd /path/wso2am-4.3.0/bin/
./api-manager.sh
  1. Once the server runs, open your web browser and go to the Admin Console.

Login with the default credentials:

  • URL: https://localhost:9443/carbon
  • Username: admin
  • Password: admin

This will log you into the WSO2 Admin Console, where you can manage your APIs.

Step 2: Create a New API in the WSO2 API Manager

Log in to the WSO2 Publisher Portal

  • Go to the Publisher portal at: https://localhost:9443/publisher
  • Log in using the following credentials:
  1. Username: admin
  2. Password: admin
Getting started with WSO2 API manager

Create a New API

  • Choose the type of API you want to create (e.g., REST API, SOAP API).
  • You can create an API from scratch, import your OpenAPI specification, or use a sample API.

Fill in the API details, such as:

  • API Name
  • Context Path
  • Version
  • Endpoint URL
Fill in the API details inside the WSO2 API manager

Publish the API

  • Once your API is created, click Publish to make it available for testing.
Publishing your API in WSO2 API manager

Step 3: Test the API

  • Log in to the Developer Portal at https://localhost:9443/devportal
  • Once logged in, you will see the published API listed.
View of your API published and listed inside WSO2 API manager
  • Click on the API, then navigate to the Subscription section.
Navigate to Subscription section
  • Subscribe to the API, and use the Subscription and Key Generation Wizard to generate an access token.
Use Key Generation Wizard to generate an access token
  • Provide details like application name, description, and shared quota.
  • Generate and copy the access token.
Provide details and generate the access token

Define API Resources

  • Go to the Resources section in the Publisher.
Resource section in the Publisher section
  • Define endpoints for your API, such as /users, and specify the method type (e.g., GET, POST), parameter names, data types, and whether the parameters are required.
Define endpoints for your API
  • Once the API Resources are created, click the Try Out option to test your API.
Testing your API
  • In the "Try Out" section, select the key type. Here, we are choosing Sandbox to test the API within the platform itself. If you’re ready to use the API in production, you can select Production.
Selecting the Key type for API testing
  • Select the method you want to test (e.g., GET) and execute the request.
Selecting the testing method
  • Example: API is working.
Example of working API

Step 4: Set Up Treblle

Treblle allows you to track and analyze API requests and responses directly. Here's how to integrate Treblle with your WSO2 API Manager:

Create a New Project in Treblle

  • Visit Treblle's website and sign up for a new account if you haven't already.
  • After logging in, create a new project. Enter details like:
    • API Name
    • Base URL
    • Environment
    • Platform
Adding details for your API in Treblle
  • Your API Key and Project ID will be generated, which you will need to integrate with WSO2.
Treblle SDK and API ID

Install and Configure the Treblle Data Publisher Extension for the WSO2 API Manager

To install and configure the Treblle Data Publisher extension, follow these steps:

Clone the Treblle Data Publisher Repository:

git clone https://github.com/Treblle/treblle-wso2.git
cd /path/treblle-wso2/wso2am-4.3.0

Build the Source Code:

  • Open a terminal and navigate to the project's root directory (where the pom.xml file is located).
  • Run the following Maven command to build the project:
mvn clean install
  • This will generate the necessary .jar file for the Treblle Data Publisher extension.

Install the Built JAR in the WSO2 API Manager

  • After building the project, find the generated JAR file in the target directory of your project folder (e.g., treblle-wso2/wso2am-4.3.0/target/treblle-data-publisher-*.jar).
  • Copy this .jar file into the following directory of your WSO2 API Manager:
cp treblle-data-publisher-*.jar /path/wso2am-4.3.0/repository/components/lib

Configure deployment.toml:

  • Open the deployment.toml file located at:
/path/wso2am-4.3.0/repository/conf/deployment.toml
  • Add the following configuration at the top of the file:
[synapse_handlers.treblle_publisher]
enabled=true
class="com.treblle.wso2publisher.handlers.APILogHandler"

Configure log4j2.properties:

  • Open the log4j2.properties file located at:
/path/wso2am-4.3.0/repository/conf/log4j2.properties
  • Add the following configuration to enable logging for the Treblle publisher:
loggers = treblle_publisher, AUDIT_LOG, ...
logger.treblle_publisher.name = com.treblle.wso2publisher
logger.treblle_publisher.level = INFO
logger.treblle_publisher.appenderRef.CARBON_LOGFILE.ref = CARBON_LOGFILE

Set Environment Variables

Before starting the WSO2 server, set the required environment variables on your machine:

  • Open a terminal and add the following environment variables:
export TREBLLE_API_KEY=<your-api-key>
export TREBLLE_PROJECT_ID=<your-project-id>
export TREBLLE_GATEWAY_URL="https://your-wso2-gateway-url"
export TREBLLE_QUEUE_SIZE=20000
export TREBLLE_WORKER_THREADS=1
export ADDITIONAL_MASK_KEYWORDS="testkey,Authorization,token"
export TREBLLE_ENABLED_TENANT_DOMAINS="carbon.super,abc.com"
  • Alternatively, set these variables in your .bash_profile or .bashrc to make them persistent across sessions.

Step 4. Configure OAuth2 Authentication

  • Log in to the Developer Portal: https://localhost:9443/devportal
  • Select the API for which you need the token.
  • Generate an OAuth2 token by clicking on your created application under the Subscription section and selecting Production or Sandbox.
Generating OAuth2 token
  • Select the Key: Click the Production.
  • Copy the generated access token.
Copy the generated token

Step 5. Test Your API

Restart the WSO2 API Manager to ensure all configurations and the Treblle Data Publisher extension are loaded:

cd /path/to/wso2am-4.3.0/bin
./api-manager.sh restart

Using cURL:

curl -k -X GET "https://localhost:8243/<>/version" -H "Authorization: Bearer <access_token>"

Replace <access_token> with a valid OAuth2 token.

Example:

Example of replacing access token with a valid OAuth2 token

API Observability in Treblle

The Treblle dashboard provides real-time insights into API requests, compliance checks, and potential issues in your APIs. 

Treblle dashboard with real-time insights

Use Treblle's customization features from TOP RIGHT to tailor the displayed information to your needs.

Trebble customization features

This section shows a detailed list of API requests, including key data like request origins, execution time, and status.

Detailed list of API requests

Click on a specific API request to view comprehensive details, such as the request payload, response data, and additional diagnostics.

Click on a specific API request to view details

Conclusion

Integrating Treblle and WSO2 API Manager makes tracking and monitoring your APIs much easier. It lets you see what’s happening with your API requests and responses in real-time.

Treblle helps you spot issues immediately, giving you a clear picture of what’s working and where attention needs to be given. 

What stands out the most is how much time it saves. Instead of sifting through data manually, Treblle gives you the key insights you need right on the dashboard. 

Stay tuned for more updates as we continue building tools to make your API development journey smoother, faster, and more transparent.

💡
Ready to elevate your API observability with Treblle and WSO2? Get started today and see how easy it is to gain real-time insights and optimize your API performance!

Spread the word

Keep reading