Getting Started with Metrics
LeanIX Metrics can consume data from an arbitrary source via an open API and link that to a Fact Sheet type.
Overview of Functionality
In modern IT organizations, a wide range of expert tools generate high amounts of data. The big challenge is to leverage this data. According to Gartner, 90% of the information assets from big data analytics efforts through 2017 will be siloed and inaccessible. LeanIX Metrics allows to display time series data in the context of Fact Sheets and thereby establish a useful business context.
With Metrics you can store time series data in LeanIX and create interactive charts to display the data. In addition the data can be linked to Fact Sheets, presented on the Dashboard or be displayed within the "Reports" area.
Definitions
Key | Definition |
---|---|
Measurement | Measurements contain data-points stored over time, which are related to the same topic. Each data-point is stored for a specific moment and has one or more values for that instant of time. The values are stored in fields. |
Fields | Each data-point stores has one or more fields, which contain values that have been collected for the instant of time associated with the data-point. When creating a chart the values of the fields can be displayed as a series. For that different aggregation functions are available such as COUNT or SUM. |
Tags | Furthermore a data-point has tags consisting of a key and a value. The tags further describe that data-point and enables to filter for certain data-point when displaying a chart for different context. |
Steps to Create Integration
Steps | Notes |
---|---|
Review Swagger API documentation | https://dev.leanix.net/docs/available-apis#section-metrics-api-real-time-data |
Measurements should contain the uploaded data, split into Points | Each Point has a unique time stamp |
Charts describe how to represent the Measurement graphically | For example as a Bar Chart |
Charts contain Rules which define how the measurement data is mapped to your Fact Sheets (one option is to map using the External ID) |
Create Chart
Navigate over to the Administration area, by selecting the person icon available in the upper right hand corner. Then select Metrics from the left hand panel.

Once you have imported the points the measurement is available in your workspace. You can create a chart and define other specifics.
To do so select the plus icon next to the measurement that you would like to graphically represent.

Associate a chart to a measurement.

Give the chart a name, define the Y axis and time span.
Associate series information, by using the drop downs. The field name directly corresponds to the key fields in the measure JSON. Define the color for this particular field and the Type of chart, the options are bar, line and area, as well as other information.

Associate Series information
Link the Fact Sheet ID used in LeanIX to the right field you provided by adding a rule.
Use the Add button to continue adding Series information to your chart.

Use cases
Quantify the Engagement of Users with your Applications
You can objectify the functional fit of your applications by pulling in metrics on a variety of data points.
Some examples of the possible options are below:
Quantify Engagment of Users with your Applications |
---|
User By Country |
Events/User Logins |
User Logins |
Provide Technical and Operational Details to the Relevant Stakeholders
Number of Incidents by Criticality |
Availability |
Response Time |
Developer Resources
To import your first metric, go to:
You also need to create an API Token by using the Technical User functionality and enter it on the top right to execute queries directly from the API documentation. Please see Available APIs for more information.
The endpoint URL depends on the instance you are using. We use the variable base_url, which has one of the following values:
https://eu-svc.leanix.net - If you are using the default instance of LeanIX
https://us-svc.leanix.net - If you are using the US instance of LeanIX
https://au-svc.leanix.net - If you are using the Australian instance of LeanIX
https://.leanix.net - If you have a dedicated instance of LeanIX
In the documentation, enter the following JSON and select "try it out".

{
"measurement": "My First Metric",
"workspaceId": "<your workspace ID>",
"time": "2018-02-14T07:15:00.544Z",
"tags": [
{
"k": "factSheetID",
"v": "<your fact sheet ID>"
}
],
"fields": [
{
"k": "Availability",
"v": "99"
},
{
"k": "ResponseTime",
"v": "123"
},
{
"k": "NumberOfUsers",
"v": "12"
}
]
}
You need to adapt and to your context. Now, go to Administration then Metrics, and you should see the first measurement.
Export Data from Metrics
Similarly, we provide an endpoint to export data from Metrics via API: https://eu.leanix.net/openapi-explorer/#/measurements/getMeasurements. You would need to provide a query, e.g. to get all available data for a certain fact sheet ID:
{
"q": "\"factSheetID\"='<your fact sheet id>'",
"workspaceId": "<your workspace ID>"
}
Import a Point to the Metrics API
The table below directly corresponds to the screenshot of the measurement "Application KPIs".
Metrics/measurement JSON Structure
Key | Notes | More Information/Examples |
---|---|---|
measurement | Can be an arbitrary key to describe your measurement | |
workspaceId | Can be extracted from LeanIX | Access the Administration area, then select API Tokens |
time | Refers to the unique timestamp of the uploaded point | |
tags | Refers to the tag that is being used to map the data to the Fact Sheets | Examples are fact sheet ID, fact sheet name, external ID, and factsheet type. This is linked within "Rules" area of the chart set-up |
fields | A point can have multiple fields, all represented as key value pairs |

Application KPIs' Example
Utilize the Integration API
The Integration API provides the ability to import and export data using a generic LeanIX Data Interchange Format (LDIF). LDIF is a JSON format with a very simple structure described in the following sections. All mapping and processing of the incoming and outgoing data is done using "Data Processors" that are configured behind the API. Configuration of the processors can be done using the UI, please see the Setup page for more information. The configurations can be managed using the Integration API as well.
Please see the Integration API documentation for Metrics Example.
Available Python Script
In the public script repository there is a script available in Python that can quickly get you started.
Common Metrics Use-cases
Some JSON code snippets to use with the LeanIX Metrics API and their outputs.
getSeries
SELECT * FROM Cloud Costs (Business Context)
//Sample Output Series:
{
"status": "OK",
"type": "Series",
"errors": [],
"total": 0,
"data": {
"name": "_ws_c9032213-e1f4-4f6c-b1e8-f644b22394ef_Cloud Costs (Business Context)",
"fields": [
"Connector Instance",
"External ID (Business Context)",
"other"
],
"values": [
{
"t": 1593820800,
"v": [
"129263247607",
null,
0.600240502
]
},
{
"t": 1593820800,
"v": [
"arn:aws:ecs:us-east-2:129263247607:service/libertex-replica/service-2",
"libertex-service-2",
2.9876
]
},
{
"t": 1593907200,
"v": [
"129263247607",
null,
0.5480387068
]
},
{
"t": 1593993600,
"v": [
"129263247607",
null,
1.3026877201
]
},
{
"t": 1594080000,
"v": [
"129263247607",
null,
1.2920403442
]
},
{
"t": 1595894400,
"v": [
"129263247607",
"LeanIX Cloud Native Suite",
0.0000135621
]
},
{
"t": 1617840000,
"v": [
"129263247607",
"cdk-scheduler",
0.0333821336
]
},
{
"t": 1617840000,
"v": [
"129263247607",
"cloudockit",
1.0212847944
]
},
{
"t": 1617840000,
"v": [
"129263247607",
"my new ecs app",
0.3406857587
]
}
]
}
}
createPoint
Create + Update
{
"measurement": "Cloud Costs (Business Context)",
"workspaceId": "c9032213-e1f4-4f6c-b1e8-f644b22394ef",
"time": 1593820800,
"tags": [
{
"k": "External ID (Business Context)",
"v": "libertex-service-2"
},
{
"k": "Connector Instance",
"v": "arn:aws:ecs:us-east-2:129263247607:service/libertex-replica/service-2"
}
],
"fields": [
{
"k": "other",
"v": 2.9876
}
]
}
{
"status": "OK",
"type": "Point",
"errors": [],
"total": 0,
"data": {
"measurement": "_ws_c9032213-e1f4-4f6c-b1e8-f644b22394ef_Cloud Costs (Business Context)",
"workspaceId": "c9032213-e1f4-4f6c-b1e8-f644b22394ef",
"time": 1593820800,
"tags": [
{
"k": "External ID (Business Context)",
"v": "libertex-service-2"
},
{
"k": "Connector Instance",
"v": "arn:aws:ecs:us-east-2:129263247607:service/servicename"
}
],
"fields": [
{
"k": "other",
"v": 2.9876,
"s": null
}
]
}
}
deleteMeasurement
Workspace ID:c1111111-e1f4-4f6c-b1e8-f644b22394ef
Cloud Costs (Business Context))
Remove Metrics from Service
{
"measurement": "Cloud Costs (Business Context)",
"workspaceId": "c9032213-e1f4-4f6c-b1e8-f644b22394ef",
"time": 1620000000,
"tags": [
{
"k": "External ID (Business Context)",
"v": "libertex-service-2"
},
{
"k": "Connector Instance",
"v": "arn:aws:ecs:us-east-2:129263247607:service/libertex-replica/service-2"
}
],
"fields": [
{
"k": "other",
"v": 0
}
]
}
Updated over 1 year ago