Add store command shop id analytics#7429
Open
dmerand wants to merge 1 commit intodlm-store-command-metricsfrom
Open
Add store command shop id analytics#7429dmerand wants to merge 1 commit intodlm-store-command-metricsfrom
dmerand wants to merge 1 commit intodlm-store-command-metricsfrom
Conversation
Contributor
Author
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
4 tasks
6d2463a to
4e58f7b
Compare
fc65d9c to
18dd652
Compare
4 tasks
18dd652 to
a566b43
Compare
bac2759 to
c447b80
Compare
a566b43 to
8920736
Compare
8920736 to
d5ec5cc
Compare
c447b80 to
58ecacb
Compare
Contributor
Differences in type declarationsWe detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:
New type declarationsWe found no new type declarations in this PR Existing type declarationspackages/cli-kit/dist/public/node/metadata.d.ts@@ -34,7 +34,7 @@ export type SensitiveSchema<T> = T extends RuntimeMetadataManager<infer _TPublic
* @returns A container for the metadata.
*/
export declare function createRuntimeMetadataContainer<TPublic extends AnyJson, TSensitive extends AnyJson = Record<string, never>>(defaultPublicMetadata?: Partial<TPublic>): RuntimeMetadataManager<TPublic, TSensitive>;
-type CmdFieldsFromMonorail = PickByPrefix<MonorailEventPublic, 'cmd_all_'> & PickByPrefix<MonorailEventPublic, 'cmd_app_'> & PickByPrefix<MonorailEventPublic, 'cmd_create_app_'> & PickByPrefix<MonorailEventPublic, 'cmd_theme_'> & PickByPrefix<MonorailEventPublic, 'store_'> & PickByPrefix<MonorailEventPublic, 'env_auto_upgrade_'>;
+type CmdFieldsFromMonorail = Pick<MonorailEventPublic, 'shop_id'> & PickByPrefix<MonorailEventPublic, 'cmd_all_'> & PickByPrefix<MonorailEventPublic, 'cmd_app_'> & PickByPrefix<MonorailEventPublic, 'cmd_create_app_'> & PickByPrefix<MonorailEventPublic, 'cmd_theme_'> & PickByPrefix<MonorailEventPublic, 'store_'> & PickByPrefix<MonorailEventPublic, 'env_auto_upgrade_'>;
declare const coreData: RuntimeMetadataManager<CmdFieldsFromMonorail, {
commandStartOptions: {
startTime: number;
packages/cli-kit/dist/public/node/monorail.d.ts@@ -2,7 +2,7 @@ import { JsonMap } from '../../private/common/json.js';
import { DeepRequired } from '../common/ts/deep-required.js';
export { DeepRequired };
type Optional<T> = T | null;
-export declare const MONORAIL_COMMAND_TOPIC = "app_cli3_command/1.22";
+export declare const MONORAIL_COMMAND_TOPIC = "app_cli3_command/1.23";
export interface Schemas {
[MONORAIL_COMMAND_TOPIC]: {
sensitive: {
@@ -32,6 +32,7 @@ export interface Schemas {
node_version: string;
is_employee: boolean;
store_fqdn_hash?: Optional<string>;
+ shop_id?: Optional<number>;
user_id: string;
cmd_all_alias_used?: Optional<string>;
cmd_all_launcher?: Optional<string>;
packages/cli-kit/dist/public/node/session.d.ts@@ -16,6 +16,12 @@ export interface Session {
userId: string;
}
export type AccountInfo = UserAccountInfo | ServiceAccountInfo | UnknownAccountInfo;
+/**
+ * Records the user ID that should be attached to command analytics for this process.
+ *
+ * @param userId - User identifier to report on the command analytics event.
+ */
+export declare function setLastSeenUserId(userId: string): void;
interface UserAccountInfo {
type: 'UserAccount';
email: string;
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

WHY are these changes introduced?
This is the
shop_idportion of store command analytics attribution, split from #7428 because it depends on a Monorail schema update.Together with the reliable
user_idrecorded by #7428,shop_idgives downstream analytics the attribution dimensions they need forshopify store auth/shopify store execute.Schema dependency:
shop_id: longasapp_cli3_command/1.23app_cli3_command/1.23WHAT is this pull request doing?
Adds best-effort
shop_idrecording for store commands:shop_idto the local cli-kit Monorail schema mirrorMONORAIL_COMMAND_TOPICfromapp_cli3_command/1.22toapp_cli3_command/1.23gid://shopify/Shop/123shop_idafterstore authby querying Admin GraphQLshop { id }with the newly acquired tokenshop_idduring normalstore executeversion discovery by addingshop { id }to the existing AdminpublicApiVersionsrequestshop_idforstore execute --version unstablethrough the standalone best-effort Admin helper, since that path skips version discoveryImportant constraints preserved:
shop { id }as the source of truth forshop_idPost-release steps
payload.shop_idwhere CLI analytics consumers need it.Checklist