Untitled

 avatar
unknown
plain_text
5 days ago
8.2 kB
5
No Index
 📊 BACKEND TELEMETRY (Java)

  1. Instance Heartbeat (Every 6 hours)

  // ScheduledTaskCEImpl.java:127-142
  return WebClientUtils.create("https://api.segment.io")
      .post()
      .uri("/v1/track")
      .headers(headers -> headers.setBasicAuth(ceKey, ""))
      .contentType(MediaType.APPLICATION_JSON)
      .body(BodyInserters.fromValue(Map.of(
          "userId", instanceId,
          "context", Map.of("ip", ipAddress),
          "properties", Map.of("instanceId", instanceId,
                              "organizationId", organizationId),
          "event", "Instance Active")))
      .retrieve()
      .bodyToMono(String.class);

  2. Daily Stats (Every 24 hours)

  // ScheduledTaskCEImpl.java:193-230
  Map<String, Object> propertiesMap = Map.ofEntries(
      entry("instanceId", statsData.getT1()),
      entry("organizationId", statsData.getT2()),
      entry("numOrgs", statsData.getT4().getT1()),           // Workspace count
      entry("numApps", statsData.getT4().getT2()),           // App count
      entry("numPages", statsData.getT4().getT3()),          // Page count
      entry("numActions", statsData.getT4().getT4()),        // Query/API count
      entry("numDatasources", statsData.getT4().getT5()),    // Datasource count
      entry("numUsers", statsData.getT4().getT6()),          // User count
      entry("numPublicApps", statsData.getT5()),
      entry("DAU", dau),                                     // Daily active users
      entry("WAU", wau),                                     // Weekly active users
      entry("MAU", mau),                                     // Monthly active users
      entry("version", projectProperties.getVersion()),
      entry("edition", deploymentProperties.getEdition()),
      entry("cloudProvider", deploymentProperties.getCloudProvider()),
      entry("hostname", deploymentProperties.getHostname())
  );

  3. User Identification

  // AnalyticsServiceCEImpl.java:142-165
  analytics.enqueue(IdentifyMessage.builder()
      .userId(hash(username))                    // SHA256 hashed
      .traits(Map.of(
          "name", hash(name),                    // SHA256 hashed
          "email", hash(email),                  // SHA256 hashed
          "emailDomainHash", emailDomainHash,
          "isSuperUser", isSuperUser,
          "instanceId", instanceId,
          "organizationId", organizationId,
          "mostRecentlyUsedWorkspaceId", workspaceId,
          "proficiency", userData.getProficiency(),  // "Beginner/Intermediate/Expert"
          "goal", userData.getUseCase())));          // "Build internal tools", etc.

  4. Datasource Creation

  // DatasourceStorageServiceCEImpl.java:73-74
  .flatMap(savedDatasourceStorage -> analyticsService.sendCreateEvent(
      savedDatasourceStorage, getAnalyticsProperties(savedDatasourceStorage)));
  // Sends: event="create_datasourcestorage", pluginType="PostgreSQL", etc.

  5. Every Event Gets Enriched

  // AnalyticsServiceCEImpl.java:276-288
  analyticsProperties.put("originService", "appsmith-server");
  analyticsProperties.put("instanceId", instanceId);
  analyticsProperties.put("version", projectProperties.getVersion());
  analyticsProperties.put("edition", deploymentProperties.getEdition());
  analyticsProperties.put("cloudProvider", deploymentProperties.getCloudProvider());
  analyticsProperties.put("hostname", deploymentProperties.getHostname());
  analyticsProperties.put("deployedAt", deploymentProperties.getDeployedAt());

  ---
  📱 FRONTEND TELEMETRY (JavaScript/TypeScript)

  User Actions

  Login:
  // Login.tsx:317-319
  AnalyticsUtil.logEvent("LOGIN_CLICK", {
    loginMethod: "EMAIL",
  });

  Signup:
  // SignUp.tsx:118, 303
  AnalyticsUtil.logEvent("SIGNUP_REACHED", { /* ... */ });
  AnalyticsUtil.logEvent("SIGNUP_CLICK", { /* ... */ });

  Page View:
  // UserWelcomeScreen.tsx:29
  AnalyticsUtil.logEvent("PAGE_VIEW", { /* page data */ });

  App Lifecycle

  Create App:
  // ApplicationSagas.tsx:637
  AnalyticsUtil.logEvent("CREATE_APP", {
    appName: "My App",
    isPrivate: true,
    // ...
  });

  Publish App:
  // ApplicationSagas.tsx:161-168
  AnalyticsUtil.logEvent("PUBLISH_APP", {
    appId,
    appName,
    pageCount,
    isPublic: !!currentApplication?.isPublic,
    templateTitle: currentApplication?.forkedFromTemplateTitle,
  });

  Widget Operations

  Widget Property Updates:
  // PropertyControl.tsx:514-520
  AnalyticsUtil.logEvent("WIDGET_PROPERTY_UPDATE", {
    widgetType: widgetProperties.type,      // "ButtonWidget", "TableWidget", etc.
    widgetName: widgetProperties.widgetName,
    updates,                                 // What property changed
    isUpdatedViaKeyboard,
    isUpdatedFromSearchResult: props.isSearchResult,
  });

  API/Query Execution

  Execute Action:
  // PluginActionSaga.ts:587
  AnalyticsUtil.logEvent("EXECUTE_ACTION", actionExecutionAnalytics);
  // actionExecutionAnalytics contains:
  // - actionId
  // - actionName
  // - datasourceType: "PostgreSQL", "REST API", etc.
  // - executionTime
  // - responseSize

  Success/Failure:
  // PluginActionSaga.ts:631, 656
  AnalyticsUtil.logEvent("EXECUTE_ACTION_FAILURE", { /* ... */ });
  AnalyticsUtil.logEvent("EXECUTE_ACTION_SUCCESS", { /* ... */ });

  Datasource Operations

  Create Datasource:
  // APIOrSaasPlugins.tsx:106, 118
  AnalyticsUtil.logEvent("CREATE_DATA_SOURCE_CLICK", {
    pluginName: "PostgreSQL",
    pluginId: "xyz",
  });

  Git Operations

  Commit & Push:
  // TabDeployView.tsx:204
  AnalyticsUtil.logEvent("GS_COMMIT_AND_PUSH_BUTTON_CLICK", {
    repoUrl: "...",
    branchName: "main",
  });

  Pull:
  // TabDeployView.tsx:221
  AnalyticsUtil.logEvent("GS_PULL_GIT_CLICK", { /* ... */ });

  Discard:
  // TabDeployView.tsx:231
  AnalyticsUtil.logEvent("GIT_DISCARD_WARNING", { /* ... */ });

  Admin Settings

  Visit Settings:
  // AnonymousDataPopup.tsx:61
  AnalyticsUtil.logEvent("VISIT_ADMIN_SETTINGS_TELEMETRY_CALLOUT");

  Upgrade Prompts:
  // useOnUpgrade.ts:37
  logEventName || "ADMIN_SETTINGS_UPGRADE"

  ---
  🎥 SESSION RECORDING (Mixpanel)

  Initialization:
  // Original mixpanel.ts (now disabled)
  mixpanel.init(apiKey, {
    track_pageview: true,
    persistence: "localStorage",
    ip: false,
    api_host: "https://api.mixpanel.com",
  });

  // Session recording
  mixpanel.set_config({
    record_sessions_percent: 50,  // Records 50% of sessions!
    record_block_selector: ".sensitive-data",
  });

  ---
  📹 USER TRACKING (Smartlook)

  Initialization:
  // Original smartlook.ts (now disabled)
  smartlook("init", smartlookId, {
    region: "eu",
    cookies: true,
    recordingEnabled: true,
  });

  smartlook("identify", userId, {
    email: userEmail,
  });

  ---
  🔍 GRAFANA FARO (Observability)

  Initialization:
  // Original instrumentation/index.ts (now disabled)
  this.faro = initializeFaro({
    url: tracingUrl,  // Sends to Appsmith's Grafana instance
    app: {
      name: serviceName,
      version: appVersion.sha,
      environment: deploymentName,
    },
    instrumentations: [
      new ReactIntegration(),
      ...getWebInstrumentations({}),
    ],
    trackResources: true,           // Track all HTTP requests
    trackWebVitalsAttribution: true, // Track performance metrics
  });

  Error Capture:
  // instrumentation/index.ts:152-158
  this.faro.api.pushError(
    exception instanceof Error ? exception : new Error(String(exception)),
    { type: "error", context: context }
  );

  ---
  📈 WHAT EACH ACTION SENDS

  Every frontend event includes:
  {
    ...eventData,                        // Your specific data
    ...getEventExtraProperties(),        // Global context
    instanceId: "abc-123",
    version: "v1.9.51",
    edition: "Community",
    emailDomainHash: "sha256(...)",
    adminEmailDomainHash: "sha256(...)"
  }

  Every backend event includes:
  {
    "userId": "sha256(username)",
    "context": { "userAgent": "...", "ip": "..." },
    "properties": {
      "originService": "appsmith-server",
      "instanceId": "...",
      "version": "v1.9.51",
      "edition": "Community",
      "cloudProvider": "aws",
      "hostname": "your-domain.com",
      // ... plus event-specific data
    }
  }
Editor is loading...
Leave a Comment