{"id":31592603,"url":"https://github.com/treblle/treblle-apigee","last_synced_at":"2026-08-07T19:02:26.884Z","repository":{"id":317159137,"uuid":"1061096898","full_name":"Treblle/treblle-apigee","owner":"Treblle","description":"Apigee SDK for Treblle API Intelligence Platform","archived":false,"fork":false,"pushed_at":"2025-10-02T04:44:37.000Z","size":47,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-09T19:52:43.259Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Treblle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-21T08:26:29.000Z","updated_at":"2025-09-29T07:29:19.000Z","dependencies_parsed_at":"2025-09-29T09:22:38.431Z","dependency_job_id":null,"html_url":"https://github.com/Treblle/treblle-apigee","commit_stats":null,"previous_names":["treblle/treblle-apigee"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Treblle/treblle-apigee","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Treblle%2Ftreblle-apigee","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Treblle%2Ftreblle-apigee/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Treblle%2Ftreblle-apigee/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Treblle%2Ftreblle-apigee/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Treblle","download_url":"https://codeload.github.com/Treblle/treblle-apigee/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Treblle%2Ftreblle-apigee/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":36388248,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-08-06T04:43:03.162Z","status":"online","status_checked_at":"2026-08-07T02:00:06.708Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-06T03:11:32.265Z","updated_at":"2026-08-07T19:02:26.874Z","avatar_url":"https://github.com/Treblle.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Treblle - API Intelligence Platform\r\n\r\n[![Treblle API Intelligence](https://github.com/user-attachments/assets/b268ae9e-7c8a-4ade-95da-b4ac6fce6eea)](https://treblle.com)\r\n\r\n[Website](http://treblle.com/) • [Documentation](https://docs.treblle.com/) • [Pricing](https://treblle.com/pricing)\r\n\r\nTreblle is an API intelligence platfom that helps developers, teams and organizations understand their APIs from a single integration point.\r\n\r\n---\r\n\r\n## Treblle Apigee SDK\r\nThe Treblle Apigee SDK brings native support to Google Apigee API Gateway across all Apigee versions. The SDK captures data in real-time with zero-latency and sends that data to Treblle for processing. \r\n\r\n## Supported Apigee Versions\r\n\r\n| Framework | Supported Versions | Status |\r\n|-------------------|-------------------|---------------------|\r\n| **Apigee Edge** | All Versions| ✅ Full Support|\r\n| **Apigee X** | All Versions | ✅ Full Support |\r\n| **Apigee Hybrid** | All Versions | ✅ Full Support |\r\n\r\n### Required Permissions\r\n- **API Proxy Developer**: To deploy policies and resources\r\n- **Environment Admin**: To create and manage Key Value Maps\r\n- **Shared Flow Developer**: To create the async logging flow\r\n\r\n### Network Requirements\r\n- Outbound HTTPS access to Treblle endpoints:\r\n  - `rocknrolla.treblle.com`\r\n  - `punisher.treblle.com`\r\n  - `sicario.treblle.com`\r\n- Ports: 443 (HTTPS)\r\n\r\n## Installation\r\n\r\n### Step 1: Get Your Treblle Credentials\r\n\r\n1. Sign up for a free account at [treblle.com](https://treblle.com)\r\n2. Create a new API in your Treblle dashboard\r\n3. Copy your **SDK Token** and **API Key** from the project settings\r\n\r\n### Step 2: Create Environment Configuration\r\n\r\n#### Option A: Using Apigee Management API (Recommended)\r\n\r\nReplace the placeholders with your actual values:\r\n- `YOUR_ORGANIZATION`: Your Apigee organization name\r\n- `YOUR_ENVIRONMENT`: Target environment (test, prod, etc.)\r\n- `YOUR_TREBLLE_SDK_TOKEN`: From your Treblle project\r\n- `YOUR_TREBLLE_API_KEY`: From your Treblle project\r\n\r\n```bash\r\n# Create the KVM\r\ncurl -X POST \"https://apigee.googleapis.com/v1/organizations/YOUR_ORGANIZATION/environments/YOUR_ENVIRONMENT/keyvaluemaps\" \\\r\n  -H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\r\n  -H \"Content-Type: application/json\" \\\r\n  -d '{\r\n    \"name\": \"treblle-kvm\",\r\n    \"encrypted\": true\r\n  }'\r\n\r\n# Add SDK Token\r\ncurl -X POST \"https://apigee.googleapis.com/v1/organizations/YOUR_ORGANIZATION/environments/YOUR_ENVIRONMENT/keyvaluemaps/treblle-kvm/entries\" \\\r\n  -H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\r\n  -H \"Content-Type: application/json\" \\\r\n  -d '{\r\n    \"name\": \"treblle_sdk_token\",\r\n    \"value\": \"YOUR_TREBLLE_SDK_TOKEN\"\r\n  }'\r\n\r\n# Add API Key\r\ncurl -X POST \"https://apigee.googleapis.com/v1/organizations/YOUR_ORGANIZATION/environments/YOUR_ENVIRONMENT/keyvaluemaps/treblle-kvm/entries\" \\\r\n  -H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\r\n  -H \"Content-Type: application/json\" \\\r\n  -d '{\r\n    \"name\": \"treblle_api_key\", \r\n    \"value\": \"YOUR_TREBLLE_API_KEY\"\r\n  }'\r\n\r\n# Verify the setup\r\ncurl \"https://apigee.googleapis.com/v1/organizations/YOUR_ORGANIZATION/environments/YOUR_ENVIRONMENT/keyvaluemaps/treblle-kvm/entries\" \\\r\n  -H \"Authorization: Bearer $(gcloud auth print-access-token)\"\r\n```\r\n\r\n#### Option B: Using Apigee UI\r\n\r\n1. Navigate to **Admin \u003e Environments \u003e Key Value Maps**\r\n2. Click **+ Key Value Map**\r\n3. Name: `treblle-kvm`\r\n4. Enable **Encrypted** checkbox\r\n5. Click **Create**\r\n6. Add entries:\r\n   - Key: `treblle_sdk_token`, Value: `YOUR_TREBLLE_SDK_TOKEN`\r\n   - Key: `treblle_api_key`, Value: `YOUR_TREBLLE_API_KEY`\r\n\r\n### Step 3: Deploy the Shared Flow\r\n\r\n1. In Apigee UI, go to **Develop \u003e Shared Flows**\r\n2. Click **+ Shared Flow**\r\n3. Name: `treblle-logger`\r\n4. Upload or copy the content from `sharedflows/policies/SC-SendToTreblle.xml`\r\n5. Deploy to your target environment\r\n\r\n**Shared Flow XML:**\r\n```xml\r\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?\u003e\r\n\u003cSharedFlow name=\"treblle-logger\"\u003e\r\n  \u003cStep\u003e\r\n    \u003cName\u003eSC-SendToTreblle\u003c/Name\u003e\r\n  \u003c/Step\u003e\r\n\u003c/SharedFlow\u003e\r\n```\r\n\r\n### Step 4: Configure Your API Proxy\r\n\r\n#### Upload Resources\r\n1. Go to **Develop \u003e API Proxies \u003e [Your Proxy]**\r\n2. Navigate to **Resources \u003e JavaScript**\r\n3. Click **+ Resource**\r\n4. Upload `treblle-payload-processor.js`\r\n\r\n#### Create Policies\r\n1. Go to **Policies**\r\n2. Create **JavaScript Policy**:\r\n   - Name: `JS-ProcessTrebllePayload`\r\n   - Resource: `treblle-payload-processor.js`\r\n3. Create **Key Value Map Policy**:\r\n   - Name: `KVM-GetTreblleCredentials`  \r\n   - Copy content from `KVM-GetTreblleCredentials.xml`\r\n   - Update `mapIdentifier` to `treblle-kvm`\r\n4. Create **Flow Callout Policy**:\r\n   - Name: `FC-TreblleAsyncLogger`\r\n   - Shared Flow: `treblle-logger`\r\n\r\n#### Attach to Flow\r\n\r\n**PreFlow Response (Required):**\r\n```xml\r\n\u003cResponse\u003e\r\n  \u003cStep\u003e\r\n    \u003cName\u003eJS-ProcessTrebllePayload\u003c/Name\u003e\r\n  \u003c/Step\u003e\r\n\u003c/Response\u003e\r\n```\r\n\r\n**PostFlow Request (Required):**\r\n```xml\r\n\u003cRequest\u003e\r\n  \u003cStep\u003e\r\n    \u003cName\u003eKVM-GetTreblleCredentials\u003c/Name\u003e\r\n  \u003c/Step\u003e\r\n\u003c/Request\u003e\r\n```\r\n\r\n**PostFlow Response (Required):**\r\n```xml\r\n\u003cResponse\u003e\r\n  \u003cStep\u003e\r\n    \u003cName\u003eFC-TreblleAsyncLogger\u003c/Name\u003e\r\n  \u003c/Step\u003e\r\n\u003c/Response\u003e\r\n```\r\n\r\n## Configuration\r\n\r\n### Data Masking\r\n\r\nCustomize sensitive data detection by modifying the `maskingKeywords` variable:\r\n\r\n```javascript\r\n// Default masking keywords\r\nvar maskingKeywords = 'password,secret,token,key,authorization,auth,credential,private,confidential,ssn,social_security,credit_card,card_number,cvv,pin,api_key,access_token,refresh_token,bearer,x-api-key,x-auth-token';\r\n\r\n// Add your custom keywords\r\nvar maskingKeywords = 'password,secret,token,key,authorization,auth,credential,private,confidential,ssn,social_security,credit_card,card_number,cvv,pin,api_key,access_token,refresh_token,bearer,x-api-key,x-auth-token,customer_id,user_id,email,phone';\r\n```\r\n\r\n**Masking Behavior:**\r\n- Preserves original string length\r\n- Replaces all characters with `*`\r\n- Works in request/response bodies and headers\r\n- Case-insensitive matching\r\n- Supports nested JSON objects and arrays\r\n\r\n### Endpoint Blocking  \r\n\r\nBlock specific endpoints from being tracked:\r\n\r\n```javascript\r\n// Basic blocking\r\nvar blockedEndpoints = 'health,status,ping';\r\n\r\n// Wildcard patterns\r\nvar blockedEndpoints = 'health,status,ping,admin/*,internal/*,v1/auth/*';\r\n\r\n// Complex patterns\r\nvar blockedEndpoints = 'health,status,ping,admin/*,internal/*,*/private/*,test-*';\r\n```\r\n\r\n**Wildcard Support:**\r\n- `admin/*` - Blocks all paths starting with `admin/`\r\n- `*/private/*` - Blocks any path containing `/private/`  \r\n- `test-*` - Blocks paths starting with `test-`\r\n\r\n### Debug Mode\r\n\r\nEnable detailed logging for troubleshooting:\r\n\r\n```javascript\r\nvar debugMode = true;  // Enable debug logging\r\n```\r\n\r\n**Debug Output Includes:**\r\n- Configuration validation results\r\n- Payload building process\r\n- Endpoint blocking decisions\r\n- Error details and stack traces\r\n- Performance timing information\r\n\r\n### Environment-Specific Configuration\r\n\r\nUse different KVM names for different environments:\r\n\r\n**Development:**\r\n```xml\r\n\u003cKeyValueMapOperations mapIdentifier=\"treblle-kvm-dev\"\u003e\r\n```\r\n\r\n**Production:**\r\n```xml\r\n\u003cKeyValueMapOperations mapIdentifier=\"treblle-kvm-prod\"\u003e\r\n```\r\n\r\n## Architecture Overview\r\n\r\n\r\n```\r\n┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐\r\n│   API Request   │───▶│  Apigee Proxy   │───▶│  Backend API    │\r\n└─────────────────┘    └─────────────────┘    └─────────────────┘\r\n                                │\r\n                                ▼\r\n                       ┌─────────────────┐\r\n                       │ JS-ProcessPayload│ (PreFlow Response)\r\n                       └─────────────────┘\r\n                                │\r\n                                ▼\r\n                       ┌─────────────────┐\r\n                       │KVM-GetCredentials│ (PostFlow Request)  \r\n                       └─────────────────┘\r\n                                │\r\n                                ▼\r\n                       ┌─────────────────┐\r\n                       │ FC-AsyncLogger  │ (PostFlow Response)\r\n                       └─────────────────┘\r\n                                │\r\n                                ▼\r\n                       ┌─────────────────┐\r\n                       │ Shared Flow     │\r\n                       │ SC-SendToTreblle│\r\n                       └─────────────────┘\r\n                                │\r\n                                ▼\r\n                       ┌─────────────────┐\r\n                       │ Treblle API     │\r\n                       │ (Load Balanced) │\r\n                       └─────────────────┘\r\n```\r\n\r\n### Flow Execution Order\r\n\r\n1. **PreFlow Response**: JavaScript policy captures request/response data\r\n2. **PostFlow Request**: KVM policy retrieves credentials  \r\n3. **PostFlow Response**: Flow Callout triggers async Shared Flow\r\n4. **Shared Flow**: Service Callout sends data to Treblle\r\n5. **Client Response**: Continues normally (no latency impact)\r\n\r\n## 🔧 Troubleshooting\r\n\r\n### Common Issues\r\n\r\n#### 1. No Data in Treblle Dashboard\r\n\r\n**Symptoms**: API calls work but no data appears in Treblle\r\n\r\n**Solutions**:\r\n```bash\r\n# Check KVM configuration\r\ncurl \"https://apigee.googleapis.com/v1/organizations/YOUR_ORG/environments/YOUR_ENV/keyvaluemaps/treblle-kvm/entries\" \\\r\n  -H \"Authorization: Bearer $(gcloud auth print-access-token)\"\r\n\r\n# Enable debug mode\r\nvar debugMode = true;  // In treblle-payload-processor.js\r\n\r\n# Check Apigee logs for errors\r\n# Look for \"Treblle\" in the trace logs\r\n```\r\n\r\n#### 2. Policy Execution Errors  \r\n\r\n**Symptoms**: 500 errors or policy failures\r\n\r\n**Solutions**:\r\n```javascript\r\n// Check policy attachment order in proxy XML\r\n// PreFlow Response: JS-ProcessTrebllePayload\r\n// PostFlow Request: KVM-GetTreblleCredentials  \r\n// PostFlow Response: FC-TreblleAsyncLogger\r\n\r\n// Verify JavaScript resource upload\r\n// Ensure all variable names match exactly\r\n```\r\n\r\n#### 3. Credential Issues\r\n\r\n**Symptoms**: Authentication errors in logs\r\n\r\n**Solutions**:\r\n```bash\r\n# Verify credential format (no extra spaces/characters)\r\n# Test credentials manually:\r\ncurl -X POST \"https://rocknrolla.treblle.com\" \\\r\n  -H \"Content-Type: application/json\" \\\r\n  -H \"x-api-key: YOUR_SDK_TOKEN\" \\\r\n  -d '{\"test\": true}'\r\n```\r\n\r\n#### 4. Performance Issues\r\n\r\n**Symptoms**: Increased API latency\r\n\r\n**Solutions**:\r\n```javascript\r\n// Reduce payload size limit\r\nvar maxPayloadSize = 524288;  // 512KB instead of 2MB\r\n\r\n// Disable body logging temporarily  \r\nvar logBody = false;\r\n\r\n// Check blocked endpoints\r\nvar debugMode = true;  // See what's being processed\r\n```\r\n\r\n### Debug Mode Output\r\n\r\nEnable debug logging to see detailed execution:\r\n\r\n```javascript\r\nvar debugMode = true;\r\n```\r\n\r\n**Sample Debug Output**:\r\n```\r\nDEBUG: Starting Treblle SDK processing\r\nDEBUG: Configuration validated successfully  \r\nDEBUG: Endpoint allowed for tracking: /api/users\r\nDEBUG: Payload built successfully\r\nDEBUG: Payload serialized successfully - size: 1337 bytes\r\nDEBUG: Selected host: rocknrolla.treblle.com\r\nDEBUG: All validations passed - Treblle call prepared successfully\r\nDEBUG: Treblle SDK processing completed\r\n```\r\n\r\n## Support\r\n\r\nIf you have problems of any kind feel free to reach out via \u003chttps://treblle.com\u003e or email support@treblle.com and we'll do our best to help you out.\r\n\r\n## License\r\n\r\nCopyright 2025, Treblle Inc. Licensed under the MIT license:\r\nhttp://www.opensource.org/licenses/mit-license.php","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftreblle%2Ftreblle-apigee","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftreblle%2Ftreblle-apigee","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftreblle%2Ftreblle-apigee/lists"}