Skip to content

Commit

Permalink
feat: Add tracking for feature flags loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
olivermrbl committed Aug 9, 2022
1 parent 4befede commit f760ba4
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions packages/medusa/src/loaders/index.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
import loadConfig from "./config"
import {
asFunction,
asValue,
AwilixContainer,
createContainer,
Resolver,
} from "awilix"
import { ClassOrFunctionReturning } from "awilix/lib/container"
import { Express, NextFunction, Request, Response } from "express"
import { track } from "medusa-telemetry"
import "reflect-metadata"
import Logger from "./logger"
import requestIp from "request-ip"
import { Connection, getManager } from "typeorm"
import { MedusaContainer } from "../types/global"
import apiLoader from "./api"
import featureFlagsLoader from "./feature-flags"
import loadConfig from "./config"
import databaseLoader from "./database"
import defaultsLoader from "./defaults"
import expressLoader from "./express"
import featureFlagsLoader from "./feature-flags"
import Logger from "./logger"
import modelsLoader from "./models"
import passportLoader from "./passport"
import pluginsLoader, { registerPluginModels } from "./plugins"
import redisLoader from "./redis"
import repositoriesLoader from "./repositories"
import requestIp from "request-ip"
import searchIndexLoader from "./search-index"
import servicesLoader from "./services"
import strategiesLoader from "./strategies"
import subscribersLoader from "./subscribers"
import { ClassOrFunctionReturning } from "awilix/lib/container"
import { Connection, getManager } from "typeorm"
import { Express, NextFunction, Request, Response } from "express"
import {
asFunction,
asValue,
AwilixContainer,
createContainer,
Resolver,
} from "awilix"
import { track } from "medusa-telemetry"
import { MedusaContainer } from "../types/global"

type Options = {
directory: string
Expand Down Expand Up @@ -82,6 +82,7 @@ export default async ({
})

const featureFlagRouter = featureFlagsLoader(configModule, Logger)
track("FEATURE_FLAGS_LOADED")

container.register({
logger: asValue(Logger),
Expand Down Expand Up @@ -179,7 +180,8 @@ export default async ({
const searchActivity = Logger.activity("Initializing search engine indexing")
track("SEARCH_ENGINE_INDEXING_STARTED")
await searchIndexLoader({ container })
const searchAct = Logger.success(searchActivity, "Indexing event emitted") || {}
const searchAct =
Logger.success(searchActivity, "Indexing event emitted") || {}
track("SEARCH_ENGINE_INDEXING_COMPLETED", { duration: searchAct.duration })

return { container, dbConnection, app: expressApp }
Expand Down

0 comments on commit f760ba4

Please sign in to comment.