|
| 1 | +# Inventory Stats |
| 2 | + |
| 3 | +<p type="subtitle">Learn about your project's inventory stats type of Code Insights.</p> |
| 4 | + |
| 5 | +An inventory stats code insight lets you track code inventory metrics such as file counts, lines of code, and language usage trends in your repositories. Sourcegraph Code Search Enterprise users can track these metrics across all repositories in their organization. |
| 6 | + |
| 7 | +To create an inventory stats code insight: |
| 8 | + |
| 9 | +- Navigate to the Code Insights tab from the Sourcegraph instance |
| 10 | +- Click on the **Create insight** button |
| 11 | +- Select **Inventory Stats** as the type of insight |
| 12 | +- Choose your list of target repositories on which you want to perform an insight |
| 13 | +- Next, pick the inventory metrics you want to track, like lines of code, file size, and file count |
| 14 | +- Finally, add a **title** and **granularity** of the insight |
| 15 | +- And click **Create code insight** once you are done |
| 16 | + |
| 17 | +While configuring these fields, you can also see a live preview of the insight on the right side of the page. |
| 18 | + |
| 19 | +After you have created the insight, you can view it on the **Code Insights** tab. |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | +Now, you can perform all the actions you can on other Code Insights, such as editing, filtering, sharing, and deleting. |
| 24 | + |
| 25 | +## Inventory environment variables |
| 26 | + |
| 27 | +<Callout type="note">We have made some changes to the inventory environment variables for our self-hosted customers. Cloud customers are not impacted by this change.</Callout> |
| 28 | + |
| 29 | +If you are a self-hosted Sourcegraph Enterprise user, we have moved the inventory environment variables into the **Site configuration** settings in your **Site admin** page. You can find it under the **inventory** section. |
| 30 | + |
| 31 | +Here's a list of all the inventory environment variables and their default values: |
| 32 | + |
| 33 | +- `USE_ENHANCED_LANGUAGE_DETECTION: "disableEnhancedLanguageDetection"`: defaults to false |
| 34 | +- `GET_INVENTORY_GIT_SERVER_CONCURRENCY: "gitServerConcurrency"`: defaults to 4 |
| 35 | +- `GET_INVENTORY_REDIS_CONCURRENCY: "redisConcurrency"`: defaults to 20 |
| 36 | +- `GET_INVENTORY_MAX_INV_IN_MEMORY: "maxInventoryInMemory"`: defaults to 1000 |
| 37 | +- `GET_INVENTORY_TIMEOUT: "timeoutInMinutes"`: defaults to 5 |
| 38 | + |
| 39 | +Here's an example from the site configuration section: |
| 40 | + |
| 41 | +```json |
| 42 | +"inventory" : { |
| 43 | + "disableEnhancedLanguageDetection": false, |
| 44 | + "gitServerConcurrency": 4, |
| 45 | + "redisConcurrency": 20, |
| 46 | + "maxInventoryInMemory": 1000, |
| 47 | + "timeoutInMinutes": 5 |
| 48 | +} |
| 49 | +``` |
| 50 | + |
| 51 | +<Callout type="info">To accommodate default values in your Site configuration vs. environment variables, the positive `USE_ENHANCED_LANGUAGE_DETECTION` env var has been changed to the negative `disableEnhancedLanguageDetection`.</Callout> |
0 commit comments