-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
feat(stacktrace-link): Add RepositoryProjectPathConfig table #21331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
This PR has a migration; here is the generated SQL BEGIN;
--
-- Create model RepositoryProjectPathConfig
--
CREATE TABLE "sentry_repositoryprojectpathconfig" ("id" bigserial NOT NULL PRIMARY KEY, "date_updated" timestamp with time zone NOT NULL, "date_added" timestamp with time zone NULL, "stack_root" text NOT NULL, "source_root" text NOT NULL, "default_branch" text NULL, "organization_integration_id" bigint NOT NULL, "project_id" bigint NOT NULL, "repository_id" bigint NOT NULL);
--
-- Alter unique_together for repositoryprojectpathconfig (1 constraint(s))
--
ALTER TABLE "sentry_repositoryprojectpathconfig" ADD CONSTRAINT "sentry_repositoryproject_project_id_stack_root_e376b891_uniq" UNIQUE ("project_id", "stack_root");
ALTER TABLE "sentry_repositoryprojectpathconfig" ADD CONSTRAINT "sentry_repositorypro_organization_integra_d70daa81_fk_sentry_or" FOREIGN KEY ("organization_integration_id") REFERENCES "sentry_organizationintegration" ("id") DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE "sentry_repositoryprojectpathconfig" ADD CONSTRAINT "sentry_repositorypro_repository_id_e5400943_fk_sentry_re" FOREIGN KEY ("repository_id") REFERENCES "sentry_repository" ("id") DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX "sentry_repositoryprojectpa_organization_integration_i_d70daa81" ON "sentry_repositoryprojectpathconfig" ("organization_integration_id");
CREATE INDEX "sentry_repositoryprojectpathconfig_project_id_0de53adf" ON "sentry_repositoryprojectpathconfig" ("project_id");
CREATE INDEX "sentry_repositoryprojectpathconfig_repository_id_e5400943" ON "sentry_repositoryprojectpathconfig" ("repository_id");
COMMIT; |
| __core__ = False | ||
|
|
||
| repository = FlexibleForeignKey("sentry.Repository") | ||
| project = FlexibleForeignKey("sentry.Project", db_constraint=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wedamija I wasn't sure if I should have added db_index=False here if the unique constraint will also create an index.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can, it's probably fine either way. That's really just an optimisation, and this table probably won't be large enough or high volume enough for it to be important.
| class RepositoryProjectPathConfig(DefaultFieldsModel): | ||
| __core__ = False | ||
|
|
||
| repository = FlexibleForeignKey("sentry.Repository") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MeredithAnya should we have db_constraint=False here as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's probably fine, I don't think repository is very high volume. Can't check at the moment :(
wedamija
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Migration looks good to me
| __core__ = False | ||
|
|
||
| repository = FlexibleForeignKey("sentry.Repository") | ||
| project = FlexibleForeignKey("sentry.Project", db_constraint=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can, it's probably fine either way. That's really just an optimisation, and this table probably won't be large enough or high volume enough for it to be important.
| class RepositoryProjectPathConfig(DefaultFieldsModel): | ||
| __core__ = False | ||
|
|
||
| repository = FlexibleForeignKey("sentry.Repository") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's probably fine, I don't think repository is very high volume. Can't check at the moment :(
| ('input_path', models.TextField()), | ||
| ('output_path', models.TextField()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stack_path and repository_path might be clearer names for how these columns would be used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@scefali what are your thoughts? I like these names
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MeredithAnya maybe base_stack_path and base_repository_path might make more sense
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about stack_root, source_root? @scefali I actually think using repo might seem like it should include the repo as part of the path
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MeredithAnya sounds good to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stack_root an source_root are 🌈
ed43d18 to
ef8fa70
Compare
Context:
Ecosystem is working on making stack trace linking a core piece of the repository provider integrations (GH, GitLab, etc). This means taking someone from a file in the Sentry stack trace to a file in their source code. There are challenges with finding out exactly where to link someone:
This why we've decided to have a configuration required, the configuration may change over time as we iterate, so the explanation in this PR description is may be outdated later.
Configuration Fields:
project,repositoryprojectandrepositoryare self explanatory, therepositoryhas the integration_id andwe can get an organization_integration from the project.organization and the integration.organization_integrationinput_path,output_pathinput_pathis the part of the stack trace file path that needs to be replaced with a different value, which is theoutput_path. If the file doesn't need re-formatting, both the input and output paths can be empty strings.default_branch