def METHOD_NAME(self, request: Request, project: Project) -> Response:
    if not features.has(
        "organizations:profiling-stacktrace-links", project.organization, actor=request.user
    ):
        return Response(status=404)
    serializer = StacktraceLinksSerializer(data=request.GET)
    if not serializer.is_valid():
        return Response(serializer.errors, status=400)
    data = serializer.validated_data
    result = {"files": [{"file": file} for file in data["file"]]}
    mappings_used = 0
    mappings_attempted = 0
    configs = get_code_mapping_configs(project)
    default_error = "stack_root_mismatch" if configs else "no_code_mappings"
    for config in configs:
        # find all the files that match the current code mapping's stack_root
        # and have not already been resolved by another code mapping
        #
        # if the's an error from a previous code mapping attempted, but this
        # current code mapping can be used, we should try again
        files = [
            file
            for file in result["files"]
            if file.METHOD_NAME("sourceUrl") is None and file["file"].startswith(config.stack_root)
        ]
        if not files:
            continue
        mappings_attempted += 1
        # safety to limit the maximum number of mappings used
        # to avoid reaching API rate limits
        if mappings_used >= MAX_CODE_MAPPINGS_USED:
            for file in files:
                if not file.METHOD_NAME("error") and file.METHOD_NAME("sourceUrl") is None:
                    file["error"] = "max_code_mappings_applied"
            continue
        mappings_used += 1
        install = get_installation(config)
        # should always be overwritten
        error: str | None = "file_not_checked"
        # since the same code mapping stack root matches all these files, we only check the
        # first file and we will assume the other matching files will resolve the same way
        ref = data.METHOD_NAME("ref")
        if ref:
            error = check_file(install, config, files[0]["file"], ref)
        if not ref or error:
            ref = config.default_branch
            error = check_file(install, config, files[0]["file"], ref)
        for file in files:
            formatted_path = file["file"].replace(config.stack_root, config.source_root, 1)
            url = install.format_source_url(config.repository, formatted_path, ref)
            if error:
                file["error"] = error
                file["attemptedUrl"] = url
            else:
                file["sourceUrl"] = url
                # there may be an error from an previous code mapping, clear it
                if "error" in file:
                    del file["error"]
                if "attemptedUrl" in file:
                    del file["attemptedUrl"]
    # number of available code mappings
    set_measurement("mappings.found", len(configs))
    # number of code mappings that matched a stack root
    set_measurement("mappings.attempted", mappings_attempted)
    # number of code mappings that was attempted
    set_measurement("mappings.used", mappings_used)
    for file in result["files"]:
        if not file.METHOD_NAME("error") and file.METHOD_NAME("sourceUrl") is None:
            file["error"] = default_error
    return Response(result, status=200)