Christina Forney on December 20, 2019
Sourcegraph is the standard developer platform for code search and navigation at many of the largest and most advanced technology companies. With Sourcegraph, every company has access to the same kind of tools that Google and Facebook developers use every day.
🏗 Introducing code-aware structural search
🛠 Management console removed to simplify configuration
📊 Comprehensive overhaul of instance health monitoring and dashboards
⚙️ Global settings now configurable via local file
🤖 Find and remove leaked NPM credentials
🔎 Search query language statistics
🗞 In other news
How Lyft used Sourcegraph during its monolith to microservice decomposition and Sourcegraph proudly sponsoring GitLab Commit.
📝 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
Sourcegraph 3.11 introduces structural search, a code-aware search syntax that can identify structural patterns in code. This enables advanced code search to specifically match patterns inside code structures such as function parameters and loop bodies.
It can be awkward or difficult to match code blocks or nested expressions with regexp. To meet this challenge we’ve introduced a new and easier way to search code that operates more closely on the parse tree of the input using Comby syntax for structural matching.
For example, this can be used to find all the places that fmt.Sprintf
are unnecessary:
patterntype:structural 'fmt.Sprintf(":[str]")'
Or to identify all the places an http.Client
is created with a Transport
:
patterntype:structural "http.Client{:[a] Transport: :[b] :[c]}"
In these examples, the :[str]
part is a hole with a descriptive name str
that matches code. The important part is that these patterns understand that the structural pieces (e.g. parentheses and braces) are balanced.
Known limitations:
patterntype:structural
to activate the search type.The management console has been completely removed and there is now a single site configuration on the Site admin -> Configuration page. The current management console configuration will be automatically merged into your site configuration after upgrading your instance.
In the rare event that your Sourcegraph instance is misconfigured and causes the UI to become inaccessible, we have added an escape hatch file that allows you to edit your site configuration without the web UI. Upon saving, the updated configuration will be synchronized from the file and applied to your Sourcegraph instance.
NOTE:
If you’re using the CRITICAL_CONFIG_FILE
or SITE_CONFIG_FILE
environment variables please see our management console migration guide for more details.
Recent Sourcegraph versions introduced standardized Prometheus and Grafana monitoring bundled with Sourcegraph. Sourcegraph 3.11 introduces a new set of dashboards and high-level health metrics that make it easier to understand the health of your Sourcegraph instance at a glance:
These dashboards are built using a new set of combinatorial alerting metrics we have introduced for each service. These allow site admins to measure the number of critical and warning-class alerts their Sourcegraph instance is facing:
Alerting can be configured easily through these metrics, so admins can get Email, Slack, PagerDuty, (and many more) alerts when an instance is unhealthy.
Future versions will add more exhaustive alert definitions and more detailed information on these dashboards, so please stay tuned!
Some teams prefer updating Sourcegraph configuration in version control rather than through the Site admin UI. In Sourcegraph 3.11, admins can configure their instance to load global settings from a file on-disk using the new GLOBAL_SETTINGS_FILE
environment variable. Sourcegraph 3.4 enabled this functionality for external services and site configuration.
Credential leaks compromise organization code and are a top concern for security teams and developers alike. Sourcegraph 3.11 introduces a new campaign type to find and remove leaked NPM credentials across all repositories at your organization. The leaked credentials campaign type allows you to preview the proposed changes, create pull requests on your code hosts, and track the PRs in a burndown chart to ensure they are merged.
Code change management campaigns are in private beta. Watch the campaigns screencasts to see what we have planned, and apply for early access to campaigns for your organization.
A new experimental feature has been added to show language statistics about your search query. Search result pages now have a Stats link to a visual breakdown of the languages that comprise the results for the query. This data is also available through our GraphQL API.
Language analysis is computationally expensive, so this feature is currently behind a feature flag. To enable, update your global, organization, or user settings to include { “experimentalFeatures”: { “searchStats”: true } }
.
This month we published a new case study showing how Sourcegraph code search helped ensure production stability at Lyft during their monolith to microservices decomposition.
Sourcegraph is sponsoring GitLab Commit in San Francisco this January. We’re looking forward to speaking with GitLab users about the importance of IDE quality code intelligence when browsing and reviewing code on GitLab. We’d love to see you there! Come say hello and pick up some great swag at our booth on level 1.
Important: If you use SITE_CONFIG_FILE
or CRITICAL_CONFIG_FILE
, please be sure to follow the steps in: migration notes for Sourcegraph v3.11+ after upgrading.
GLOBAL_SETTINGS_FILE
.repohascommitafter:
search filter uses a more efficient git command to determine inclusion. #6739NODE_NAME
can be specified instead of HOSTNAME
for zoekt-indexserver. HOSTNAME
was a confusing configuration to use in Pure-Docker Sourcegraph deployments. #6846LanguageStatistics
fields to name
, totalBytes
, and totalLines
(previously the field names started with an uppercase letter, which was inconsistent).USE_ENHANCED_LANGUAGE_DETECTION
env var to the string false
(on the sourcegraph/server
container, or if using the cluster deployment, on the sourcegraph-frontend
pod).before:
and after:
filters to narrow their search area are now no longer subject to the 50-repository limit. This allows for creating saved searches on more than 50 repositories as before. #7215src_graphql_search_response
Prometheus metric) now properly account for search alerts instead of them being incorrectly added to the timeout
category. #7214cloning
, missing
, and other repository fields now return a well-defined set of results. #6000SITE_CONFIG_FILE
/ CRITICAL_CONFIG_FILE
, please see the migration notes for Sourcegraph v3.11+.The changelog for this and previous releases is available on GitHub.
Thank you to the many people who contributed to Sourcegraph since the last release!
Deploy or upgrade: Local | AWS | DigitalOcean | Kubernetes cluster
From the entire @sourcegraph team, happy coding!