Skip to content

Commit 4bb93c9

Browse files
authored
feat(analytics): Adds analytics dashboard (#358)
* add deps * hook up dau from audit table to analytics page * add audit event for code nav * analytics dashboard * add changelog entry * add news entry * smaller video and news data nit * feedback
1 parent fb2ef05 commit 4bb93c9

File tree

36 files changed

+1814
-97
lines changed

36 files changed

+1814
-97
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
- Added analytics dashboard. [#358](https://github.com/sourcebot-dev/sourcebot/pull/358)
12+
1013
### Fixed
1114
- Fixed issue where invites appeared to be created successfully, but were not actually being created in the database. [#359](https://github.com/sourcebot-dev/sourcebot/pull/359)
1215

16+
### Changed
17+
- Audit logging is now enabled by default. [#358](https://github.com/sourcebot-dev/sourcebot/pull/358)
18+
1319
## [4.4.0] - 2025-06-18
1420

1521
### Added

docs/docs.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
]
3737
},
3838
"docs/features/code-navigation",
39+
"docs/features/analytics",
3940
"docs/features/mcp-server",
4041
{
4142
"group": "Agents",

docs/docs/configuration/audit-logs.mdx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ action, and when the action took place.
1212

1313
This feature gives security and compliance teams the necessary information to ensure proper governance and administration of your Sourcebot deployment.
1414

15-
## Enabling Audit Logs
16-
Audit logs must be explicitly enabled by setting the `SOURCEBOT_EE_AUDIT_LOGGING_ENABLED` [environment variable](/docs/configuration/environment-variables) to `true`
15+
## Enabling/Disabling Audit Logs
16+
Audit logs are enabled by default and can be controlled with the `SOURCEBOT_EE_AUDIT_LOGGING_ENABLED` [environment variable](/docs/configuration/environment-variables).
1717

1818
## Fetching Audit Logs
1919
Audit logs are stored in the [postgres database](/docs/overview#architecture) connected to Sourcebot. To fetch all of the audit logs, you can use the following API:
@@ -40,7 +40,7 @@ curl --request GET '$SOURCEBOT_URL/api/ee/audit' \
4040
{
4141
"id": "cmc146c8r0001xgo2xyu0p463",
4242
"timestamp": "2025-06-17T22:47:58.587Z",
43-
"action": "query.code_search",
43+
"action": "user.performed_code_search",
4444
"actorId": "cmc12tnje0000xgn58jj8655h",
4545
"actorType": "user",
4646
"targetId": "1",
@@ -54,7 +54,7 @@ curl --request GET '$SOURCEBOT_URL/api/ee/audit' \
5454
{
5555
"id": "cmc12vqgb0008xgn5nv5hl9y5",
5656
"timestamp": "2025-06-17T22:11:44.171Z",
57-
"action": "query.code_search",
57+
"action": "user.performed_code_search",
5858
"actorId": "cmc12tnje0000xgn58jj8655h",
5959
"actorType": "user",
6060
"targetId": "1",
@@ -68,7 +68,7 @@ curl --request GET '$SOURCEBOT_URL/api/ee/audit' \
6868
{
6969
"id": "cmc12txwn0006xgn51ow1odid",
7070
"timestamp": "2025-06-17T22:10:20.519Z",
71-
"action": "query.code_search",
71+
"action": "user.performed_code_search",
7272
"actorId": "cmc12tnje0000xgn58jj8655h",
7373
"actorType": "user",
7474
"targetId": "1",
@@ -116,6 +116,9 @@ curl --request GET '$SOURCEBOT_URL/api/ee/audit' \
116116
| `api_key.deleted` | `user` | `api_key` |
117117
| `user.creation_failed` | `user` | `user` |
118118
| `user.owner_created` | `user` | `org` |
119+
| `user.performed_code_search` | `user` | `org` |
120+
| `user.performed_find_references` | `user` | `org` |
121+
| `user.performed_goto_definition` | `user` | `org` |
119122
| `user.jit_provisioning_failed` | `user` | `org` |
120123
| `user.jit_provisioned` | `user` | `org` |
121124
| `user.join_request_creation_failed` | `user` | `org` |
@@ -131,9 +134,6 @@ curl --request GET '$SOURCEBOT_URL/api/ee/audit' \
131134
| `user.signed_out` | `user` | `user` |
132135
| `org.ownership_transfer_failed` | `user` | `org` |
133136
| `org.ownership_transferred` | `user` | `org` |
134-
| `query.file_source` | `user \| api_key` | `file` |
135-
| `query.code_search` | `user \| api_key` | `org` |
136-
| `query.list_repositories` | `user \| api_key` | `org` |
137137

138138

139139
## Response schema

docs/docs/configuration/environment-variables.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ The following environment variables allow you to configure your Sourcebot deploy
3939
### Enterprise Environment Variables
4040
| Variable | Default | Description |
4141
| :------- | :------ | :---------- |
42-
| `SOURCEBOT_EE_AUDIT_LOGGING_ENABLED` | `false` | <p>Enables/disables audit logging</p> |
42+
| `SOURCEBOT_EE_AUDIT_LOGGING_ENABLED` | `true` | <p>Enables/disables audit logging</p> |
4343
| `AUTH_EE_ENABLE_JIT_PROVISIONING` | `false` | <p>Enables/disables just-in-time user provisioning for SSO providers.</p> |
4444
| `AUTH_EE_GITHUB_BASE_URL` | `https://github.com` | <p>The base URL for GitHub Enterprise SSO authentication.</p> |
4545
| `AUTH_EE_GITHUB_CLIENT_ID` | `-` | <p>The client ID for GitHub Enterprise SSO authentication.</p> |

docs/docs/features/analytics.mdx

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
title: Analytics
3+
sidebarTitle: Analytics
4+
---
5+
6+
import LicenseKeyRequired from '/snippets/license-key-required.mdx'
7+
import { Callout } from 'nextra/components'
8+
9+
<LicenseKeyRequired />
10+
11+
12+
## Overview
13+
14+
Analytics provides comprehensive insights into your organization's usage of Sourcebot, helping you understand adoption patterns and
15+
quantify the value of time saved.
16+
17+
This dashboard is backed by [audit log](/docs/configuration/audit-logs) events. Please ensure you have audit logging enabled in order to see these insights.
18+
19+
<video
20+
autoPlay
21+
muted
22+
loop
23+
playsInline
24+
className="w-full aspect-video"
25+
src="/images/analytics_demo.mp4"
26+
></video>
27+
28+
## Data Metrics
29+
30+
### Active Users
31+
Tracks the number of unique users who performed any Sourcebot operation within each time period. This metric helps you understand team adoption
32+
and engagement with Sourcebot.
33+
34+
![DAU Chart](/images/dau_chart.png)
35+
36+
### Code Searches
37+
Counts the number of code search operations performed by your team.
38+
39+
![Code Search Chart](/images/code_search_chart.png)
40+
41+
### Code Navigation
42+
Tracks "Go to Definition" and "Find All References" navigation actions. Navigation actions help developers quickly move
43+
between code locations and understand code relationships.
44+
45+
![Code Nav Chart](/images/code_nav_chart.png)
46+
47+
## Cost Savings Calculator
48+
49+
The analytics dashboard includes a built-in cost savings calculator that helps you quantify the ROI of using Sourcebot.
50+
51+
![Cost Savings Chart](/images/cost_savings_chart.png)

docs/images/analytics_demo.mp4

4.18 MB
Binary file not shown.

docs/images/code_nav_chart.png

597 KB
Loading

docs/images/code_search_chart.png

612 KB
Loading

docs/images/cost_savings_chart.png

739 KB
Loading

docs/images/dau_chart.png

561 KB
Loading

0 commit comments

Comments
 (0)