Skip to content

Commit

Permalink
fix hobby deploy routing logs/traces to self (highlight#7709)
Browse files Browse the repository at this point in the history
## Summary

When running the hobby deploy with `./run-hobby.sh`, logs and traces
would be sent to the stack itself
rather than to our cloud collector (when telemetry was enabled) because
of the default value of the
`OTLP_ENDPOINT`. Correct this to allow collecting phonehome telemetry
data.
Fixes recent regression that would prevent local dev from recording
sessions.

## How did you test this change?

before
<img width="1707" alt="Screenshot 2024-02-08 at 12 34 33 PM"
src="https://github.com/highlight/highlight/assets/1351531/53cbff5a-db7f-47ab-bf10-ac8a900be4c8">

after
<img width="1604" alt="Screenshot 2024-02-08 at 12 36 29 PM"
src="https://github.com/highlight/highlight/assets/1351531/3b57c5ea-ebbd-4013-b3f3-504705101036">

<img width="1565" alt="Screenshot 2024-02-08 at 12 36 17 PM"
src="https://github.com/highlight/highlight/assets/1351531/50a7f0b4-1ce6-4db5-93f9-152f79e916ad">

https://www.loom.com/share/90b4ade1a6c749af93d10b8b54cbd35e

## Are there any deployment considerations?

no

## Does this work require review from our design team?

no
  • Loading branch information
Vadman97 authored Feb 8, 2024
1 parent 0ba84c5 commit 33ad55d
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 16 deletions.
2 changes: 1 addition & 1 deletion backend/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func main() {

// change OTLP endpoint when set in env
if otlpEndpoint != "" {
log.WithContext(ctx).Info("overwriting highlight-go graphql / otlp client address...")
log.WithContext(ctx).WithField("otlpEndpoint", otlpEndpoint).Info("overwriting highlight-go graphql / otlp client address...")
highlight.SetOTLPEndpoint(otlpEndpoint)
}

Expand Down
2 changes: 1 addition & 1 deletion docker/.env
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ENVIRONMENT=dev
FRONTEND_URI=https://localhost:3000
KAFKA_SERVERS=kafka:9092
KAFKA_TOPIC=dev
OTLP_ENDPOINT=http://collector:4318
OTLP_ENDPOINT=http://localhost:4318
TZ=America/Los_Angeles
PSQL_DB=postgres
PSQL_HOST=postgres
Expand Down
51 changes: 39 additions & 12 deletions docker/compose.hobby.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
x-depends-infra: &depends-infra
depends_on:
kafka:
condition: service_started
redis:
condition: service_started
postgres:
condition: service_healthy
clickhouse:
condition: service_started
collector:
condition: service_started
x-logging: &local-logging
driver: local

x-backend-env: &backend-env
environment:
Expand Down Expand Up @@ -49,18 +39,44 @@ x-backend-env: &backend-env
- ADMIN_PASSWORD

services:
zookeeper:
extends:
file: compose.yml
service: zookeeper
logging: *local-logging

kafka:
extends:
file: compose.yml
service: kafka
logging: *local-logging
environment:
# needs to share docker-internal address
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092

redis:
extends:
file: compose.yml
service: redis
logging: *local-logging

postgres:
extends:
file: compose.yml
service: postgres
logging: *local-logging

clickhouse:
extends:
file: compose.yml
service: clickhouse
logging: *local-logging

collector:
extends:
file: compose.yml
service: collector
logging: *local-logging
volumes:
- ./otel-collector.hobby.yaml:/etc/otel-collector-config.yaml

Expand All @@ -73,6 +89,17 @@ services:
interval: 5s
timeout: 5s
retries: 5
depends_on:
kafka:
condition: service_started
redis:
condition: service_started
postgres:
condition: service_healthy
clickhouse:
condition: service_started
collector:
condition: service_started
ports:
- 8082:8082
volumes:
Expand Down
2 changes: 1 addition & 1 deletion docker/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ export OBJECT_STORAGE_FS=/tmp/highlight-data
export REACT_APP_AUTH_MODE=password

if [[ "$*" == *"--go-docker"* ]]; then
export OTLP_ENDPOINT=https://otel.highlight.io:4318
export IN_DOCKER_GO=true
echo "Using docker-internal infra."
else
export OTLP_ENDPOINT=http://localhost:4318
export CLICKHOUSE_ADDRESS=localhost:9000
export KAFKA_SERVERS=localhost:9092
export PSQL_HOST=localhost
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/util/onPrem/onPremUtils.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export const isOnPrem = import.meta.env.REACT_APP_IN_DOCKER
export const isOnPrem =
import.meta.env.PROD && import.meta.env.REACT_APP_IN_DOCKER

0 comments on commit 33ad55d

Please sign in to comment.