-
Notifications
You must be signed in to change notification settings - Fork 64
Feat: Konnect metering and billing Subjects #3478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
cloudjumpercat
merged 4 commits into
release/konnect-metering-and-billing
from
subject-reference
Nov 25, 2025
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -143,6 +143,7 @@ crd | |
| crds | ||
| created_at | ||
| creationTimestamp | ||
| CRMs | ||
| cronjob | ||
| CrowdStrike | ||
| cryptocurrency | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| title: Metering and Billing Documentation Index | ||
| sections: | ||
| - title: Reference | ||
| items: | ||
| - path: /metering-and-billing/ | ||
| - path: /metering-and-billing/**/* | ||
| auto_exclude: true | ||
| - title: How-Tos | ||
| items: | ||
| - type: how-to | ||
| products: | ||
| - metering-and-billing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| metadata: | ||
| title: "Metering and Billing" | ||
| content_type: landing_page | ||
| description: Learn how to meter and bill for your features with Metering and Billing. | ||
| breadcrumbs: | ||
| - /metering-and-billing/ | ||
| products: | ||
| - metering-and-billing | ||
|
|
||
| rows: | ||
| - header: | ||
| type: h1 | ||
| text: "Metering and Billing" | ||
| sub_text: Turn any events, logs, and metrics into revenue with usage-based metering and billing. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| --- | ||
| title: "Subjects" | ||
| content_type: reference | ||
| description: "Learn how subjects work in {{site.konnect_short_name}} Metering and Billing and how they relate to usage tracking and external billing systems." | ||
| layout: reference | ||
| products: | ||
| - metering-and-billing | ||
| tools: | ||
| - konnect-api | ||
| works_on: | ||
| - konnect | ||
| breadcrumbs: | ||
| - /metering-and-billing/ | ||
| related_resources: | ||
| - text: "{{site.konnect_short_name}} Metering and Billing" | ||
| url: /metering-and-billing/ | ||
|
|
||
| --- | ||
|
|
||
| ## What is a subject? | ||
|
|
||
| Subjects represent the entity that consume metered resources in {{site.konnect_short_name}} Metering and Billing. Billable events ingested to Metering and Billing have a subject associated with them. | ||
|
|
||
| A subject can represent any unique event in your system, such as: | ||
| * Customer ID or User ID | ||
| * Hostname or IP address | ||
| * Service or application name | ||
| * Device ID | ||
|
|
||
| The subject model is intentionally generic, enabling flexible application across different metering scenarios. | ||
| In most implementations, a subject maps 1:1 with a customer or user in your system. You can use the same identifier for both, but they can differ if your usage producer and billing entity are not the same. For example: | ||
| * One customer may have multiple usage-producing subjects | ||
| * A single subject’s usage may need to be billed to a different customer | ||
|
|
||
| You can also have multiple subjects assigned to a customer. This abstraction allows you to group usage data and billing for a customer. For example, a customer can have multiple subjects like `department1` or `department2`: | ||
|
|
||
| {% mermaid %} | ||
| flowchart TD | ||
|
|
||
| subgraph a ["Customer Kong Air"] | ||
| subject1["Subject"] | ||
| end | ||
|
|
||
| subgraph Customer-ACME Inc | ||
| subject2["Subject (Department 1)"] | ||
| subject3["Subject (Department 2)"] | ||
| end | ||
|
|
||
| subject1 --> UsageEvents1["Usage Events"] | ||
| subject2 --> UsageEvents2["Usage Events"] | ||
| subject3 --> UsageEvents3["Usage Events"] | ||
| {% endmermaid %} | ||
|
|
||
| {:.info} | ||
| > We recommend creating a subject when a new customer or user is created in your system and deleting a subject when a customer or user is deleted. Keeping the subjects in sync in Metering and Billing is necessary if you synchronize usage to external systems, such as Stripe billing or CRMs, as {{site.konnect_short_name}} knows the mapping between the subject and the external system. | ||
| > {{site.konnect_short_name}} Metering and Billing will also automatically create a subject for you when you ingest an usage event for a new subject. | ||
|
|
||
| ## How do subjects work? | ||
|
|
||
| {{site.konnect_short_name}} Metering and Billing uses subjects to: | ||
|
|
||
| * Associate usage with external systems (for example, Stripe or CRM tools) | ||
| * Store descriptive metadata | ||
| * Identify the entity producing metered events | ||
|
|
||
| Each subject contains the following fields: | ||
|
|
||
| * **Key** – The subject’s unique identifier | ||
| * **Display name** – A human-readable label shown in the UI | ||
| * **Metadata** – Optional key-value attributes for additional context | ||
|
|
||
|
|
||
| ## Data ingestion | ||
|
|
||
| When shipping data to {{site.konnect_short_name}} you must include the subject within the events payload: | ||
|
|
||
| ```ts | ||
| { | ||
| "specversion": "1.0", | ||
| "type": "api-calls", | ||
| "id": "00002", | ||
| "time": "2023-01-01T00:00:00.001Z", | ||
| "source": "service-0", | ||
| "subject": "customer-1", | ||
| "data": {...} | ||
| } | ||
| ``` | ||
|
|
||
|
|
||
| ## Schema | ||
|
|
||
| [Insert Schema here](https://openmeter.io/docs/api/cloud#tag/subjects) | ||
|
|
||
| ## Set up a subject | ||
|
|
||
| CRUD a subject here |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably doesn't matter for this PR, but I think we have to do more to bootstrap Metering and Billing: