Skip to content

Migrate from Opencensus to Opentelemetry#24

Open
vearutop wants to merge 6 commits into
masterfrom
opentelemetry
Open

Migrate from Opencensus to Opentelemetry#24
vearutop wants to merge 6 commits into
masterfrom
opentelemetry

Conversation

@vearutop
Copy link
Copy Markdown
Member

@vearutop vearutop commented May 5, 2026

Example config to use Grafana Cloud

TELEMETRY_BASE_URL=https://otlp-gateway-prod-eu-west-2.grafana.net/otlp
TELEMETRY_AUTHORIZATION=Basic ODU<redacted>MTk=
TELEMETRY_METRICS_INTERVAL=60s

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

Lines Of Code

Language Files Lines Code Comments Blanks Complexity Bytes
Go 39 (+2) 2548 (+272) 1850 (+199) 174 (+1) 524 (+72) 350 (+81) 62K (+5.8K)
Go (test) 6 (+1) 263 (+18) 202 (+15) 1 60 (+3) 4 (-1) 6.3K (+686B)
YAML 6 434 (-2) 382 (+20) 23 (-12) 29 (-10) 0 13.9K (-362B)
gitignore 1 6 (+1) 6 (+1) 0 0 0 60B (+7B)

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

Go API Changes

# github.com/bool64/brick
## compatible changes
BaseConfig.Telemetry: added
MakeCacheBy: added

# github.com/bool64/brick/debug/zpages
## incompatible changes
Mux: changed from func(string, func(traceID string) string) net/http.Handler to func(string, *go.opentelemetry.io/contrib/zpages.SpanProcessor, func(traceID string) string) net/http.Handler

# github.com/bool64/brick/jaeger
## incompatible changes
package removed

# github.com/bool64/brick/log
## incompatible changes
SpanIDFieldToContexts: changed from func(string, go.opencensus.io/trace.Tracer) go.opencensus.io/trace.Tracer to func(string, go.opentelemetry.io/otel/trace.Tracer) go.opentelemetry.io/otel/trace.Tracer

# github.com/bool64/brick/opencensus
## incompatible changes
package removed

# github.com/bool64/brick/telemetry
## compatible changes
package added

# summary
Inferred base version: v0.3.4
Suggested version: v0.4.0

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

Benchmark Result

Benchmark diff with base branch
name          old time/op    new time/op    delta
CallerFunc-4    1.56µs ± 2%    1.54µs ± 2%   ~     (p=0.095 n=5+5)

name          old alloc/op   new alloc/op   delta
CallerFunc-4      296B ± 0%      296B ± 0%   ~     (all equal)

name          old allocs/op  new allocs/op  delta
CallerFunc-4      4.00 ± 0%      4.00 ± 0%   ~     (all equal)
Benchmark result
name          time/op
CallerFunc-4  1.54µs ± 2%

name          alloc/op
CallerFunc-4    296B ± 0%

name          allocs/op
CallerFunc-4    4.00 ± 0%

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

Unit Test Coverage

total: (statements) 24.3%
changed lines: (statements) 15.4%, coverage is less than 90.0%, consider testing the changes more thoroughly

Coverage of changed lines
File Function Coverage
Total 15.4%
cache.go 0.0%
cache.go:24 MakeCacheOf 0.0%
cache.go:71 MakeCacheBy 0.0%
cmd.go 0.0%
cmd.go:33 Start 0.0%
config/config.go 100.0%
config/config.go:74 Load 100.0%
config/config.go:97 validate 100.0%
database/observability.go 0.0%
database/observability.go:20 driverNameWithTracing 0.0%
database/observability.go:24 tracingOptions 0.0%
database/observability.go:75 observe 0.0%
database/storage.go 0.0%
database/storage.go:23 SetupStorage 0.0%
database/storage.go:51 setupStorage 0.0%
database/storage.go:111 Fatal 0.0%
database/storage.go:112 Fatalf 0.0%
database/storage.go:117 Print 0.0%
database/storage.go:120 Println 0.0%
database/storage.go:121 Printf 0.0%
debug.go 83.3%
debug.go:48 newDebugRouter 86.2%
debug.go:40 SetupDebugRouter 0.0%
debug/zpages/mux.go 0.0%
debug/zpages/mux.go:11 Mux 0.0%
graceful/switch.go 100.0%
graceful/switch.go:57 waitForSignal 100.0%
http.go 33.3%
http.go:21 NewBaseWebService 100.0%
http.go:60 StartHTTPServer 0.0%
init.go 88.2%
init.go:115 setupTelemetry 100.0%
init.go:125 setupPrometheus 100.0%
init.go:56 NewBaseLocator 92.3%
log/http.go 0.0%
log/http.go:19 HTTPTraceTransaction 0.0%
log/http.go:67 handlePanic 0.0%
log/http.go:78 processPanic 0.0%
log/http.go:117 Middleware 0.0%
log/http.go:168 headersMap 0.0%
log/trace.go 0.0%
log/trace.go:17 Start 0.0%
log/trace.go:29 SpanIDFieldToContexts 0.0%
log/usecase.go 0.0%
log/usecase.go:12 UsecaseErrors 0.0%
runtime/caller.go 0.0%
runtime/caller.go:16 Ancestor 0.0%
runtime/heap.go 0.0%
runtime/heap.go:12 StableHeapInUse 0.0%
telemetry/config.go 60.0%
telemetry/config.go:90 Headers 83.3%
telemetry/config.go:38 TraceEndpoint 63.6%
telemetry/config.go:51 MetricEndpoint 63.6%
telemetry/config.go:64 LogEndpoint 63.6%
telemetry/config.go:77 AuthorizationHeader 63.6%
telemetry/config.go:100 Enabled 0.0%
telemetry/http.go 0.0%
telemetry/http.go:13 Middleware 0.0%
telemetry/metrics.go 0.0%
telemetry/metrics.go:30 PrometheusGatherer 0.0%
telemetry/metrics.go:46 SetupMetrics 0.0%
telemetry/metrics.go:89 NewMetricsReader 0.0%
telemetry/otelzapcore.go 0.0%
telemetry/otelzapcore.go:17 NewZapCore 0.0%
telemetry/otelzapcore.go:24 Enabled 0.0%
telemetry/otelzapcore.go:28 With 0.0%
telemetry/otelzapcore.go:39 Check 0.0%
telemetry/otelzapcore.go:47 Write 0.0%
telemetry/otelzapcore.go:67 Sync 0.0%
telemetry/otelzapcore.go:71 zapLevelToSlog 0.0%
telemetry/otelzapcore.go:84 zapFieldsToAttrs 0.0%
telemetry/setup.go 0.0%
telemetry/setup.go:41 Setup 0.0%
telemetry/setup.go:90 setupTraceExporter 0.0%
telemetry/setup.go:111 setupLogs 0.0%
telemetry/setup.go:146 loggerOptions 0.0%
telemetry/setup.go:158 logShutdownError 0.0%
telemetry/span.go 0.0%
telemetry/span.go:24 AddSpan 0.0%
telemetry/usecase.go 0.0%
telemetry/usecase.go:19 Wrap 0.0%
test/feature.go 0.0%
test/feature.go:36 newContext 0.0%
test/feature.go:67 RunFeatures 0.0%
test/feature.go:88 requireFeatureServer 0.0%
test/feature.go:101 featureSuite 0.0%
test/feature.go:136 configureFeatureFormatters 0.0%
test/feature.go:144 shutdownFeatureServer 0.0%
usecase/stats.go 0.0%
usecase/stats.go:15 StatsMiddleware 0.0%
debug/config.go no coverage
telemetry/doc.go no coverage
Coverage diff with base branch
File Function Base Coverage Current Coverage
Total 28.0% 24.3% (-3.7%)
cache.go MakeCacheBy no function 0.0%
database/observability.go withTracing 0.0% no function
debug.go SetupDebugRouter 74.1% 66.7% (-7.4%)
debug.go newDebugRouter no function 76.9%
init.go NewBaseLocator 88.9% 85.0% (-3.9%)
init.go setupPrometheus 73.9% 66.7% (-7.2%)
init.go setupTelemetry no function 100.0%
jaeger/setup.go Setup 0.0% no function
log/trace.go NewContext 0.0% no function
log/trace.go Start no function 0.0%
opencensus/http.go Middleware 0.0% no function
opencensus/span.go AddSpan 0.0% no function
opencensus/usecase.go Wrap 0.0% no function
opencensus/views.go Views 0.0% no function
telemetry/config.go AuthorizationHeader no function 60.0%
telemetry/config.go Enabled no function 0.0%
telemetry/config.go Headers no function 75.0%
telemetry/config.go LogEndpoint no function 60.0%
telemetry/config.go MetricEndpoint no function 60.0%
telemetry/config.go TraceEndpoint no function 60.0%
telemetry/http.go Middleware no function 0.0%
telemetry/metrics.go NewMetricsReader no function 0.0%
telemetry/metrics.go PrometheusGatherer no function 0.0%
telemetry/metrics.go SetupMetrics no function 0.0%
telemetry/otelzapcore.go Check no function 0.0%
telemetry/otelzapcore.go Enabled no function 0.0%
telemetry/otelzapcore.go NewZapCore no function 0.0%
telemetry/otelzapcore.go Sync no function 0.0%
telemetry/otelzapcore.go With no function 0.0%
telemetry/otelzapcore.go Write no function 0.0%
telemetry/otelzapcore.go zapFieldsToAttrs no function 0.0%
telemetry/otelzapcore.go zapLevelToSlog no function 0.0%
telemetry/setup.go Setup no function 0.0%
telemetry/setup.go logShutdownError no function 0.0%
telemetry/setup.go loggerOptions no function 0.0%
telemetry/setup.go setupLogs no function 0.0%
telemetry/setup.go setupTraceExporter no function 0.0%
telemetry/span.go AddSpan no function 0.0%
telemetry/usecase.go Wrap no function 0.0%
test/feature.go configureFeatureFormatters no function 0.0%
test/feature.go featureSuite no function 0.0%
test/feature.go requireFeatureServer no function 0.0%
test/feature.go shutdownFeatureServer no function 0.0%

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant