Sourcegraph 3.15: Campaigns beta available, GitHub repository permissions, experimental AND/OR operators, and improved observability
Explore, navigate, and better understand all code, everywhere, faster with Sourcegraph Universal Code Search. Uber, Lyft, Yelp, and other enterprises rely on Sourcegraph to improve developer productivity and manage large-scale code changes.
π£ Campaigns beta available to all site admins
π Faster syncing of GitHub repository permissions
π Experimental AND/OR operators for search contents
π New visibility filter for scoping searches to public or private repositories
π Getting started prompt contains more context
𧩠Extension and code intelligence UI improvements
βοΈ User event logs available in user settings
π§ͺ Experimental deterministic search results
π΄ Setting to include forked and archived repositories
π Deploy Sourcegraph behind a proxy
π Changelog
Every detail that changed in this release
ποΈ Thank you
Sourcegraph couldn't be what it is without the community.
Deploy or upgrade: Local | AWS | DigitalOcean | Kubernetes cluster
Go in-depth with the 3.15 release by watching the recorded livestream with Product Manager Christina Forney and CTO Beyang Liu.
NOTE: Sourcegraph site admins should definitely check out Beyang discussing improvements to monitoring, observability, and alerting.
Campaigns beta available to all site admins
Campaigns are available for general use in beta by any Sourcegraph instance admin. Users of Sourcegraph.com will need to run a private Sourcegraph instance with their repositories added to try running campaigns on their code. Sourcegraph admins can enable campaigns on their instance by adding {"experimentalFeatures": { "automation": "enabled" }}β
to their site configuration settings.
We are excited to hear about the campaigns you run, answer questions you have, and hear your feedback! Get in touch on Twitter @sourcegraph, file an issue in our public issue tracker, or email [email protected].
Campaigns are currently in beta. During the beta period, campaigns are free to use. After the beta period, campaigns will be available as a paid add-on. Please contact us for more information.
Faster syncing of GitHub repository permissions
Sourcegraph 3.15 adds faster repository permissions syncing at scale for GitHub. This functionality was previously introduced for GitLab and Bitbucket Server in Sourcegraph 3.14. Rather than syncing a userβs permissions when they log in and potentially blocking them from seeing search results, Sourcegraph syncs these permissions asynchronously in the background, opportunistically refreshing them in a timely manner. See the documentation for more details.
Enable this feature by adding "permissions.backgroundSync": {"enabled": true}
in your site configuration settings.
Experimental AND/OR operators for search contents
Search for file contents using AND and OR expressions in queries. These operators enable more expressive searches in regexp and structural search modes. The documentation includes more details about how to these operators and their precedence and grouping.
For example, if you want to find all of the places where two functions are within the same file, you can use the AND operator: conf.Get( and log15.Error(
β see example query results.
Or, if you want to find everywhere two functions are used whether or not the other is present, you would use the OR operator: conf.Get( or log15.Error(
β see example query results.
You can even use them together: ("conf.Get(" or "log15.Error(") and after
β see example query results.
Currently, operators only support searching file contents and do not apply to search scopes - you will see an alert if your query is not supported.
Enable this feature by adding {"experimentalFeatures": {"andOrQuery": "enabled"}}
to site configuration settings.
Improved observability
We continue to invest heavily in making Sourcegraph easier to monitor and debug out-of-the-box.
Monitoring
- Sourcegraph now has pre-defined alerts for 93 metrics across 14 services for improved monitoring. For now, these new alerts are warning-level alerts. In the future, they will be elevated to critical-level alerts when there is more confidence in their accuracy.
- 8 bug fixes to alerting and dashboards.
- 11 changes to improve the legibility and visibility of dashboards.
Additionally:
- All dashboard panels now show an orange/red background when a metric is reaching its warning/critical threshold, making it easy to see which metrics are most interesting.
- Search error rate and latency is now broken down by type on the frontend dashboard:
- Search at a glance (browser web UI).
- Search-based code intelligence at a glance.
- Search API usage at a glance.
IMPORTANT: If you have previously configured alert thresholds on the frontend dashboard manually (instead of on the Grafana home dashboard as typically recommended), you will need to reconfigure those alert thresholds again after upgrading.
Debugging
We've added a new tool to all Sourcegraph deployments by default: Distributed tracing. It is a powerful tool for investigating performance issues. You can enable tracing selectively per-request and capture detailed information about, for example, a search request which can then easily be inspected to find out what the slowest parts were within the inner-workings of Sourcegraph.
To use tracing, please see our documentation.
Additionally, it is now possible to log all search and GraphQL requests slower than N milliseconds, using the new site configuration options observability.logSlowGraphQLRequests
and observability.logSlowSearches
. When Sourcegraph's monitoring (or your instances' users) inform you that queries are slow, this allows you to see the exact details of the search or GraphQL request needed to reproduce it.
New visibility filter for scoping searches to public or private repositories
The new visibility:
search scope enables filtering based on a repositoryβs shared state on the code host. Scope options include any, public, or private, and defaults to visibility:any
when the scope is not specified.
Getting started prompt contains more context
When using Sourcegraph for the first time on a private instance, a getting started section is shown to help admins and users make sure their Sourcegraph instance is properly configured, and that they know how to perform a search. The getting started steps now include more context about how to complete each step.
Extension and code intelligence UI improvements
Even small things can have a large impact on user experience, and we are working on improving how users interact with Sourcegraph. For this release, we cleaned up the design of buttons contributed by extensions in the Sourcegraph webapp and on code host integrations. In addition, we reworked our logic for when we display loading indicators in hover tooltips that sometimes caused tooltips to not show up reliably. These changes provide a more consistent experience with visual elements and component interactions.
User event logs available in user settings
Users and site administrators can now view a log of their actions/events in user settings. This enables site admins to perform rough audits of users and also helps users better understand the information Sourcegraph logs.
Experimental deterministic search results
A new experimental search scope stable:true
has been added to provide results with a deterministic search result order. This search scope only applies to file contents and is limited to 5,000 maximum results. You should consider using the paginated search API if you need more than 5,000 results.
Setting to include forked and archived repositories
Sourcegraph 3.14 removed archived and forked repositories from search results by default. While this was an improvement to most users, some organizations have a configuration that necessitates searching these repositories. Sourcegraph 3.15 enables those organizations to add a global setting to their instance to always include forks or archived repositories in searches. Enable this in global, organization, or user settings with "search.includeForks": true
or "search.includeArchived": true
respectively.
Deploy Sourcegraph behind a proxy
For organizations that need to run Sourcegraph behind a proxy, git fetch
and git clone
now inherit the parent process environment variables. This allows site admins to set HTTPS_PROXY or git http configurations via environment variables. For cluster environments, site admins should set this on the gitserver container.
Changelog
Added
-
Users and site administrators can now view a log of their actions/events in the user settings. #9141
-
With the new
visibility:
filter, search results can now be filtered based on a repository's visibility (possible filter values:any
,public
orprivate
). #8344 -
sourcegraph/git-extras
is now enabled by default on new instances. #3501 -
The Sourcegraph Docker image will now copy
/etc/sourcegraph/gitconfig
to$HOME/.gitconfig
. This is a convenience similiar to what we provide for repositories that need HTTP(S) or SSH authentication. #658 -
Permissions background syncing is now supported for GitHub via site configuration
"permissions.backgroundSync": {"enabled": true}
. #8890 -
Search: Adding
stable:true
to a query ensures a deterministic search result order. This is an experimental parameter. It applies only to file contents, and is limited to max. 5,000 results (consider using the paginated search API if you need more than that.). #9681. -
After completing the Sourcegraph user feedback survey, a button may appear for tweeting this feedback at @sourcegraph. #9728
-
git fetch
andgit clone
now inherit the parent process environment variables. This allows site admins to setHTTPS_PROXY
or git http configurations via environment variables. For cluster environments, site admins should set this on the gitserver container. #250 -
Experimental: Search for file contents using
and
- andor
-expressions in queries. This is enabled via the global settings value{"experimentalFeatures": {"andOrQuery": "enabled"}}
. #8567 -
Always include forks or archived repositories in searches via the global/org/user settings with
"search.includeForks": true
or"search.includeArchived": true
respectively. #9927 -
Observability (debugging): It is now possible to log all search and GraphQL requests slower than N milliseconds, using the new site configuration options
observability.logSlowGraphQLRequests
andobservability.logSlowSearches
. -
Observability (monitoring): More metrics monitored and alerted on, more legible dashboards
- Dashboard panels now show an orange/red background color when the defined warning/critical alert threshold has been met, making it even easier to see what is in a bad state on a dashboard.
- Symbols: Failing
symbols
->frontend-internal
requests are now monitored. #9732 - Frontend dashboard: Search error types are now broken into distinct panels for improved visibility/legibility.
- IMPORTANT: If you have previously configured alerting on any of these panels or on "hard search errors", you will need to reconfigure it after upgrading.
- Frontend dashboard: Search error and latency are now broken down by type: Browser requests, search-based code intel requests, and API requests.
-
Observability (debugging): Distributed tracing is a powerful tool for investigating performance issues. The following changes have been made with the goal of making it easier to use distributed tracing with Sourcegraph:
-
The site configuration field
"observability.tracing": { "sampling": "..." }
allows a site admin to control which requests generate tracing data."all"
will trace all requests."selective"
(recommended) will trace all requests initiated from an end-user URL with?trace=1
. Non-end-user-initiated requests can set a HTTP headerX-Sourcegraph-Should-Trace: true
. This is the recommended setting, as"all"
can generate large amounts of tracing data that may cause network and memory resource contention in the Sourcegraph instance."none"
(default) turns off tracing.
-
Jaeger is now the officially supported distributed tracing system. The following is the recommended site configuration to connect Sourcegraph to a Jaeger agent (which must be deployed on the same host and listening on the default ports):
-
Jaeger is now included in the Sourcegraph deployment configuration by default if you are using Kubernetes, Docker Compose, or the pure Docker cluster deployment model. It is not yet included in the single Docker container distribution. Jaeger will be included as part of upgrading to 3.15 in these deployment models, unless disabled.
-
The site configuration field,
useJaeger
, is deprecated in favor ofobservability.tracing
. -
Support for configuring Lightstep as a distributed tracer is deprecated and will be removed in a subsequent release. Instances that use Lightstep with Sourcegraph are encouraged to migrate to Jaeger (directions for running Jaeger alongside Sourcegraph are included in the installation instructions).
-
Changed
- Multiple backwards-incompatible changes in the parts of the GraphQL API related to Campaigns #9106:
CampaignPlan.status
has been removed, since we don't need it anymore after moving execution of campaigns to src CLI in #8008.CampaignPlan
has been renamed toPatchSet
.ChangesetPlan
/ChangesetPlanConnection
has been renamed toPatch
/PatchConnection
.CampaignPlanPatch
has been renamed toPatchInput
.Campaign.plan
has been renamed toCampaign.patchSet
.Campaign.changesetPlans
has been renamed tocampaign.changesetPlan
.createCampaignPlanFromPatches
mutation has been renamed tocreatePatchSetFromPatches
.
- Removed the scoped search field on tree pages. When browsing code, the global search query will now get scoped to the current tree or file. #9225
- Instances without a license key that exceed the published user limit will now display a notice to all users.
Fixed
.*
in the filter pattern were ignored and led to missing search results. #9152- The Phabricator integration no longer makes duplicate requests to Phabricator's API on diff views. #8849
- Changesets on repositories that aren't available on the instance anymore are now hidden instead of failing. #9656
- Observability (monitoring):
- Dashboard and alerting bug fixes
- Syntect Server dashboard: "Worker timeouts" can no longer appear to go negative. #9523
- Symbols dashboard: "Store fetch queue size" can no longer appear to go negative. #9731
- Syntect Server dashboard: "Worker timeouts" no longer incorrectly shows multiple values. #9524
- Searcher dashboard: "Search errors on unindexed repositories" no longer includes cancelled search requests (which are expected).
- Fixed an issue where NaN could leak into the
alert_count
metric. #9832 - Gitserver: "resolve_revision_duration_slow" alert is no longer flaky/non-deterministic. #9751
- Git Server dashboard: There is now a panel to show concurrent command executions to match the defined alerts. #9354
- Git Server dashboard: Adjusted the critical disk space alert to 15% so it can now fire. #9351
- Dashboard visiblity and legibility improvements
- All: "frontend internal errors" are now broken down just by route, which makes reading the graph easier. #9668
- Frontend dashboard: Panels no longer show misleading duplicate labels. #9660
- Syntect Server dashboard: Panels are no longer compacted, for improved visibility. #9525
- Frontend dashboard: Panels are no longer compacted, for improved visibility. #9356
- Searcher dashboard: "Search errors on unindexed repositories" is now broken down by code instead of instance for improved readability. #9670
- Symbols dashboard: Metrics are now aggregated instead of per-instance, for improved visibility. #9730
- Firing alerts are now correctly sorted at the top of dashboards by default. #9766
- Panels at the bottom of the home dashboard no longer appear clipped/cut off. #9768
- Git Server dashboard: Disk usage now shown in percentages to match the alerts that can fire. #9352
- Git Server dashboard: The 'echo command duration test' panel now properly displays units in seconds. #7628
- Dashboard panels showing firing alerts no longer over-count firing alerts due to the number of service replicas. #9353
- Dashboard and alerting bug fixes
The changelog for this and previous releases is available on GitHub.
Thank you
Thank you to the many people who contributed to Sourcegraph since the last release!
- @francisjeanneau
- @craffert0
- @carloslfu
- @bastiankoetsier
- @aisbaa
- @mofr
- @Akarshit
- @maxhallinan
- @Warchant
- @amarsiingh
- @KGmajor
- @remcoros
- @dwgillies
- @shyim
- @mntky
- @shadyabhi
- @Antoine98
- @JoshuaKGoldberg
- @jlangston
- @wangbinyq
- @CSharperMantle
- @danielpops
- @khoslaventures
- @sixhobbits
- @zgrimshell
- @wrakky
- @caarlos0
- @DoomGerbil
- @nathanverrilli
- @yaohui-wyh
- @abeyerpath
- @saurabh-hirani
- @marco-c
- @gbrik
- @benhansenslc
- @Reagankm
Deploy or upgrade: Local | AWS | DigitalOcean | Kubernetes cluster
From the entire Sourcegraph team (@sourcegraph), happy coding!