Skip to content

Commit d2829f0

Browse files
committed
fix gcp function
1 parent 21dce9b commit d2829f0

2 files changed

Lines changed: 110 additions & 1 deletion

File tree

telemetry/bigquery_schema.json

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
[
2+
{
3+
"name": "timestamp",
4+
"type": "TIMESTAMP",
5+
"mode": "REQUIRED",
6+
"description": "When the telemetry data was received"
7+
},
8+
{
9+
"name": "workspace_id_sha1",
10+
"type": "STRING",
11+
"mode": "REQUIRED",
12+
"description": "SHA1 hash of the workspace ID"
13+
},
14+
{
15+
"name": "contacts_count",
16+
"type": "INTEGER",
17+
"mode": "NULLABLE",
18+
"description": "Number of contacts in the workspace"
19+
},
20+
{
21+
"name": "broadcasts_count",
22+
"type": "INTEGER",
23+
"mode": "NULLABLE",
24+
"description": "Number of broadcasts in the workspace"
25+
},
26+
{
27+
"name": "transactional_count",
28+
"type": "INTEGER",
29+
"mode": "NULLABLE",
30+
"description": "Number of transactional notifications in the workspace"
31+
},
32+
{
33+
"name": "messages_count",
34+
"type": "INTEGER",
35+
"mode": "NULLABLE",
36+
"description": "Number of messages in the workspace"
37+
},
38+
{
39+
"name": "lists_count",
40+
"type": "INTEGER",
41+
"mode": "NULLABLE",
42+
"description": "Number of lists in the workspace"
43+
},
44+
{
45+
"name": "api_endpoint",
46+
"type": "STRING",
47+
"mode": "NULLABLE",
48+
"description": "API endpoint of the Notifuse instance"
49+
},
50+
{
51+
"name": "source",
52+
"type": "STRING",
53+
"mode": "NULLABLE",
54+
"description": "Source of the telemetry data"
55+
},
56+
{
57+
"name": "event_type",
58+
"type": "STRING",
59+
"mode": "NULLABLE",
60+
"description": "Type of event"
61+
},
62+
{
63+
"name": "mailgun",
64+
"type": "BOOLEAN",
65+
"mode": "NULLABLE",
66+
"description": "Whether Mailgun integration is active"
67+
},
68+
{
69+
"name": "amazonses",
70+
"type": "BOOLEAN",
71+
"mode": "NULLABLE",
72+
"description": "Whether Amazon SES integration is active"
73+
},
74+
{
75+
"name": "mailjet",
76+
"type": "BOOLEAN",
77+
"mode": "NULLABLE",
78+
"description": "Whether Mailjet integration is active"
79+
},
80+
{
81+
"name": "sendgrid",
82+
"type": "BOOLEAN",
83+
"mode": "NULLABLE",
84+
"description": "Whether SendGrid integration is active"
85+
},
86+
{
87+
"name": "postmark",
88+
"type": "BOOLEAN",
89+
"mode": "NULLABLE",
90+
"description": "Whether Postmark integration is active"
91+
},
92+
{
93+
"name": "smtp",
94+
"type": "BOOLEAN",
95+
"mode": "NULLABLE",
96+
"description": "Whether SMTP integration is active"
97+
},
98+
{
99+
"name": "s3",
100+
"type": "BOOLEAN",
101+
"mode": "NULLABLE",
102+
"description": "Whether S3 file storage is active"
103+
}
104+
]

telemetry/main.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"encoding/json"
66
"log"
77
"net/http"
8+
"os"
89
"strings"
910
"time"
1011

@@ -67,7 +68,11 @@ func init() {
6768
// Initialize Google Cloud Logging client
6869
ctx := context.Background()
6970
var err error
70-
loggingClient, err = logging.NewClient(ctx, "")
71+
projectID := os.Getenv("GCP_PROJECT")
72+
if projectID == "" {
73+
log.Fatalf("GCP_PROJECT environment variable is not set")
74+
}
75+
loggingClient, err = logging.NewClient(ctx, projectID)
7176
if err != nil {
7277
log.Fatalf("Failed to create logging client: %v", err)
7378
}

0 commit comments

Comments
 (0)