Skip to content

Commit c65d2b2

Browse files
committed
Merge branch 'main' of github.com:e2b-dev/infra into lev-block-cache-bitmap
2 parents 3f0daf4 + 5ba9cf5 commit c65d2b2

File tree

138 files changed

+2153
-625
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+2153
-625
lines changed

.github/actions/build-sandbox-template/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ runs:
88
env:
99
TEMPLATE_ID: "2j6ly824owf4awgai1xo"
1010
KERNEL_VERSION: "vmlinux-6.1.158"
11-
FIRECRACKER_VERSION: "v1.12.1_a41d3fb"
11+
FIRECRACKER_VERSION: "v1.12.1_210cbac"
1212
run: |
1313
# Generate an unique build ID for the template for this run
1414
export BUILD_ID=$(uuidgen)

.github/workflows/periodic-test.yml

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -103,56 +103,62 @@ jobs:
103103
E2B_ACCESS_TOKEN: ${{ env.E2B_ACCESS_TOKEN }}
104104
E2B_DOMAIN: ${{ matrix.e2b-domain }}
105105

106-
- name: Send Grafana OnCall webhook
106+
- name: Send incident.io alert
107107
if: always()
108+
continue-on-error: true
108109
env:
109110
JOB_STATUS: ${{ job.status }}
110111
DOMAIN: ${{ matrix.e2b-domain }}
111112
RUN_LINK: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
112-
WEBHOOK_URL: ${{ secrets.GRAFANA_ALERT_WEBHOOK }}
113+
WEBHOOK_URL: ${{ secrets.INCIDENT_IO_ALERT_SOURCE_URL }}
114+
ALERT_TOKEN: ${{ secrets.INCIDENT_IO_ALERT_TOKEN }}
113115
TEST_NAME: ${{ matrix.test-command.name }}
114116
run: |
115-
sudo apt-get update -qq && sudo apt-get install -y -qq jq # jq for JSON assembly
117+
sudo apt-get update -qq && sudo apt-get install -y -qq jq
116118
117-
# Map GH status → Grafana state
118-
STATE=$([ "$JOB_STATUS" = "success" ] && echo ok || echo alerting)
119+
# Map GH status to incident.io status
119120
STATUS=$([ "$JOB_STATUS" = "success" ] && echo resolved || echo firing)
120121
121-
# slug-ify the test name (lowercase, az/09, hyphens)
122+
# slug-ify the test name (lowercase, a-z/0-9, hyphens)
122123
TEST_SLUG=$(echo "$TEST_NAME" \
123124
| tr '[:upper:]' '[:lower:]' \
124125
| sed -E 's/[^a-z0-9]+/-/g; s/^-+|-+$//g')
125126
126-
# Unique per (domain + test) – same UID for state so OnCall auto-resolves
127-
ALERT_UID="periodic-tests-${DOMAIN//./-}-${TEST_SLUG}"
127+
# Unique per (domain + test) – same key so incident.io auto-resolves
128+
DEDUP_KEY="periodic-tests-${DOMAIN//./-}-${TEST_SLUG}"
128129
129130
TITLE="Periodic tests | ${DOMAIN} | ${TEST_NAME}"
130-
MESSAGE="${TEST_NAME} on ${DOMAIN} finished. Link: ${RUN_LINK}"
131+
DESCRIPTION="${TEST_NAME} on ${DOMAIN} finished with status: ${JOB_STATUS}. [View run](${RUN_LINK})"
131132
132-
# Attach a branch-status badge.
133+
# Attach a branch-status badge
133134
BADGE_COLOR=$([ "$JOB_STATUS" = "success" ] && echo brightgreen || echo CB2431)
134-
BADGE_LABEL_ESCAPED=$(echo "$ALERT_UID" | sed 's/-/--/g')
135+
BADGE_LABEL_ESCAPED=$(echo "$DEDUP_KEY" | sed 's/-/--/g')
135136
IMAGE_URL="https://img.shields.io/badge/${BADGE_LABEL_ESCAPED}-${JOB_STATUS}-${BADGE_COLOR}"
136137
137138
jq -n \
138-
--arg alert_uid "$ALERT_UID" \
139+
--arg deduplication_key "$DEDUP_KEY" \
139140
--arg title "$TITLE" \
140-
--arg state "$STATE" \
141141
--arg status "$STATUS" \
142-
--arg link_to_upstream_details "$RUN_LINK" \
143-
--arg message "$MESSAGE" \
144-
--arg image_url "$IMAGE_URL" \
142+
--arg source_url "$RUN_LINK" \
143+
--arg description "$DESCRIPTION" \
145144
--arg domain "$DOMAIN" \
146145
--arg dev "${{ inputs.dev }}" \
147-
'{alert_uid: $alert_uid,
146+
--arg image_url "$IMAGE_URL" \
147+
'{
148+
deduplication_key: $deduplication_key,
148149
title: $title,
149-
state: $state,
150-
link_to_upstream_details: $link_to_upstream_details,
151-
message: $message,
152-
severity: "warning",
153150
status: $status,
154-
domain: $domain,
155-
dev: ($dev == "true"),
156-
annotations: {Project: $domain},
157-
image_url: $image_url}' \
158-
| curl -s -X POST -H 'Content-Type: application/json' -d @- "$WEBHOOK_URL"
151+
source_url: $source_url,
152+
description: $description,
153+
metadata: {
154+
severity: "warning",
155+
domain: $domain,
156+
dev: ($dev == "true"),
157+
image_url: $image_url,
158+
project: $domain
159+
}
160+
}' \
161+
| curl -s --fail-with-body -X POST \
162+
-H 'Content-Type: application/json' \
163+
-H "Authorization: Bearer $ALERT_TOKEN" \
164+
-d @- "$WEBHOOK_URL"

iac/modules/job-otel-collector/configs/otel-collector.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,8 @@ processors:
230230
- "pgxpool.*"
231231
- "go\\..*"
232232
- "traefik.*"
233+
- "grpc\\..*"
234+
- "rpc\\.client.*"
233235

234236
filter/only_client_allocs:
235237
metrics:

iac/provider-gcp/Makefile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,6 @@ init:
111111
.PHONY: state-migrate
112112
state-migrate:
113113
@ printf "Running Terraform state migrations for env: `tput setaf 2``tput bold`$(ENV)`tput sgr0`\n\n"
114-
@ $(tf_vars) $(TF) state mv 'module.nomad.nomad_job.api' 'module.nomad.module.api.nomad_job.api' || true
115-
@ $(tf_vars) $(TF) state mv 'module.nomad.nomad_job.template_manager' 'module.nomad.module.template_manager.nomad_job.template_manager' || true
116-
@ $(tf_vars) $(TF) state mv 'module.nomad.nomad_job.nomad_nodepool_apm[0]' 'module.nomad.module.template_manager_autoscaler[0].nomad_job.nomad_nodepool_apm' || true
117-
@ $(tf_vars) $(TF) state mv 'module.nomad.nomad_job.redis[0]' 'module.nomad.module.redis[0].nomad_job.redis' || true
118114

119115
.PHONY: apply-init
120116
apply-init:

packages/api/go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ require (
5454
go.opentelemetry.io/otel/trace v1.41.0
5555
go.uber.org/zap v1.27.1
5656
golang.org/x/net v0.50.0
57-
golang.org/x/sync v0.19.0
57+
golang.org/x/sync v0.20.0
5858
google.golang.org/grpc v1.79.3
5959
google.golang.org/protobuf v1.36.11
6060
)
@@ -380,11 +380,11 @@ require (
380380
golang.org/x/arch v0.18.0 // indirect
381381
golang.org/x/crypto v0.48.0 // indirect
382382
golang.org/x/exp v0.0.0-20260212183809-81e46e3db34a // indirect
383-
golang.org/x/image v0.25.0 // indirect
383+
golang.org/x/image v0.38.0 // indirect
384384
golang.org/x/mod v0.33.0 // indirect
385385
golang.org/x/oauth2 v0.34.0 // indirect
386386
golang.org/x/sys v0.41.0 // indirect
387-
golang.org/x/text v0.34.0 // indirect
387+
golang.org/x/text v0.35.0 // indirect
388388
golang.org/x/time v0.14.0 // indirect
389389
golang.org/x/tools v0.42.0 // indirect
390390
google.golang.org/api v0.257.0 // indirect

packages/api/go.sum

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/api/internal/analytics_collector/client.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,25 @@ import (
66
"crypto/x509"
77
"fmt"
88

9+
"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
910
"google.golang.org/grpc"
1011
"google.golang.org/grpc/credentials"
1112
"google.golang.org/protobuf/types/known/emptypb"
1213

13-
"github.com/e2b-dev/infra/packages/shared/pkg/logger"
14+
e2bgrpc "github.com/e2b-dev/infra/packages/shared/pkg/grpc"
1415
)
1516

1617
type Analytics struct {
1718
client AnalyticsCollectorClient
1819
connection *grpc.ClientConn
1920
}
2021

21-
func NewAnalytics(ctx context.Context, host, grpcAPIKey string) (*Analytics, error) {
22+
func NewAnalytics(host, grpcAPIKey string) (*Analytics, error) {
2223
var client AnalyticsCollectorClient
2324
var connection *grpc.ClientConn
2425

25-
if host == "" {
26-
logger.L().Info(ctx, "Running dummy implementation of analytics collector client, no host provided")
27-
} else {
26+
// Run dummy client if host is not provided
27+
if host != "" {
2828
systemRoots, err := x509.SystemCertPool()
2929
if err != nil {
3030
errMsg := fmt.Errorf("failed to read system root certificate pool: %w", err)
@@ -39,6 +39,7 @@ func NewAnalytics(ctx context.Context, host, grpcAPIKey string) (*Analytics, err
3939

4040
conn, err := grpc.NewClient(
4141
fmt.Sprintf("%s:443", host),
42+
grpc.WithStatsHandler(otelgrpc.NewClientHandler()),
4243
grpc.WithPerRPCCredentials(newGRPCAPIKey(grpcAPIKey)),
4344
grpc.WithAuthority(host),
4445
grpc.WithTransportCredentials(cred),
@@ -67,6 +68,10 @@ func (a *Analytics) Close() error {
6768
return nil
6869
}
6970

71+
func (a *Analytics) Init(ctx context.Context) {
72+
e2bgrpc.ObserveConnection(ctx, a.connection, "analytics-collector")
73+
}
74+
7075
func (a *Analytics) InstanceStarted(ctx context.Context, in *InstanceStartedEvent, opts ...grpc.CallOption) (*emptypb.Empty, error) {
7176
if a.client == nil {
7277
return nil, nil

0 commit comments

Comments
 (0)