Skip to content

Commit 1ae4a03

Browse files
[WIP] [WIP] Address feedback on OSS logging adapter for http implementation (#2264)
* Initial plan * Fix BaseDeps.Logger and BaseDeps.Metrics to return safe defaults when Obsv is nil Agent-Logs-Url: https://github.com/github/github-mcp-server/sessions/53221b0b-abb4-4138-a147-3ce9e13b379a Co-authored-by: mattdholloway <918573+mattdholloway@users.noreply.github.com> * Fix nil metrics in server.go by passing metrics.NewNoopMetrics() to NewExporters Agent-Logs-Url: https://github.com/github/github-mcp-server/sessions/53221b0b-abb4-4138-a147-3ce9e13b379a Co-authored-by: mattdholloway <918573+mattdholloway@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: mattdholloway <918573+mattdholloway@users.noreply.github.com> Co-authored-by: Matt Holloway <mattdholloway@github.com>
1 parent 095d9f2 commit 1ae4a03

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

pkg/github/dependencies.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,15 +189,15 @@ func (d BaseDeps) GetContentWindowSize() int { return d.ContentWindowSize }
189189
// Logger implements ToolDependencies.
190190
func (d BaseDeps) Logger(_ context.Context) *slog.Logger {
191191
if d.Obsv == nil {
192-
return nil
192+
return slog.New(slog.DiscardHandler)
193193
}
194194
return d.Obsv.Logger()
195195
}
196196

197197
// Metrics implements ToolDependencies.
198198
func (d BaseDeps) Metrics(ctx context.Context) metrics.Metrics {
199199
if d.Obsv == nil {
200-
return nil
200+
return metrics.NewNoopMetrics()
201201
}
202202
return d.Obsv.Metrics(ctx)
203203
}

pkg/http/server.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
"github.com/github/github-mcp-server/pkg/inventory"
1919
"github.com/github/github-mcp-server/pkg/lockdown"
2020
"github.com/github/github-mcp-server/pkg/observability"
21+
"github.com/github/github-mcp-server/pkg/observability/metrics"
2122
"github.com/github/github-mcp-server/pkg/scopes"
2223
"github.com/github/github-mcp-server/pkg/translations"
2324
"github.com/github/github-mcp-server/pkg/utils"
@@ -107,7 +108,7 @@ func RunHTTPServer(cfg ServerConfig) error {
107108

108109
featureChecker := createHTTPFeatureChecker()
109110

110-
obs, err := observability.NewExporters(logger, observability.NewNoopMetrics())
111+
obs, err := observability.NewExporters(logger, metrics.NewNoopMetrics())
111112
if err != nil {
112113
return fmt.Errorf("failed to create observability exporters: %w", err)
113114
}

0 commit comments

Comments
 (0)