Skip to content

[feat] 트레이스에 환경 태그 추가#615

Open
seaniiio wants to merge 1 commit intodevelopfrom
feature/#614
Open

[feat] 트레이스에 환경 태그 추가#615
seaniiio wants to merge 1 commit intodevelopfrom
feature/#614

Conversation

@seaniiio
Copy link
Member

@seaniiio seaniiio commented Feb 25, 2026

Issues

✔️ Check-list

  • : Label을 지정해 주세요.
  • : Merge할 브랜치를 확인해 주세요.

🗒️ Work Description

📷 Screenshot

📚 Reference

Summary by CodeRabbit

Chores

  • OpenTelemetry 기반 모니터링을 지원하기 위해 서비스 구성이 업데이트되었습니다. 세 개의 서비스에 관찰성 관련 환경 변수가 추가되어 애플리케이션의 추적 및 메트릭 수집이 개선되었습니다.

@seaniiio seaniiio self-assigned this Feb 25, 2026
@seaniiio seaniiio added the 🤙🏽 메이 우아한 테크코스 7기 백엔드 메이 label Feb 25, 2026
@github-actions github-actions bot requested a review from eunseongu February 25, 2026 14:09
@coderabbitai
Copy link

coderabbitai bot commented Feb 25, 2026

Walkthrough

Docker Compose 설정 파일의 세 가지 서비스(blue, green, admin)에 OpenTelemetry 관련 환경 변수를 추가하여 트레이스에 환경 태그를 포함시키는 변경사항입니다.

Changes

Cohort / File(s) Summary
OpenTelemetry 환경 설정
backend/docker-compose.yml
blue, green, admin 서비스에 OTEL_SERVICE_NAME 및 OTEL_RESOURCE_ATTRIBUTES 환경 변수 추가. 환경 정보를 트레이스에 태그로 포함하여 Grafana에서 환경별 필터링을 가능하게 함.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed Pull request title clearly describes the main change: adding environment tag to traces in OpenTelemetry configuration.
Description check ✅ Passed PR description follows the template with all required sections present, though Work Description, Screenshot, and Reference sections are empty.
Linked Issues check ✅ Passed Code changes fully implement the requirement from issue #614 by adding environment tag configuration to OpenTelemetry in docker-compose.yml.
Out of Scope Changes check ✅ Passed All changes are directly related to the linked issue #614 objective of adding environment tags to traces via OpenTelemetry configuration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/#614

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c661557 and 808b53e.

📒 Files selected for processing (1)
  • backend/docker-compose.yml

- .env
environment:
OTEL_SERVICE_NAME: turip-app
OTEL_RESOURCE_ATTRIBUTES: "env=${SPRING_PROFILES_ACTIVE}"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

❓ Verification inconclusive

OpenTelemetry resource attributes deployment environment name standard key


The OpenTelemetry Resource semantic convention key for a deployment environment “name” (tier) is:

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:


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 of VAR; if unresolved → warning + empty string [1]
  • Defaults

    • ${VAR:-default} → use default if VAR is unset OR empty [1]
    • ${VAR-default} → use default only if VAR is 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 f

Repository: 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.

Suggested change
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💻 BackEnd 백엔드얌 📝 feat 🤙🏽 메이 우아한 테크코스 7기 백엔드 메이

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

[feat] 트레이스에 환경 태그 추가

1 participant