Skip to content
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

Pass in tenant_id to kv_store in monitoring job #3726

Merged
merged 1 commit into from
Jan 20, 2025
Merged

Conversation

Weves
Copy link
Contributor

@Weves Weves commented Jan 20, 2025

Description

We weren't passing in the right tenant ID for cloud-monitoring -> silent telemetry failures.

https://linear.app/danswer/issue/DAN-1296/fix-monitoring-telemetry-on-our-cloud

How Has This Been Tested?

kubectl cped the files over to the monitoring pod and ran:

>>> from telemetry import optional_telemetry, RecordType
>>> data = {'metric_name': 'sync_start_latency_seconds', 'float_value': 0.0}
>>> optional_telemetry(record_type=RecordType.METRIC, data=data, user_id=None, tenant_id='<SOME_TENANT>')

Then verified we got the expected packet on the telemetry server.

Backporting (check the box to trigger backport action)

Note: You have to check that the action passes, otherwise resolve the conflicts manually and tag the patches.

  • This PR should be backported (make sure to check that the backport attempt succeeds)
  • [Optional] Override Linear Check

Copy link

vercel bot commented Jan 20, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
internal-search ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 20, 2025 9:42pm

Comment on lines 31 to +34
def __init__(
self, redis_client: Redis | None = None, tenant_id: str | None = None
) -> None:
self.tenant_id = tenant_id or CURRENT_TENANT_ID_CONTEXTVAR.get()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slightly wary of default None to the current tenant ID. Elsewhere, we treat it as a valid tenant ID / as POSTGRES_DEFAULT_SCHEMA. Had a similar debate around get_session_with_tenant (default to a sentinel if nothing passed in?, etc.) and ended up deciding on different entrypoint (get_session_with_default_tenant)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -94,16 +94,16 @@ def optional_telemetry(
if DISABLE_TELEMETRY:
return

tenant_id = tenant_id or CURRENT_TENANT_ID_CONTEXTVAR.get()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar comment here

@Weves Weves merged commit 1378364 into main Jan 20, 2025
12 of 15 checks passed
@Weves Weves deleted the fix-monitoring-telem branch January 20, 2025 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants