Single Instrumentation Layer
Single Instrumentation Layer
The Single Instrumentation Layer is an event tracking abstraction that allows to track any events in GitLab using a single interface. It uses events definitions from Internal Event framework to declare event processing logic.
Why a Single Instrumentation Layer?
The Single Instrumentation Layer allows to:
- Instrument events and processing logic in a single place
- Use the same event definitions for both instrumentation and processing
- Eliminate the need to write duplicate tracking code for the same event
How it works
Event definitions are used as a declarative specification for processing logic and are single source of truth for event properties, tracking parameters, and other metadata.
Additional tracking systems
When an event is intended to be processed by tracking systems (for example, AiTracking), the event definition is extended to include the additional processing logic. example
This logic is declared using additional processing classes using standard interface.
How to implement it for your tracking system
To implement it for your tracking system, you need to:
Add a new event definition or use existing one (see events dictionary).
Implement the processing logic in a new tracking class. The class should have a class method
track_event
that accepts an event name and additional named parametersmodule Gitlab module Tracking class NewTrackingSystemProcessor def self.track_event(event_name, **kwargs) # add your tracking logic here end end end end
Extend the event definition with the new tracking class added in
extra_tracking_classes:
propertyextra_tracking_classes: - Gitlab::Tracking::NewTrackingSystemProcessor
Trigger the event in your code using Internal Events framework
**kwargs
is used to pass additional parameters to the tracking class from the Internal Events framework.
The actual parameters depend on the tracking parameters passed to the event invocation above.
Usually, it includes user
, namespace
and project
along with additional_properties
that can be used to pass any additional data.
The tracking systems will be triggered by the order of the extra_tracking_classes:
property.
Systems that use the Single Instrumentation Layer
- Internal Event. Is the main system that implements the tracking layer.
- AiTracking. Work in progress on migrating to the new layer.
Docs
Edit this page to fix an error or add an improvement in a merge request.
Create an issue to suggest an improvement to this page.
Product
Create an issue if there's something you don't like about this feature.
Propose functionality by submitting a feature request.
Feature availability and product trials
View pricing to see all GitLab tiers and features, or to upgrade.
Try GitLab for free with access to all features for 30 days.
Get help
If you didn't find what you were looking for, search the docs.
If you want help with something specific and could use community support, post on the GitLab forum.
For problems setting up or using this feature (depending on your GitLab subscription).
Request support