mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 20:11:54 +00:00
This change adds support for provisioning a BigQuery dataset and tables for a service to write to, similar to how we set up Cody Gateway. For now, we provision only a single BigQuery table - the intent is to allow services to generate their own telemetry events, which should only have a single table.
For schema configuration, we ask that it be provided as a JSON file alongside the spec, i.e.
```
service.yaml
${mytable}.bigquerytable.json
```
Basic configuration just looks like this:
```yaml
environments:
- id: ...
# ...
resources:
bigQueryDataset:
tables:
- "example"
```
Example diff: https://github.com/sourcegraph/managed-services/pull/116
Usage:
```go
bq, err := contract.BigQuery.GetTableWriter(ctx, "example")
if err != nil {
return nil, errors.Wrap(err, "BigQuery.GetTableWriter")
}
if err := bq.Write(ctx, BigQueryEntry{
Name: "service.started",
CreatedAt: time.Now(),
}); err != nil {
return nil, errors.Wrap(err, "bq.Write")
}
```
For usage, we wrap `bigquery.Inserter` using a helper that guides users to implement `bigquery.ValueSaver`, which is what we do in Cody Gateway.
This change also removes the service-env-var prefix, which I've decided might be rather useless :) it's not currently used at all.
Closes https://github.com/sourcegraph/sourcegraph/issues/56849
|
||
|---|---|---|
| .. | ||
| googlesecretsmanager | ||
| internal | ||
| spec | ||
| terraformcloud | ||
| BUILD.bazel | ||
| cdktf.go | ||
| CODENOTIFY | ||
| managedservicesplatform.go | ||