This tutorial explains how to regularly export data from external Tracker to ClickHouse and build a chart showing issue counts by status. Data is updated on a schedule, and the Tracker account permissions determine which issues are exported.
To obtain data, log in to Tracker under the account of a user with full access to the service.
Sign up for Yandex Cloud and create a billing account:
Go to the management console and log in to Yandex Cloud or create an account if you do not have one yet.
On the Billing page, make sure you have a billing account activated and its status is ACTIVE or TRIAL_ACTIVE. If you do not have a billing account, create one.
If you have an active billing account, you can create or select a folder on the cloud page to host your infrastructure.
A sequence of characters will appear on the page — this is the OAuth token. Copy it and save it.
To check if you have access to the API, execute the request for information about the current user. If access was not obtained, the request will return a response with code 401 Unauthorized.
Example request for information about the current user using curl:
Open tracker_import.py. In the TRACKER_HEADERS dictionary, select the organization header:
For a Yandex 360 organization, keep X-Org-ID.
For a Yandex Cloud organization, replace the X-Org-ID key with X-Cloud-Org-ID.
In both cases, TRACKER_ORG_ID must contain the ID of the corresponding organization. The importer uses an OAuth token. Using an IAM token requires separate changes to authentication and token renewal; this tutorial uses OAuth.
In get_issues_query_text, replace the elif TRACKER_INITIAL_HISTORY_DEPTH branch so the filter also applies to the initial import:
Save the changes and recreate the archive. The tracker_import.py and requirements.txt files and the isoduration directory must be at the ZIP archive root.
This example exports data through the external Tracker API. The token must belong to an account with access to the issues you need. Do not grant access to the database or reports to users who cannot access the exported data.
Create a Cloud Functions function for importing the data
TRACKER_INITIAL_HISTORY_DEPTH: 1d for a test import of issues updated in the last day. For a longer initial import, increase this value, e.g., to 365d.
CH_STATUSES_VIEW: v_tracker_statuses
FILTER: An additional search condition, e.g., Queue: TEST, where TEST is your queue key. Without a filter, the importer exports all issues accessible to the account within the selected period.
The OK response confirms that the invocation finished, not that the export is complete. In ClickHouse, check that db1.v_tracker_issues contains the expected issues. If it is empty, check the account permissions, FILTER, and the initial import period.
Subsequent invocations resume from the latest imported updatedAt with a five-minute overlap. Changing TRACKER_INITIAL_HISTORY_DEPTH after the first import does not reload older issues. The 60-second timeout and 1024 MB of memory are starting settings for a small export. If the import times out, reduce the selection or increase the resources.
Create a trigger for regular exports of new data to the database:
Go to the Cloud Functions section.
Click → Create trigger.
Set the trigger type to Timer.
In the Cron expression field, select Every day.
Under Function settings, select the function you created and its $latest version tag.
Create or select a service account with the functions.functionInvoker role to invoke the function. To create an account in this window, click Create new.
If creating an account, enter its name and click Create.
Select or create a workbook, name the connection, and save it. The cluster and the DataLens instance must belong to the same organization. If the cluster is missing, check the organization and access permissions. For more information, see the DataLens guide.
For the first chart, drag the db1.v_tracker_issues view to the workspace. It contains the latest imported state of each issue.
You can also create separate datasets based on:
db1.v_tracker_changelog: Workflow events for imported issues, including status transitions.
db1.v_tracker_statuses: Intervals between transitions and time from issue creation to a transition, in minutes.
The importer code defines the available fields. Custom fields are not automatically added to the schema. Account for relationships when joining these views: multiple events for one issue can increase the row count.
In the Datasets drop-down list, select the dataset you created in the previous step.
On the top panel, select the Column chart visualization type.
Add status_display as the X-axis dimension.
Create a calculated field named Issue count with the COUNTD([id]) formula and add it as the Y-axis measure.
Save the chart as Issues by status. Each column shows the number of unique issues in a status within the exported data.
Create a dashboard and add charts to it
On the DataLens home page, click Create dashboard.
At the top of the dashboard page, click Add → Chart.
Fill in the widget parameters. Pay close attention to the following fields:
Name: Sets the name of the widget. It is displayed at the top of the widget.
Chart: Select the saved Issues by status chart.
Description: Sets the description of the widget. It is displayed at the bottom of the widget.
Auto height: Sets the automatic height for Table and Markdown widgets. If this parameter is disabled, you can set the height of the widget on the page using the mouse.
Click Add. The widget will be displayed on the dashboard.
Save the dashboard:
In the top-right corner of the dashboard, click Save.
Enter a name for the dashboard and click Create.
For more information about setting up dashboards, see DataLens dashboard.
How to delete the resources you created
To stop scheduled invocations and release resources: