Tenant Profiles
Tenant Profile là template định nghĩa giới hạn tài nguyên và quyền hạn cho tenant. Dùng để tạo các gói dịch vụ khác nhau (Basic, Pro, Enterprise) trên nền tảng SaaS.
Truy cập
Chỉ System Administrator mới có thể quản lý Tenant Profiles:
System Admin > Tenant Profiles
Entity Limits (Giới hạn số lượng)
Số lượng tối đa của từng loại entity:
Max devices: 1000
Max assets: 500
Max customers: 100
Max dashboards: 200
Max rule chains: 50
Max users: 100
Max gateways: 20
Max edge instances: 5
Khi tenant đạt giới hạn → API trả về lỗi 429 với thông báo rõ ràng.
API Rate Limits
Giới hạn tốc độ gọi API để bảo vệ hệ thống:
REST API limits:
Tenant level: 1000 req/min
Customer level: 200 req/min
User level: 100 req/min
Transport limits (thiết bị gửi data):
Messages per second: 100
Messages per month: 10,000,000
Data points per sec: 1000
Ví dụ format: 100:1:tbMsg,20000:60:tbMsg → 100 msg/giây, 20000 msg/phút.
File/Storage Limits
Max resource files: 100
Max OTA packages: 20
Max total file size: 1 GB
Max single file size: 50 MB
Tenant Queue Configuration
Cấu hình queue riêng để cô lập tài nguyên giữa tenant:
Queue name: tenant-priority-queue
Submit strategy:
Type: BURST
Failed iterations: 3
Processing strategy:
Type: SKIP_ALL_FAILURES
Retries: 3
Failure % threshold: 50
Pause between retries: 3s
Max pause: 30s
Submit strategies:
| Strategy | Mô tả |
|---|---|
BURST | Gửi tất cả rồi xử lý lỗi |
BATCH | Gửi theo batch |
SEQUENTIAL_BY_TENANT | Tuần tự theo tenant |
SEQUENTIAL_BY_ORIGINATOR | Tuần tự theo thiết bị |
Processing strategies:
| Strategy | Khi có lỗi |
|---|---|
SKIP_ALL_FAILURES | Bỏ qua message lỗi, tiếp tục |
RETRY_ALL | Retry tất cả message lỗi |
RETRY_FAILED | Retry chỉ message thất bại |
Tính năng theo Profile
✓/✗ WhiteLabeling ← tùy chỉnh logo, màu sắc
✓/✗ Custom Email ← SMTP server riêng
✓/✗ Two-Factor Auth ← bắt buộc 2FA
✓/✗ Edge Computing ← kết nối ThingsBoard Edge
✓/✗ Custom CSS ← tùy chỉnh giao diện
✓/✗ Transport Security ← yêu cầu TLS
Ví dụ: Định nghĩa gói dịch vụ
Gói Basic (Free)
Devices: 10
Assets: 20
Dashboards: 5
Users: 3
API limit: 100 req/min
File storage: 100 MB
WhiteLabel: ✗
Gói Professional
Devices: 500
Assets: 200
Dashboards: 50
Users: 20
API limit: 1000 req/min
File storage: 5 GB
WhiteLabel: ✗
2FA: optional
Gói Enterprise
Devices: unlimited (0)
Assets: unlimited (0)
Dashboards: unlimited (0)
Users: unlimited (0)
API limit: custom
File storage: unlimited
WhiteLabel: ✓
2FA: enforced
Custom queue: ✓
Edge: ✓
Giá trị 0 = không giới hạn
Gán Tenant Profile
Khi tạo tenant mới hoặc chỉnh sửa:
Tenant > Edit > Tenant Profile: Enterprise
Thay đổi profile ngay lập tức áp dụng cho tenant.
API Usage Monitoring
Tenant có thể xem mức sử dụng hiện tại:
Usage > API Usage:
Devices active: 847 / 1000
Messages this month: 2,341,055 / 10,000,000
API calls today: 45,230 / 100,000
Storage used: 3.2 GB / 5 GB
Khi gần đạt giới hạn → Notification Center gửi cảnh báo tự động.
API
POST /api/tenantProfile
GET /api/tenantProfile/{id}
GET /api/tenantProfiles?pageSize=10&page=0
DELETE /api/tenantProfile/{id}
GET /api/tenantProfileInfo/{id}