TrackProject collects and tracks information about the project for instrumentation.
()
| 23 | |
| 24 | // TrackProject collects and tracks information about the project for instrumentation. |
| 25 | func (app *DdevApp) TrackProject() { |
| 26 | // defer util.TimeTrack()() |
| 27 | |
| 28 | // Initialization is currently done before via init() func somewhere while |
| 29 | // creating the ddevapp. This should be cleaned up. |
| 30 | // TODO: Remove once clean up has done. |
| 31 | amplitude.InitAmplitude() |
| 32 | |
| 33 | // Early exit if instrumentation is disabled. |
| 34 | if ampli.Instance.Disabled { |
| 35 | return |
| 36 | } |
| 37 | |
| 38 | containersOmitted := app.GetOmittedContainers() |
| 39 | |
| 40 | var services []string |
| 41 | containers, err := dockerutil.GetAppContainers(app.Name) |
| 42 | if err == nil { |
| 43 | for _, k := range containers { |
| 44 | if len(k.Names) == 0 { |
| 45 | continue |
| 46 | } |
| 47 | serviceName := strings.TrimPrefix(k.Names[0], "/") |
| 48 | shortName := strings.Replace(serviceName, fmt.Sprintf("ddev-%s-", app.Name), "", 1) |
| 49 | services = append(services, shortName) |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | //builder := ampli.Project.Builder().Id(app.ProtectedID()). |
| 54 | // |
| 55 | //builder := ampli.Project.Builder().Id(app.ProtectedID()).PerformanceMode().PhpVersion().ProjectType().WebserverType().DdevVersionConstraint().NoProjectMount().WebimageExtraPackages().DbImageExtraPackages().DatabaseType().DatabaseVersion().CorepackEnable()a |
| 56 | builder := ampli.Project.Builder(). |
| 57 | Id(app.ProtectedID()). |
| 58 | PerformanceMode(app.GetPerformanceMode()). |
| 59 | PhpVersion(app.GetPhpVersion()). |
| 60 | ProjectType(app.GetType()). |
| 61 | WebserverType(app.GetWebserverType()). |
| 62 | XhProfMode(app.GetXHProfMode()). |
| 63 | AddOns(GetInstalledAddonNames(app)). |
| 64 | Containers(services). |
| 65 | ContainersOmitted(containersOmitted). |
| 66 | FailOnHookFail(app.FailOnHookFail || app.FailOnHookFailGlobal). |
| 67 | NodejsVersion(app.NodeJSVersion). |
| 68 | RouterDisabled(IsRouterDisabled(app)). |
| 69 | WebExtraDaemonsDetails(webExtraDaemonsDetails(app)). |
| 70 | WebExtraDaemonsNames(webExtraDaemonsNames(app)). |
| 71 | WebExtraExposedPortsDetails(webExtraExposedPortsDetails(app)). |
| 72 | WebExtraExposedPortsNames(webExtraExposedPortsNames(app)). |
| 73 | WebimageExtraPackages(app.WebImageExtraPackages). |
| 74 | DbImageExtraPackages(app.DBImageExtraPackages). |
| 75 | BindAllInterfaces(app.BindAllInterfaces). |
| 76 | CorepackEnable(app.CorepackEnable). |
| 77 | DdevVersionConstraint(app.DdevVersionConstraint). |
| 78 | DisableSettingsManagement(app.DisableSettingsManagement). |
| 79 | NoProjectMount(app.NoProjectMount).Ci(os.Getenv("CI") == "true") |
| 80 | |
| 81 | if !nodeps.ArrayContainsString(containersOmitted, "db") { |
| 82 | builder. |