Conversation
WalkthroughDocker Compose 설정 파일의 세 가지 서비스(blue, green, admin)에 OpenTelemetry 관련 환경 변수를 추가하여 트레이스에 환경 태그를 포함시키는 변경사항입니다. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@backend/docker-compose.yml`:
- Line 24: Replace the nonstandard OTEL_RESOURCE_ATTRIBUTES value
"env=${SPRING_PROFILES_ACTIVE}" with the OpenTelemetry standard key
deployment.environment.name and provide a safe default when
SPRING_PROFILES_ACTIVE is undefined; specifically, update each occurrence of the
OTEL_RESOURCE_ATTRIBUTES environment entry (currently set to
"env=${SPRING_PROFILES_ACTIVE}") to use deployment.environment.name and shell
parameter expansion to fall back to a default like "local" or "unknown" (e.g.,
deployment.environment.name=${SPRING_PROFILES_ACTIVE:-local}), and ensure the
whole assignment remains a single quoted string so it is valid in the
docker-compose environment block.
| - .env | ||
| environment: | ||
| OTEL_SERVICE_NAME: turip-app | ||
| OTEL_RESOURCE_ATTRIBUTES: "env=${SPRING_PROFILES_ACTIVE}" |
There was a problem hiding this comment.
❓ Verification inconclusive
OpenTelemetry resource attributes deployment environment name standard key
The OpenTelemetry Resource semantic convention key for a deployment environment “name” (tier) is:
deployment.environment.name(opentelemetry.io)
Example:
OTEL_RESOURCE_ATTRIBUTES=deployment.environment.name=production(opentelemetry.io)
Note: you may still see older/nonstandard usage like deployment.environment, but the semantic-conventions registry defines the environment name attribute as deployment.environment.name. (opentelemetry.io)
Citations:
- 1: https://opentelemetry.io/docs/specs/semconv/registry/entities/deployment/?utm_source=openai
- 2: https://opentelemetry.io/docs/concepts/resources/?utm_source=openai
- 3: https://opentelemetry.io/docs/specs/semconv/registry/entities/deployment/?utm_source=openai
Docker Compose variable substitution undefined empty string behavior
In Docker Compose interpolation, if a referenced variable is undefined (not set) and you don’t provide a default, Compose will emit a warning and substitute an empty string. For example, ${POSTGRES_VERSION} becomes "" and postgres:${POSTGRES_VERSION} becomes postgres:. [1], [2]
Compose supports Bash-like operators that let you control undefined vs empty-string behavior: [1]
-
Direct substitution
${VAR}→ value ofVAR; if unresolved → warning + empty string [1]
-
Defaults
${VAR:-default}→ usedefaultifVARis unset OR empty [1]${VAR-default}→ usedefaultonly ifVARis unset (an explicitly empty value stays empty) [1]
-
Required (fail fast)
${VAR:?msg}→ error if unset OR empty${VAR?msg}→ error if unset [1]
If your goal is to avoid “undefined → empty” surprises, use a default (:- / -) or a required check (:? / ?). [1]
Script executed:
find . -name "docker-compose.yml" -type fRepository: woowacourse-teams/2025-Turip
Repository: woowacourse-teams/2025-Turip
Exit code: 0
stdout:
./backend/docker-compose.yml
./backend/mysql/docker-compose.yml
Script executed:
cat -n backend/docker-compose.yml | sed -n '20,30p;36,45p;53,62p'Repository: woowacourse-teams/2025-Turip
Repository: woowacourse-teams/2025-Turip
Exit code: 0
stdout:
20 env_file:
21 - .env
22 environment:
23 OTEL_SERVICE_NAME: turip-app
24 OTEL_RESOURCE_ATTRIBUTES: "env=${SPRING_PROFILES_ACTIVE}"
25 networks:
26 - turip-network
27 volumes:
28 - /home/ubuntu/logs/app:/logs
29
30 green:
36 env_file:
37 - .env
38 environment:
39 OTEL_SERVICE_NAME: turip-app
40 OTEL_RESOURCE_ATTRIBUTES: "env=${SPRING_PROFILES_ACTIVE}"
41 networks:
42 - turip-network
43 volumes:
44 - /home/ubuntu/logs/app:/logs
45
53 - .env
54 environment:
55 SERVER_PORT: 8081
56 OTEL_SERVICE_NAME: turip-admin
57 OTEL_RESOURCE_ATTRIBUTES: "env=${SPRING_PROFILES_ACTIVE}"
58 networks:
59 - turip-network
60 volumes:
61 - /home/ubuntu/logs/admin:/logs
62
OTEL_RESOURCE_ATTRIBUTES 키를 OTel 표준으로 변경하고 기본값을 지정하세요.
Lines 24, 40, 57에서 사용 중인 env=${SPRING_PROFILES_ACTIVE}는 OpenTelemetry 공식 표준 키인 deployment.environment.name이 아니어서 도구 간 호환성 문제가 발생할 수 있습니다. 또한 SPRING_PROFILES_ACTIVE가 미정의되면 공백 문자열로 치환되어 필터링이 불안정해집니다.
권장 변경
- OTEL_RESOURCE_ATTRIBUTES: "env=${SPRING_PROFILES_ACTIVE}"
+ OTEL_RESOURCE_ATTRIBUTES: "deployment.environment.name=${SPRING_PROFILES_ACTIVE:-unknown}"📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| OTEL_RESOURCE_ATTRIBUTES: "env=${SPRING_PROFILES_ACTIVE}" | |
| OTEL_RESOURCE_ATTRIBUTES: "deployment.environment.name=${SPRING_PROFILES_ACTIVE:-unknown}" |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@backend/docker-compose.yml` at line 24, Replace the nonstandard
OTEL_RESOURCE_ATTRIBUTES value "env=${SPRING_PROFILES_ACTIVE}" with the
OpenTelemetry standard key deployment.environment.name and provide a safe
default when SPRING_PROFILES_ACTIVE is undefined; specifically, update each
occurrence of the OTEL_RESOURCE_ATTRIBUTES environment entry (currently set to
"env=${SPRING_PROFILES_ACTIVE}") to use deployment.environment.name and shell
parameter expansion to fall back to a default like "local" or "unknown" (e.g.,
deployment.environment.name=${SPRING_PROFILES_ACTIVE:-local}), and ensure the
whole assignment remains a single quoted string so it is valid in the
docker-compose environment block.
Issues
✔️ Check-list
🗒️ Work Description
📷 Screenshot
📚 Reference
Summary by CodeRabbit
Chores