Joule
  • Welcome to Joule's Docs
  • Why Joule?
    • Joule capabilities
  • What is Joule?
    • Key features
    • The tech stack
  • Use case enablement
    • Use case building framework
  • Concepts
    • Core concepts
    • Low code development
    • Unified execution engine
    • Batch and stream processing
    • Continuous metrics
    • Key Joule data types
      • StreamEvent object
      • Contextual data
      • GeoNode
  • Tutorials
    • Getting started
    • Build your first use case
    • Stream sliding window quote analytics
    • Advanced tutorials
      • Custom missing value processor
      • Stateless Bollinger band analytics
      • IoT device control
  • FAQ
  • Glossary
  • Components
    • Pipelines
      • Use case anatomy
      • Data priming
        • Types of import
      • Processing unit
      • Group by
      • Emit computed events
      • Telemetry auditing
    • Processors
      • Common attributes
      • Filters
        • By type
        • By expression
        • Send on delta
        • Remove attributes
        • Drop all events
      • Enrichment
        • Key concepts
          • Anatomy of enrichment DSL
          • Banking example
        • Metrics
        • Dynamic contextual data
          • Caching architecture
        • Static contextual data
      • Transformation
        • Field Tokeniser
        • Obfuscation
          • Encryption
          • Masking
          • Bucketing
          • Redaction
      • Triggers
        • Change Data Capture
        • Business rules
      • Stream join
        • Inner stream joins
        • Outer stream joins
        • Join attributes & policy
      • Event tap
        • Anatomy of a Tap
        • SQL Queries
    • Analytics
      • Analytic tools
        • User defined analytics
          • Streaming analytics example
          • User defined analytics
          • User defined scripts
          • User defined functions
            • Average function library
        • Window analytics
          • Tumbling window
          • Sliding window
          • Aggregate functions
        • Analytic functions
          • Stateful
            • Exponential moving average
            • Rolling Sum
          • Stateless
            • Normalisation
              • Absolute max
              • Min max
              • Standardisation
              • Mean
              • Log
              • Z-Score
            • Scaling
              • Unit scale
              • Robust Scale
            • Statistics
              • Statistic summaries
              • Weighted moving average
              • Simple moving average
              • Count
            • General
              • Euclidean
        • Advanced analytics
          • Geospatial
            • Entity geo tracker
            • Geofence occupancy trigger
            • Geo search
            • IP address resolver
            • Reverse geocoding
            • Spatial Index
          • HyperLogLog
          • Distinct counter
      • ML inferencing
        • Feature engineering
          • Scripting
          • Scaling
          • Transform
        • Online predictive analytics
        • Model audit
        • Model management
      • Metrics engine
        • Create metrics
        • Apply metrics
        • Manage metrics
        • Priming metrics
    • Contextual data
      • Architecture
      • Configuration
      • MinIO S3
      • Apache Geode
    • Connectors
      • Sources
        • Kafka
          • Ingestion
        • RabbitMQ
          • Further RabbitMQ configurations
        • MQTT
          • Topic wildcards
          • Session management
          • Last Will and Testament
        • Rest endpoints
        • MinIO S3
        • File watcher
      • Sinks
        • Kafka
        • RabbitMQ
          • Further configurations
        • MQTT
          • Persistent messaging
          • Last Will and Testament
        • SQL databases
        • InfluxDB
        • MongoDB
        • Geode
        • WebSocket endpoint
        • MinIO S3
        • File transport
        • Slack
        • Email
      • Serialisers
        • Serialisation
          • Custom transform example
          • Formatters
        • Deserialisers
          • Custom parsing example
    • Observability
      • Enabling JMX for Joule
      • Meters
      • Metrics API
  • DEVELOPER GUIDES
    • Setting up developer environment
      • Environment setup
      • Build and deploy
      • Install Joule
        • Install Docker demo environment
        • Install with Docker
        • Install from source
        • Install Joule examples
    • Joulectl CLI
    • API Endpoints
      • Mangement API
        • Use case
        • Pipelines
        • Data connectors
        • Contextual data
      • Data access API
        • Query
        • Upload
        • WebSocket
      • SQL support
    • Builder SDK
      • Connector API
        • Sources
          • StreamEventParser API
        • Sinks
          • CustomTransformer API
      • Processor API
      • Analytics API
        • Create custom metrics
        • Define analytics
        • Windows API
        • SQL queries
      • Transformation API
        • Obfuscation API
        • FieldTokenizer API
      • File processing
      • Data types
        • StreamEvent
        • ReferenceDataObject
        • GeoNode
    • System configuration
      • System properties
  • Deployment strategies
    • Deployment Overview
    • Single Node
    • Cluster
    • GuardianDB
    • Packaging
      • Containers
      • Bare metal
  • Product updates
    • Public Roadmap
    • Release Notes
      • v1.2.0 Join Streams with stateful analytics
      • v1.1.0 Streaming analytics enhancements
      • v1.0.4 Predictive stream processing
      • v1.0.3 Contextual SQL based metrics
    • Change history
Powered by GitBook
On this page
  • Overview
  • What this tutorial is about
  • Who this tutorial is intended for
  • What we will learn
  • Prerequisites
  • Implementation
  • Step 1 - Define a metric family name for the metrics
  • Step 2 - Write and validate our metrics generation query
  • Step 3 - Assign a unique stable metric key
  • Step 4 - Define target metrics table schema
  • Step 5 - Do you need a metric image on start up?
  • Step 6 - Finally consider storage requirements
  • What Did We Learn?
  • What’s Next?

Was this helpful?

  1. Tutorials
  2. Analytics

Create custom metrics

We will create our own custom metrics from scratch

Overview

In this tutorial we will learn how to create metrics by defining a metric family.

This includes the result table store metrics and the runtime frequency using a policy.

One or more metric families can be configured, each has its own management policy.

What this tutorial is about

This tutorial covers the creation, definition and the management of metrics within Joule, providing step-by-step guidance on setting up a complete metrics framework using metric families, policies and table schemas.

Who this tutorial is intended for

This tutorial is designed for developers and data engineers looking to implement and optimise custom metrics in Joule, particularly those working on data-heavy or KPI-driven applications.

What we will learn

We will learn how to:

  1. Define metric families

  2. Build and validate efficient queries

  3. Assign stable metric keys

  4. Set up target table schemas

  5. Manage initial metric images and data storage policies

Prerequisites

Basic knowledge of SQL, familiarity with metrics generation concepts and access to:

  1. Import dataset, build query and validate results.

  2. Joule platform, follow this tutorial to see how to set Joule up Getting started.

Implementation

Step 1 - Define a metric family name for the metrics

We need to come up with a naming convention that makes sense and is descriptive for our metric.

We should expect this output

Step 2 - Write and validate our metrics generation query

We will build, validate and optimise metrics query.

  • Import dataset, build query and validate results.

  • Ensure query performance is optimal and sits below 5 seconds.

We should expect this output

Step 3 - Assign a unique stable metric key

We will assign a stable metrics key which is used to query the target metrics table.

A successful metric query must only return either 0 or 1 row.

We should expect this output

Step 4 - Define target metrics table schema

Define the target metrics table using the metrics family name as the table name.

We should expect this output

Step 5 - Do you need a metric image on start up?

Some processing requirements need to have initial metric values to work correctly, such as KPIs for example.

For this scenario an initial image of metric family is required and may come from pre-validated data or from a previous run without additional processing steps. This data may need to be imported.

We should expect this output

Step 6 - Finally consider storage requirements

With respect to memory usage we should consider how much historical data we will need to store in-memory.

We should expect this output

What Did We Learn?

In this tutorial, we learned:

  1. How to create and manage metrics within Joule by defining metric families.

  2. Writing and validating optimised queries

  3. Setting up target table schemas

We also covered best practices for assigning stable metric keys, initialising metric images for specific use cases and managing memory usage with compaction policies.

What’s Next?

With these foundational skills in place, the next steps involve exploring advanced metrics configurations, such as:

  1. Creating complex metrics aggregations.

  2. Applying more sophisticated data transformation pipelines

  3. Integrating real-time observability tools.

Last updated 5 months ago

Was this helpful?

DuckDB local installation and understanding how to interact with it, .

In the event of an import we will need to use the provided by Joule.

We can use the to delete data that is not needed.

Additionally, users can dive into to develop custom processors, further enhancing the metrics functionality to meet specific business requirements.

see the documentation
import feature
Joule’s processor SDK
compaction policy