Logo

Subject metadata, webhook filters, and new collectorsLaunch week day five feature announcements

Peter Marton
Peter Marton@slashdotpeter
cover

Today, we highlight a collection of new features that the OpenMeter team has been working on over the past few weeks. We are excited to introduce:

Subject metadata and display names

Now, you can assign display name and metadata to your subjects, both on the UI and via API and SDKs. Subject metadata is also passed to usage syncs to help map subjects to external systems.

Subjects in OpenMeter are entities that consume resources you wish to meter. These can range from users, servers, and services to devices. The design of subjects is intentionally generic, enabling flexible application across various metering scenarios. Typically, a subject acts as a unique identifier within your system for a user or customer.

Example subjects include:

  • Customer ID or User ID
  • Hostname or IP address
  • Service or Application name
  • Device ID

As subjects are often UUIDs or database IDs, it is useful to assign them a display name to make it easier to identify them in the UI and reports.

Here is an example of how you can enhance subjects with our Node.js SDK:

const subjects = await openmeter.subjects.upsert([
  {
    key: 'customer-1',
    displayName: 'ACME',
    metadata: { hubspotContactId: '1234' },
  },
]);

To get started with subject management, read the documentation.

Postgres and ClickHouse collectors

We have added two new collectors to OpenMeter to pull existing usage data from your Postgres and ClickHouse databases. This is useful if you have existing usage data in your databases and want to import it into OpenMeter for further processing, reporting, and billing. It also simplifies migrating from your existing metering solution to OpenMeter.

You can read more about our Postgres and ClickHouse collectors in the documentation.

Webhook usage sync filters

Our webhook usage syncs allow sending usage data to external HTTP endpoints. This is useful if you want to keep OpenMeter usage data in sync with your systems or third-party applications that are not supported natively yet. We use Svix to deliver webhooks safely, which also supports transformation templates to simplify integration with applications like Slack.

Now, you can also filter in webhook syncs, allowing you to trigger notifications for specific usage events, for example, when a customer reaches a usage threshold. Check out our example to send usage threshold notification emails with Resend.

Filter example:

{
  "subject": {
    "$in": ["customer-1", "customer-2"]
  },
  "usage": {
    "$gt": 100
  }
}

In the documentation, read more about Usage Syncs.

LangChain Example

LangChain is a popular open-source framework for building language model applications. The LangChain SDK provides a callback system that allows you to access the various stages of your LLM application. To simplify the integration process of OpenMeter with LangChain, we created an example that shows how to send token usage to OpenMeter.

Check out our LangChain example.