Skip to content
This repository has been archived by the owner on Jun 1, 2023. It is now read-only.

Monorail Metrics

Tim Anema edited this page May 19, 2020 · 4 revisions

Monorail metrics are baked into how the CLI operates and you do not need to implement this yourself. The following metrics are tracked for every run of the CLI as long as the user has consented. Because of this, the metric provided is not a whole picture so do not treat them as such. They are a snapshot.

These values are queryable in Mode on the monorail_app_cli_command_2 schema.

Name Type Allow null? Description
id int False instance ID used to identify one run from another
partner_id int True partner identifier to try and help specific partners if they are seeing more errors
args String False command line arguments that are passed to the CLI
project_type string True The project type that the CLI is operating on [ rails
time_start timestamp False when the command was started
time_end timestamp False when the command finished
run_time float False how long the command took to run
success bool False if the command exited with a successful status
error_message String True If the command was aborted, the stacktrace is captured here so that we can track bugs
api_key string True API key from the project that is being operated on.
cli_sha string False command line version
uname string False host and architechture
metadata string True any extra data that each project type might want to send along

Project type And Partner ID

project_type and partner_id are sourced from the shopify-cli.yml file written by your project:

ShopifyCli::Project.write(@context, app_type: 'fake', partner_id: 42)

If they are not present then they will not be logged. You can add the partner ID later on the process by overwriting the shopify-cli.yml file.

Metadata

The metadata field is a string field of extra data that your project type can add during runtime. This can be done by calling

ShopifyCli::Core::Monorail.metadata[:extention_type] = "foo"
ShopifyCli::Core::Monorail.metadata[:extention_variant] = "bar"

And this will be serialized as JSON into the metadata field.

Clone this wiki locally