chore: generate

This commit is contained in:
opencode-agent[bot]
2026-05-25 22:35:28 +00:00
parent 5b02ac4d33
commit 16a30041b3
6 changed files with 135 additions and 169 deletions
+12 -30
View File
@@ -13,13 +13,10 @@ const glueS3TablesDatabaseWildcardArn = $interpolate`arn:${partition.partition}:
const glueS3TablesTableWildcardArn = $interpolate`arn:${partition.partition}:glue:${region.region}:${current.accountId}:table/${glueCatalogName}/${tableBucketName}/*/*`
const s3TablesBucketWildcardArn = $interpolate`arn:${partition.partition}:s3tables:${region.region}:${current.accountId}:bucket/*`
export const tableBucket = new aws.s3tables.TableBucket(
"LakeTableBucket",
{
export const tableBucket = new aws.s3tables.TableBucket("LakeTableBucket", {
name: tableBucketName,
forceDestroy: $app.stage !== "production",
},
)
})
const s3TablesCatalog = new aws.cloudcontrol.Resource(
"LakeS3TablesCatalog",
@@ -54,25 +51,17 @@ const s3TablesCatalog = new aws.cloudcontrol.Resource(
{ dependsOn: [tableBucket] },
)
const athenaResultsBucket = new aws.s3.Bucket(
"LakeAthenaResults",
{
const athenaResultsBucket = new aws.s3.Bucket("LakeAthenaResults", {
bucket: `opencode-${$app.stage}-lake-athena-results`,
forceDestroy: $app.stage !== "production",
},
)
})
const firehoseErrorBucket = new aws.s3.Bucket(
"LakeFirehoseErrors",
{
const firehoseErrorBucket = new aws.s3.Bucket("LakeFirehoseErrors", {
bucket: `opencode-${$app.stage}-lake-firehose-errors`,
forceDestroy: $app.stage !== "production",
},
)
})
const athenaWorkgroup = new aws.athena.Workgroup(
"LakeAthenaWorkgroup",
{
const athenaWorkgroup = new aws.athena.Workgroup("LakeAthenaWorkgroup", {
name: `opencode-${$app.stage}-lake-workgroup`,
forceDestroy: $app.stage !== "production",
configuration: {
@@ -82,12 +71,9 @@ const athenaWorkgroup = new aws.athena.Workgroup(
outputLocation: $interpolate`s3://${athenaResultsBucket.bucket}/`,
},
},
},
)
})
const firehoseRole = new aws.iam.Role(
"LakeFirehoseRole",
{
const firehoseRole = new aws.iam.Role("LakeFirehoseRole", {
assumeRolePolicy: aws.iam.getPolicyDocumentOutput({
statements: [
{
@@ -102,12 +88,9 @@ const firehoseRole = new aws.iam.Role(
},
],
}).json,
},
)
})
const firehosePolicy = new aws.iam.RolePolicy(
"LakeFirehosePolicy",
{
const firehosePolicy = new aws.iam.RolePolicy("LakeFirehosePolicy", {
role: firehoseRole.id,
policy: aws.iam.getPolicyDocumentOutput({
statements: [
@@ -168,8 +151,7 @@ const firehosePolicy = new aws.iam.RolePolicy(
},
],
}).json,
},
)
})
const firehose = new aws.kinesis.FirehoseDeliveryStream(
"LakeFirehose",
@@ -2,9 +2,7 @@
"version": "6",
"dialect": "mysql",
"id": "72655266-65da-408e-bfd8-9f3a4ad817a5",
"prevIds": [
"00000000-0000-0000-0000-000000000000"
],
"prevIds": ["00000000-0000-0000-0000-000000000000"],
"ddl": [
{
"name": "stat",
@@ -515,9 +513,7 @@
"table": "stat"
},
{
"columns": [
"id"
],
"columns": ["id"],
"name": "PRIMARY",
"table": "stat",
"entityType": "pks"
@@ -2,9 +2,7 @@
"version": "6",
"dialect": "mysql",
"id": "e246639a-0da0-4fbd-b7bb-f1781d407780",
"prevIds": [
"72655266-65da-408e-bfd8-9f3a4ad817a5"
],
"prevIds": ["72655266-65da-408e-bfd8-9f3a4ad817a5"],
"ddl": [
{
"name": "geo_stat",
@@ -1601,25 +1599,19 @@
"table": "provider_stat"
},
{
"columns": [
"id"
],
"columns": ["id"],
"name": "PRIMARY",
"table": "geo_stat",
"entityType": "pks"
},
{
"columns": [
"id"
],
"columns": ["id"],
"name": "PRIMARY",
"table": "model_stat",
"entityType": "pks"
},
{
"columns": [
"id"
],
"columns": ["id"],
"name": "PRIMARY",
"table": "provider_stat",
"entityType": "pks"
+1 -5
View File
@@ -10,11 +10,7 @@ export type StatDimension = "model" | "provider" | "geo"
export function buildStatsQuery(periodStart: Date, periodEnd: Date, dimension: StatDimension) {
const periodStartValue = sqlString(periodStart.toISOString())
const periodEndValue = sqlString(periodEnd.toISOString())
const sourceTable = [
Resource.InferenceEvent.catalog,
Resource.InferenceEvent.database,
Resource.InferenceEvent.table,
]
const sourceTable = [Resource.InferenceEvent.catalog, Resource.InferenceEvent.database, Resource.InferenceEvent.table]
.map(sqlIdentifier)
.join(".")
const dimensionSql = (() => {
+4 -5
View File
@@ -40,15 +40,13 @@ export class Ingest extends Context.Service<Ingest, Ingest.Service>()("@opencode
})
}
const failed = (
yield* Effect.all(
const failed = (yield* Effect.all(
chunks(
records.map((event) => ({ Data: Buffer.from(JSON.stringify(event)) })),
MAX_FIREHOSE_BATCH_SIZE,
).map((batch) => putRecords(client, Resource.LakeIngestConfig.streamName, batch)),
{ concurrency: 8 },
)
).reduce((sum, item) => sum + item, 0)
)).reduce((sum, item) => sum + item, 0)
if (failed > 0) {
return yield* new IngestError({ message: "Failed to ingest all lake records", failed })
@@ -75,7 +73,8 @@ const putRecords: (
) {
const result = yield* Effect.tryPromise({
try: () => client.send(new PutRecordBatchCommand({ DeliveryStreamName: streamName, Records: records })),
catch: (cause) => new IngestError({ message: "Failed to write lake records to Firehose", failed: records.length, cause }),
catch: (cause) =>
new IngestError({ message: "Failed to write lake records to Firehose", failed: records.length, cause }),
})
const failed =
result.RequestResponses?.flatMap((item, index) => {
+2 -1
View File
@@ -25,7 +25,8 @@ export const Routes = HttpRouter.use((router) =>
}),
)
const ingest = (ingestService: Ingest.Service) => Effect.gen(function* () {
const ingest = (ingestService: Ingest.Service) =>
Effect.gen(function* () {
const request = yield* HttpServerRequest.HttpServerRequest
if (!isAuthorized(request.headers)) return yield* json(401, { ok: false, error: "Unauthorized" })