-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Context
PR #18 adds logs support to otel-cli. Copilot provided 4 pieces of feedback during review. Need to critically evaluate each and address any real issues.
Copilot Feedback Evaluation
1. StopWait wrapper pattern (grpcserver.go:148-151)
Copilot says: Creating a temporary GrpcServer wrapper is unnecessarily complex. Add a stopWait() method to grpcServerState.
Evaluation: ❌ REJECT
- Current pattern is elegant - lightweight facade (just a pointer) that reuses existing StopWait method
- Adding separate stopWait() to grpcServerState would duplicate logic
- Wrapper is stack-allocated and extremely cheap (just a pointer)
- Maintains consistency - both trace and log services call shutdown the same way
- Comment clearly explains why this is done
Action: None needed. Close feedback with explanation.
2. Protocol env variable handling (config.go:82)
Copilot says: Signal-specific protocol variables should only apply when using signal-specific endpoints, not be included in the general Protocol field.
Evaluation:
- Subtle point about OTel spec compliance
- Question: Should OTEL_EXPORTER_OTLP_TRACES_PROTOCOL and OTEL_EXPORTER_OTLP_LOGS_PROTOCOL populate the general Protocol field?
- Need to check OTel spec for correct behavior
- For a CLI tool used in shell scripts, current behavior may be intentionally user-friendly
Action: Research OTel spec, make decision based on spec vs. usability tradeoff.
3. ServeHTTP backwards compatibility docs (httpserver.go:36)
Copilot says: Document the backwards compatibility behavior in the godoc comment.
Evaluation: ✅ ACCEPT
- Good documentation practice
- Backwards compatibility behavior (treating non-standard paths as traces) should be in function's godoc
- Currently only mentioned in inline comment
- Important API behavior users should know about
Action: Add godoc comment explaining backwards compatibility.
4. path.Join vs string concatenation (config.go:409)
Copilot says: Use strings.TrimSuffix(epUrl.Path, "/") + "/v1/logs" instead of path.Join because path.Join cleans paths.
Evaluation: 🤔 NEEDS TESTING
- path.Join does clean paths (removes trailing slashes, collapses separators)
- For URL paths, cleaning is often desired behavior
- Same pattern used for /v1/traces on line 354, so we'd need to fix both if this is an issue
- Need to test if path.Join causes actual problems
Action: Test path.Join with various inputs. If it causes issues, fix both traces and logs. Otherwise, keep current code.
Plan
- ✅ Evaluate all feedback critically
- 🔲 Test path.Join behavior
- 🔲 Research OTel spec for protocol env vars
- 🔲 Improve ServeHTTP godoc
- 🔲 Respond to Copilot on GitHub with decisions
- 🔲 Make any necessary code changes
Related
- PR feat: add logs support to otel-cli #18
- OTel spec: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md
🤖 Claude claude@anthropic.com