DEV Community

Vedran Cindrić for Treblle

Posted on • Originally published at blog.treblle.com on

What’s new in Treblle 3.0: WSO2 Integration

Introduction

What’s new in Treblle 3.0: WSO2 Integration

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

What’s new in Treblle 3.0: WSO2 Integration
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
Enter fullscreen mode Exit fullscreen mode
  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

What’s new in Treblle 3.0: WSO2 Integration
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

What’s new in Treblle 3.0: WSO2 Integration
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.

What’s new in Treblle 3.0: WSO2 Integration
Publishing your API in WSO2 API manager

Step 3: Test the API

What’s new in Treblle 3.0: WSO2 Integration
View of your API published and listed inside WSO2 API manager

  • Click on the API, then navigate to the Subscription section.

What’s new in Treblle 3.0: WSO2 Integration
Navigate to Subscription section

  • Subscribe to the API, and use the Subscription and Key Generation Wizard to generate an access token.

What’s new in Treblle 3.0: WSO2 Integration
Use Key Generation Wizard to generate an access token

  • Provide details like application name, description, and shared quota.
  • Generate and copy the access token.

What’s new in Treblle 3.0: WSO2 Integration
Provide details and generate the access token

Define API Resources

  • Go to the Resources section in the Publisher.

What’s new in Treblle 3.0: WSO2 Integration
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.

What’s new in Treblle 3.0: WSO2 Integration
Define endpoints for your API

  • Once the API Resources are created, click the Try Out option to test your API.

What’s new in Treblle 3.0: WSO2 Integration
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.

What’s new in Treblle 3.0: WSO2 Integration
Selecting the Key type for API testing

  • Select the method you want to test (e.g., GET) and execute the request.

What’s new in Treblle 3.0: WSO2 Integration
Selecting the testing method

  • Example: API is working.

What’s new in Treblle 3.0: WSO2 Integration
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

What’s new in Treblle 3.0: WSO2 Integration
Adding details for your API in Treblle

  • Your API Key and Project ID will be generated, which you will need to integrate with WSO2.

What’s new in Treblle 3.0: WSO2 Integration
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

Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode
  • 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
Enter fullscreen mode Exit fullscreen mode

Configure deployment.toml:

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

Configure log4j2.properties:

  • Open the log4j2.properties file located at:
/path/wso2am-4.3.0/repository/conf/log4j2.properties
Enter fullscreen mode Exit fullscreen mode
  • 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
Enter fullscreen mode Exit fullscreen mode

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"
Enter fullscreen mode Exit fullscreen mode
  • 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.

What’s new in Treblle 3.0: WSO2 Integration
Generating OAuth2 token

  • Select the Key: Click the Production.
  • Copy the generated access token.

What’s new in Treblle 3.0: WSO2 Integration
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
Enter fullscreen mode Exit fullscreen mode

Using cURL:

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

Replace <access_token> with a valid OAuth2 token.

Example:

What’s new in Treblle 3.0: WSO2 Integration
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.

What’s new in Treblle 3.0: WSO2 Integration
Treblle dashboard with real-time insights

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

What’s new in Treblle 3.0: WSO2 Integration
Trebble customization features

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

What’s new in Treblle 3.0: WSO2 Integration
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.

What’s new in Treblle 3.0: WSO2 Integration
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.

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more