Compare commits
	
		
			7 Commits
		
	
	
		
			v0.9.4
			...
			9cee9037e4
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 9cee9037e4 | |||
| 318115690d | |||
| 8b4bb890be | |||
| e841e11168 | |||
| 7c78416948 | |||
| 31fc6dca16 | |||
| 41d539a607 | 
							
								
								
									
										6
									
								
								TODO.md
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								TODO.md
									
									
									
									
									
								
							@@ -1,11 +1,15 @@
 | 
				
			|||||||
# TODO
 | 
					# TODO
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- [ ] Add ability to initialize OTEL early (before app runs)
 | 
				
			||||||
 | 
					- [ ] Spruce up the README
 | 
				
			||||||
 | 
					- [ ] Create generic interface for implementing a service
 | 
				
			||||||
 | 
					- [ ] Create config sample not called demo, so it is more easily reused
 | 
				
			||||||
- [ ] Expand config test case to cover GRPC config
 | 
					- [ ] Expand config test case to cover GRPC config
 | 
				
			||||||
- [ ] Expand tracing
 | 
					- [ ] Expand tracing
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Done
 | 
					## Done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- [x] Test and troubleshoot GRPC Gateway supprot
 | 
					- [x] Test and troubleshoot GRPC Gateway support
 | 
				
			||||||
- [x] Finish implementing GRPC service support
 | 
					- [x] Finish implementing GRPC service support
 | 
				
			||||||
- [x] Unit tests
 | 
					- [x] Unit tests
 | 
				
			||||||
- [x] Pattern for extending config
 | 
					- [x] Pattern for extending config
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										23
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								go.mod
									
									
									
									
									
								
							@@ -3,10 +3,11 @@ module gitea.libretechconsulting.com/rmcguire/go-app
 | 
				
			|||||||
go 1.24.2
 | 
					go 1.24.2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
require (
 | 
					require (
 | 
				
			||||||
 | 
						buf.build/go/protovalidate v0.14.0
 | 
				
			||||||
	github.com/caarlos0/env/v11 v11.3.1
 | 
						github.com/caarlos0/env/v11 v11.3.1
 | 
				
			||||||
	github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.2
 | 
						github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.2
 | 
				
			||||||
	github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1
 | 
						github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1
 | 
				
			||||||
	github.com/prometheus/client_golang v1.22.0
 | 
						github.com/prometheus/client_golang v1.23.0
 | 
				
			||||||
	github.com/rs/zerolog v1.34.0
 | 
						github.com/rs/zerolog v1.34.0
 | 
				
			||||||
	github.com/swaggest/jsonschema-go v0.3.78
 | 
						github.com/swaggest/jsonschema-go v0.3.78
 | 
				
			||||||
	go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.62.0
 | 
						go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.62.0
 | 
				
			||||||
@@ -14,39 +15,47 @@ require (
 | 
				
			|||||||
	go.opentelemetry.io/otel v1.37.0
 | 
						go.opentelemetry.io/otel v1.37.0
 | 
				
			||||||
	go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.37.0
 | 
						go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.37.0
 | 
				
			||||||
	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.37.0
 | 
						go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.37.0
 | 
				
			||||||
	go.opentelemetry.io/otel/exporters/prometheus v0.59.0
 | 
						go.opentelemetry.io/otel/exporters/prometheus v0.59.1
 | 
				
			||||||
	go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.37.0
 | 
						go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.37.0
 | 
				
			||||||
	go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.37.0
 | 
						go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.37.0
 | 
				
			||||||
	go.opentelemetry.io/otel/metric v1.37.0
 | 
						go.opentelemetry.io/otel/metric v1.37.0
 | 
				
			||||||
	go.opentelemetry.io/otel/sdk v1.37.0
 | 
						go.opentelemetry.io/otel/sdk v1.37.0
 | 
				
			||||||
	go.opentelemetry.io/otel/sdk/metric v1.37.0
 | 
						go.opentelemetry.io/otel/sdk/metric v1.37.0
 | 
				
			||||||
	go.opentelemetry.io/otel/trace v1.37.0
 | 
						go.opentelemetry.io/otel/trace v1.37.0
 | 
				
			||||||
	google.golang.org/grpc v1.73.0
 | 
						google.golang.org/grpc v1.74.2
 | 
				
			||||||
	gopkg.in/yaml.v3 v3.0.1
 | 
						gopkg.in/yaml.v3 v3.0.1
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
require (
 | 
					require (
 | 
				
			||||||
 | 
						buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.6-20250717185734-6c6e0d3c608e.1 // indirect
 | 
				
			||||||
 | 
						cel.dev/expr v0.24.0 // indirect
 | 
				
			||||||
 | 
						github.com/antlr4-go/antlr/v4 v4.13.1 // indirect
 | 
				
			||||||
	github.com/beorn7/perks v1.0.1 // indirect
 | 
						github.com/beorn7/perks v1.0.1 // indirect
 | 
				
			||||||
	github.com/cenkalti/backoff/v5 v5.0.2 // indirect
 | 
						github.com/cenkalti/backoff/v5 v5.0.3 // indirect
 | 
				
			||||||
	github.com/cespare/xxhash/v2 v2.3.0 // indirect
 | 
						github.com/cespare/xxhash/v2 v2.3.0 // indirect
 | 
				
			||||||
	github.com/felixge/httpsnoop v1.0.4 // indirect
 | 
						github.com/felixge/httpsnoop v1.0.4 // indirect
 | 
				
			||||||
	github.com/go-logr/logr v1.4.3 // indirect
 | 
						github.com/go-logr/logr v1.4.3 // indirect
 | 
				
			||||||
	github.com/go-logr/stdr v1.2.2 // indirect
 | 
						github.com/go-logr/stdr v1.2.2 // indirect
 | 
				
			||||||
 | 
						github.com/google/cel-go v0.26.0 // indirect
 | 
				
			||||||
	github.com/google/uuid v1.6.0 // indirect
 | 
						github.com/google/uuid v1.6.0 // indirect
 | 
				
			||||||
 | 
						github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc // indirect
 | 
				
			||||||
	github.com/mattn/go-colorable v0.1.14 // indirect
 | 
						github.com/mattn/go-colorable v0.1.14 // indirect
 | 
				
			||||||
	github.com/mattn/go-isatty v0.0.20 // indirect
 | 
						github.com/mattn/go-isatty v0.0.20 // indirect
 | 
				
			||||||
	github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
 | 
						github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
 | 
				
			||||||
	github.com/prometheus/client_model v0.6.2 // indirect
 | 
						github.com/prometheus/client_model v0.6.2 // indirect
 | 
				
			||||||
	github.com/prometheus/common v0.65.0 // indirect
 | 
						github.com/prometheus/common v0.65.0 // indirect
 | 
				
			||||||
 | 
						github.com/prometheus/otlptranslator v0.0.0-20250717125610-8549f4ab4f8f // indirect
 | 
				
			||||||
	github.com/prometheus/procfs v0.17.0 // indirect
 | 
						github.com/prometheus/procfs v0.17.0 // indirect
 | 
				
			||||||
 | 
						github.com/stoewer/go-strcase v1.3.1 // indirect
 | 
				
			||||||
	github.com/swaggest/refl v1.4.0 // indirect
 | 
						github.com/swaggest/refl v1.4.0 // indirect
 | 
				
			||||||
	go.opentelemetry.io/auto/sdk v1.1.0 // indirect
 | 
						go.opentelemetry.io/auto/sdk v1.1.0 // indirect
 | 
				
			||||||
	go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.37.0 // indirect
 | 
						go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.37.0 // indirect
 | 
				
			||||||
	go.opentelemetry.io/proto/otlp v1.7.0 // indirect
 | 
						go.opentelemetry.io/proto/otlp v1.7.1 // indirect
 | 
				
			||||||
 | 
						golang.org/x/exp v0.0.0-20250718183923-645b1fa84792 // indirect
 | 
				
			||||||
	golang.org/x/net v0.42.0 // indirect
 | 
						golang.org/x/net v0.42.0 // indirect
 | 
				
			||||||
	golang.org/x/sys v0.34.0 // indirect
 | 
						golang.org/x/sys v0.34.0 // indirect
 | 
				
			||||||
	golang.org/x/text v0.27.0 // indirect
 | 
						golang.org/x/text v0.27.0 // indirect
 | 
				
			||||||
	google.golang.org/genproto/googleapis/api v0.0.0-20250715232539-7130f93afb79 // indirect
 | 
						google.golang.org/genproto/googleapis/api v0.0.0-20250728155136-f173205681a0 // indirect
 | 
				
			||||||
	google.golang.org/genproto/googleapis/rpc v0.0.0-20250715232539-7130f93afb79 // indirect
 | 
						google.golang.org/genproto/googleapis/rpc v0.0.0-20250728155136-f173205681a0 // indirect
 | 
				
			||||||
	google.golang.org/protobuf v1.36.6 // indirect
 | 
						google.golang.org/protobuf v1.36.6 // indirect
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										54
									
								
								go.sum
									
									
									
									
									
								
							
							
						
						
									
										54
									
								
								go.sum
									
									
									
									
									
								
							@@ -1,3 +1,11 @@
 | 
				
			|||||||
 | 
					buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.6-20250717185734-6c6e0d3c608e.1 h1:Lg6klmCi3v7VvpqeeLEER9/m5S8y9e9DjhqQnSCNy4k=
 | 
				
			||||||
 | 
					buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.6-20250717185734-6c6e0d3c608e.1/go.mod h1:avRlCjnFzl98VPaeCtJ24RrV/wwHFzB8sWXhj26+n/U=
 | 
				
			||||||
 | 
					buf.build/go/protovalidate v0.14.0 h1:kr/rC/no+DtRyYX+8KXLDxNnI1rINz0imk5K44ZpZ3A=
 | 
				
			||||||
 | 
					buf.build/go/protovalidate v0.14.0/go.mod h1:+F/oISho9MO7gJQNYC2VWLzcO1fTPmaTA08SDYJZncA=
 | 
				
			||||||
 | 
					cel.dev/expr v0.24.0 h1:56OvJKSH3hDGL0ml5uSxZmz3/3Pq4tJ+fb1unVLAFcY=
 | 
				
			||||||
 | 
					cel.dev/expr v0.24.0/go.mod h1:hLPLo1W4QUmuYdA72RBX06QTs6MXw941piREPl3Yfiw=
 | 
				
			||||||
 | 
					github.com/antlr4-go/antlr/v4 v4.13.1 h1:SqQKkuVZ+zWkMMNkjy5FZe5mr5WURWnlpmOuzYWrPrQ=
 | 
				
			||||||
 | 
					github.com/antlr4-go/antlr/v4 v4.13.1/go.mod h1:GKmUxMtwp6ZgGwZSva4eWPC5mS6vUAmOABFgjdkM7Nw=
 | 
				
			||||||
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
 | 
					github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
 | 
				
			||||||
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
 | 
					github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
 | 
				
			||||||
github.com/bool64/dev v0.2.39 h1:kP8DnMGlWXhGYJEZE/J0l/gVBdbuhoPGL+MJG4QbofE=
 | 
					github.com/bool64/dev v0.2.39 h1:kP8DnMGlWXhGYJEZE/J0l/gVBdbuhoPGL+MJG4QbofE=
 | 
				
			||||||
@@ -6,11 +14,12 @@ github.com/bool64/shared v0.1.5 h1:fp3eUhBsrSjNCQPcSdQqZxxh9bBwrYiZ+zOKFkM0/2E=
 | 
				
			|||||||
github.com/bool64/shared v0.1.5/go.mod h1:081yz68YC9jeFB3+Bbmno2RFWvGKv1lPKkMP6MHJlPs=
 | 
					github.com/bool64/shared v0.1.5/go.mod h1:081yz68YC9jeFB3+Bbmno2RFWvGKv1lPKkMP6MHJlPs=
 | 
				
			||||||
github.com/caarlos0/env/v11 v11.3.1 h1:cArPWC15hWmEt+gWk7YBi7lEXTXCvpaSdCiZE2X5mCA=
 | 
					github.com/caarlos0/env/v11 v11.3.1 h1:cArPWC15hWmEt+gWk7YBi7lEXTXCvpaSdCiZE2X5mCA=
 | 
				
			||||||
github.com/caarlos0/env/v11 v11.3.1/go.mod h1:qupehSf/Y0TUTsxKywqRt/vJjN5nz6vauiYEUUr8P4U=
 | 
					github.com/caarlos0/env/v11 v11.3.1/go.mod h1:qupehSf/Y0TUTsxKywqRt/vJjN5nz6vauiYEUUr8P4U=
 | 
				
			||||||
github.com/cenkalti/backoff/v5 v5.0.2 h1:rIfFVxEf1QsI7E1ZHfp/B4DF/6QBAUhmgkxc0H7Zss8=
 | 
					github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM=
 | 
				
			||||||
github.com/cenkalti/backoff/v5 v5.0.2/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw=
 | 
					github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw=
 | 
				
			||||||
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
 | 
					github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
 | 
				
			||||||
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
 | 
					github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
 | 
				
			||||||
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
 | 
					github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
 | 
				
			||||||
 | 
					github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
 | 
				
			||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
 | 
					github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
 | 
				
			||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
 | 
					github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
 | 
				
			||||||
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
 | 
					github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
 | 
				
			||||||
@@ -23,10 +32,14 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre
 | 
				
			|||||||
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
 | 
					github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
 | 
				
			||||||
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
 | 
					github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
 | 
				
			||||||
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
 | 
					github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
 | 
				
			||||||
 | 
					github.com/google/cel-go v0.26.0 h1:DPGjXackMpJWH680oGY4lZhYjIameYmR+/6RBdDGmaI=
 | 
				
			||||||
 | 
					github.com/google/cel-go v0.26.0/go.mod h1:A9O8OU9rdvrK5MQyrqfIxo1a0u4g3sF8KB6PUIaryMM=
 | 
				
			||||||
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
 | 
					github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
 | 
				
			||||||
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
 | 
					github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
 | 
				
			||||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
 | 
					github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
 | 
				
			||||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
 | 
					github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
 | 
				
			||||||
 | 
					github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc h1:GN2Lv3MGO7AS6PrRoT6yV5+wkrOpcszoIsO4+4ds248=
 | 
				
			||||||
 | 
					github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc/go.mod h1:+JKpmjMGhpgPL+rXZ5nsZieVzvarn86asRlBg4uNGnk=
 | 
				
			||||||
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.2 h1:sGm2vDRFUrQJO/Veii4h4zG2vvqG6uWNkBHSTqXOZk0=
 | 
					github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.2 h1:sGm2vDRFUrQJO/Veii4h4zG2vvqG6uWNkBHSTqXOZk0=
 | 
				
			||||||
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.2/go.mod h1:wd1YpapPLivG6nQgbf7ZkG1hhSOXDhhn4MLTknx2aAc=
 | 
					github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.2/go.mod h1:wd1YpapPLivG6nQgbf7ZkG1hhSOXDhhn4MLTknx2aAc=
 | 
				
			||||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1 h1:X5VWvz21y3gzm9Nw/kaUeku/1+uBhcekkmy4IkffJww=
 | 
					github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1 h1:X5VWvz21y3gzm9Nw/kaUeku/1+uBhcekkmy4IkffJww=
 | 
				
			||||||
@@ -53,12 +66,14 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8m
 | 
				
			|||||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
 | 
					github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
 | 
				
			||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
 | 
					github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
 | 
				
			||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
 | 
					github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
 | 
				
			||||||
github.com/prometheus/client_golang v1.22.0 h1:rb93p9lokFEsctTys46VnV1kLCDpVZ0a/Y92Vm0Zc6Q=
 | 
					github.com/prometheus/client_golang v1.23.0 h1:ust4zpdl9r4trLY/gSjlm07PuiBq2ynaXXlptpfy8Uc=
 | 
				
			||||||
github.com/prometheus/client_golang v1.22.0/go.mod h1:R7ljNsLXhuQXYZYtw6GAE9AZg8Y7vEW5scdCXrWRXC0=
 | 
					github.com/prometheus/client_golang v1.23.0/go.mod h1:i/o0R9ByOnHX0McrTMTyhYvKE4haaf2mW08I+jGAjEE=
 | 
				
			||||||
github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk=
 | 
					github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk=
 | 
				
			||||||
github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE=
 | 
					github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE=
 | 
				
			||||||
github.com/prometheus/common v0.65.0 h1:QDwzd+G1twt//Kwj/Ww6E9FQq1iVMmODnILtW1t2VzE=
 | 
					github.com/prometheus/common v0.65.0 h1:QDwzd+G1twt//Kwj/Ww6E9FQq1iVMmODnILtW1t2VzE=
 | 
				
			||||||
github.com/prometheus/common v0.65.0/go.mod h1:0gZns+BLRQ3V6NdaerOhMbwwRbNh9hkGINtQAsP5GS8=
 | 
					github.com/prometheus/common v0.65.0/go.mod h1:0gZns+BLRQ3V6NdaerOhMbwwRbNh9hkGINtQAsP5GS8=
 | 
				
			||||||
 | 
					github.com/prometheus/otlptranslator v0.0.0-20250717125610-8549f4ab4f8f h1:QQB6SuvGZjK8kdc2YaLJpYhV8fxauOsjE6jgcL6YJ8Q=
 | 
				
			||||||
 | 
					github.com/prometheus/otlptranslator v0.0.0-20250717125610-8549f4ab4f8f/go.mod h1:P8AwMgdD7XEr6QRUJ2QWLpiAZTgTE2UYgjlu3svompI=
 | 
				
			||||||
github.com/prometheus/procfs v0.17.0 h1:FuLQ+05u4ZI+SS/w9+BWEM2TXiHKsUQ9TADiRH7DuK0=
 | 
					github.com/prometheus/procfs v0.17.0 h1:FuLQ+05u4ZI+SS/w9+BWEM2TXiHKsUQ9TADiRH7DuK0=
 | 
				
			||||||
github.com/prometheus/procfs v0.17.0/go.mod h1:oPQLaDAMRbA+u8H5Pbfq+dl3VDAvHxMUOVhe0wYB2zw=
 | 
					github.com/prometheus/procfs v0.17.0/go.mod h1:oPQLaDAMRbA+u8H5Pbfq+dl3VDAvHxMUOVhe0wYB2zw=
 | 
				
			||||||
github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
 | 
					github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
 | 
				
			||||||
@@ -68,6 +83,14 @@ github.com/rs/zerolog v1.34.0 h1:k43nTLIwcTVQAncfCw4KZ2VY6ukYoZaBPNOE8txlOeY=
 | 
				
			|||||||
github.com/rs/zerolog v1.34.0/go.mod h1:bJsvje4Z08ROH4Nhs5iH600c3IkWhwp44iRc54W6wYQ=
 | 
					github.com/rs/zerolog v1.34.0/go.mod h1:bJsvje4Z08ROH4Nhs5iH600c3IkWhwp44iRc54W6wYQ=
 | 
				
			||||||
github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8=
 | 
					github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8=
 | 
				
			||||||
github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I=
 | 
					github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I=
 | 
				
			||||||
 | 
					github.com/stoewer/go-strcase v1.3.1 h1:iS0MdW+kVTxgMoE1LAZyMiYJFKlOzLooE4MxjirtkAs=
 | 
				
			||||||
 | 
					github.com/stoewer/go-strcase v1.3.1/go.mod h1:fAH5hQ5pehh+j3nZfvwdk2RgEgQjAoM8wodgtPmh1xo=
 | 
				
			||||||
 | 
					github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
 | 
				
			||||||
 | 
					github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
 | 
				
			||||||
 | 
					github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
 | 
				
			||||||
 | 
					github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
 | 
				
			||||||
 | 
					github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
 | 
				
			||||||
 | 
					github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
 | 
				
			||||||
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
 | 
					github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
 | 
				
			||||||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
 | 
					github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
 | 
				
			||||||
github.com/swaggest/assertjson v1.9.0 h1:dKu0BfJkIxv/xe//mkCrK5yZbs79jL7OVf9Ija7o2xQ=
 | 
					github.com/swaggest/assertjson v1.9.0 h1:dKu0BfJkIxv/xe//mkCrK5yZbs79jL7OVf9Ija7o2xQ=
 | 
				
			||||||
@@ -94,8 +117,8 @@ go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.37.0 h1:Ahq7pZmv87yiyn3jeFz
 | 
				
			|||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.37.0/go.mod h1:MJTqhM0im3mRLw1i8uGHnCvUEeS7VwRyxlLC78PA18M=
 | 
					go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.37.0/go.mod h1:MJTqhM0im3mRLw1i8uGHnCvUEeS7VwRyxlLC78PA18M=
 | 
				
			||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.37.0 h1:EtFWSnwW9hGObjkIdmlnWSydO+Qs8OwzfzXLUPg4xOc=
 | 
					go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.37.0 h1:EtFWSnwW9hGObjkIdmlnWSydO+Qs8OwzfzXLUPg4xOc=
 | 
				
			||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.37.0/go.mod h1:QjUEoiGCPkvFZ/MjK6ZZfNOS6mfVEVKYE99dFhuN2LI=
 | 
					go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.37.0/go.mod h1:QjUEoiGCPkvFZ/MjK6ZZfNOS6mfVEVKYE99dFhuN2LI=
 | 
				
			||||||
go.opentelemetry.io/otel/exporters/prometheus v0.59.0 h1:HHf+wKS6o5++XZhS98wvILrLVgHxjA/AMjqHKes+uzo=
 | 
					go.opentelemetry.io/otel/exporters/prometheus v0.59.1 h1:HcpSkTkJbggT8bjYP+BjyqPWlD17BH9C5CYNKeDzmcA=
 | 
				
			||||||
go.opentelemetry.io/otel/exporters/prometheus v0.59.0/go.mod h1:R8GpRXTZrqvXHDEGVH5bF6+JqAZcK8PjJcZ5nGhEWiE=
 | 
					go.opentelemetry.io/otel/exporters/prometheus v0.59.1/go.mod h1:0FJL+gjuUoM07xzik3KPBaN+nz/CoB15kV6WLMiXZag=
 | 
				
			||||||
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.37.0 h1:6VjV6Et+1Hd2iLZEPtdV7vie80Yyqf7oikJLjQ/myi0=
 | 
					go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.37.0 h1:6VjV6Et+1Hd2iLZEPtdV7vie80Yyqf7oikJLjQ/myi0=
 | 
				
			||||||
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.37.0/go.mod h1:u8hcp8ji5gaM/RfcOo8z9NMnf1pVLfVY7lBY2VOGuUU=
 | 
					go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.37.0/go.mod h1:u8hcp8ji5gaM/RfcOo8z9NMnf1pVLfVY7lBY2VOGuUU=
 | 
				
			||||||
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.37.0 h1:SNhVp/9q4Go/XHBkQ1/d5u9P/U+L1yaGPoi0x+mStaI=
 | 
					go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.37.0 h1:SNhVp/9q4Go/XHBkQ1/d5u9P/U+L1yaGPoi0x+mStaI=
 | 
				
			||||||
@@ -108,10 +131,12 @@ go.opentelemetry.io/otel/sdk/metric v1.37.0 h1:90lI228XrB9jCMuSdA0673aubgRobVZFh
 | 
				
			|||||||
go.opentelemetry.io/otel/sdk/metric v1.37.0/go.mod h1:cNen4ZWfiD37l5NhS+Keb5RXVWZWpRE+9WyVCpbo5ps=
 | 
					go.opentelemetry.io/otel/sdk/metric v1.37.0/go.mod h1:cNen4ZWfiD37l5NhS+Keb5RXVWZWpRE+9WyVCpbo5ps=
 | 
				
			||||||
go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4=
 | 
					go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4=
 | 
				
			||||||
go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0=
 | 
					go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0=
 | 
				
			||||||
go.opentelemetry.io/proto/otlp v1.7.0 h1:jX1VolD6nHuFzOYso2E73H85i92Mv8JQYk0K9vz09os=
 | 
					go.opentelemetry.io/proto/otlp v1.7.1 h1:gTOMpGDb0WTBOP8JaO72iL3auEZhVmAQg4ipjOVAtj4=
 | 
				
			||||||
go.opentelemetry.io/proto/otlp v1.7.0/go.mod h1:fSKjH6YJ7HDlwzltzyMj036AJ3ejJLCgCSHGj4efDDo=
 | 
					go.opentelemetry.io/proto/otlp v1.7.1/go.mod h1:b2rVh6rfI/s2pHWNlB7ILJcRALpcNDzKhACevjI+ZnE=
 | 
				
			||||||
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
 | 
					go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
 | 
				
			||||||
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
 | 
					go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
 | 
				
			||||||
 | 
					golang.org/x/exp v0.0.0-20250718183923-645b1fa84792 h1:R9PFI6EUdfVKgwKjZef7QIwGcBKu86OEFpJ9nUEP2l4=
 | 
				
			||||||
 | 
					golang.org/x/exp v0.0.0-20250718183923-645b1fa84792/go.mod h1:A+z0yzpGtvnG90cToK5n2tu8UJVP2XUATh+r+sfOOOc=
 | 
				
			||||||
golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs=
 | 
					golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs=
 | 
				
			||||||
golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8=
 | 
					golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8=
 | 
				
			||||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 | 
					golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 | 
				
			||||||
@@ -121,16 +146,17 @@ golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA=
 | 
				
			|||||||
golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
 | 
					golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
 | 
				
			||||||
golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4=
 | 
					golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4=
 | 
				
			||||||
golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU=
 | 
					golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU=
 | 
				
			||||||
google.golang.org/genproto/googleapis/api v0.0.0-20250715232539-7130f93afb79 h1:iOye66xuaAK0WnkPuhQPUFy8eJcmwUXqGGP3om6IxX8=
 | 
					google.golang.org/genproto/googleapis/api v0.0.0-20250728155136-f173205681a0 h1:0UOBWO4dC+e51ui0NFKSPbkHHiQ4TmrEfEZMLDyRmY8=
 | 
				
			||||||
google.golang.org/genproto/googleapis/api v0.0.0-20250715232539-7130f93afb79/go.mod h1:HKJDgKsFUnv5VAGeQjz8kxcgDP0HoE0iZNp0OdZNlhE=
 | 
					google.golang.org/genproto/googleapis/api v0.0.0-20250728155136-f173205681a0/go.mod h1:8ytArBbtOy2xfht+y2fqKd5DRDJRUQhqbyEnQ4bDChs=
 | 
				
			||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250715232539-7130f93afb79 h1:1ZwqphdOdWYXsUHgMpU/101nCtf/kSp9hOrcvFsnl10=
 | 
					google.golang.org/genproto/googleapis/rpc v0.0.0-20250728155136-f173205681a0 h1:MAKi5q709QWfnkkpNQ0M12hYJ1+e8qYVDyowc4U1XZM=
 | 
				
			||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250715232539-7130f93afb79/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A=
 | 
					google.golang.org/genproto/googleapis/rpc v0.0.0-20250728155136-f173205681a0/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A=
 | 
				
			||||||
google.golang.org/grpc v1.73.0 h1:VIWSmpI2MegBtTuFt5/JWy2oXxtjJ/e89Z70ImfD2ok=
 | 
					google.golang.org/grpc v1.74.2 h1:WoosgB65DlWVC9FqI82dGsZhWFNBSLjQ84bjROOpMu4=
 | 
				
			||||||
google.golang.org/grpc v1.73.0/go.mod h1:50sbHOUqWoCQGI8V2HQLJM0B+LMlIUjNSZmow7EVBQc=
 | 
					google.golang.org/grpc v1.74.2/go.mod h1:CtQ+BGjaAIXHs/5YS3i473GqwBBa1zGQNevxdeBEXrM=
 | 
				
			||||||
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
 | 
					google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
 | 
				
			||||||
google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
 | 
					google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
 | 
				
			||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
 | 
					gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
 | 
				
			||||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
 | 
					gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
 | 
				
			||||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
 | 
					gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
 | 
				
			||||||
 | 
					gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
 | 
				
			||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
 | 
					gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
 | 
				
			||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
 | 
					gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,3 +1,5 @@
 | 
				
			|||||||
 | 
					// Package app provides methods to configure, run, and stop
 | 
				
			||||||
 | 
					// a go-app.
 | 
				
			||||||
package app
 | 
					package app
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
@@ -11,6 +13,8 @@ import (
 | 
				
			|||||||
	httpopts "gitea.libretechconsulting.com/rmcguire/go-app/pkg/srv/http/opts"
 | 
						httpopts "gitea.libretechconsulting.com/rmcguire/go-app/pkg/srv/http/opts"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// App is the main application struct, holding its context, configurations,
 | 
				
			||||||
 | 
					// and various services like HTTP and gRPC.
 | 
				
			||||||
type App struct {
 | 
					type App struct {
 | 
				
			||||||
	AppContext    context.Context
 | 
						AppContext    context.Context
 | 
				
			||||||
	HTTP          *httpopts.AppHTTP
 | 
						HTTP          *httpopts.AppHTTP
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -62,7 +62,12 @@ func (a *App) initHTTP(ctx context.Context) error {
 | 
				
			|||||||
	return err
 | 
						return err
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (a *App) initOTEL() {
 | 
					func (a *App) InitOTEL() {
 | 
				
			||||||
 | 
						if a.tracer != nil {
 | 
				
			||||||
 | 
							a.l.Debug().Msg("superfluous call of already configured app otel")
 | 
				
			||||||
 | 
							return
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	var otelShutdown shutdownFunc
 | 
						var otelShutdown shutdownFunc
 | 
				
			||||||
	a.AppContext, otelShutdown = otel.Init(a.AppContext)
 | 
						a.AppContext, otelShutdown = otel.Init(a.AppContext)
 | 
				
			||||||
	a.shutdownFuncs = append(a.shutdownFuncs, otelShutdown)
 | 
						a.shutdownFuncs = append(a.shutdownFuncs, otelShutdown)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,7 +27,7 @@ func (a *App) monitor() {
 | 
				
			|||||||
	a.appDone <- nil // Notify app
 | 
						a.appDone <- nil // Notify app
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Typically invoked when AppContext is done
 | 
					// Shutdown is typically invoked when AppContext is done
 | 
				
			||||||
// or Server has exited. Not intended to be called
 | 
					// or Server has exited. Not intended to be called
 | 
				
			||||||
// manually
 | 
					// manually
 | 
				
			||||||
func (a *App) Shutdown() {
 | 
					func (a *App) Shutdown() {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -35,7 +35,7 @@ func (a *App) MustRun() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	// Start OTEL
 | 
						// Start OTEL
 | 
				
			||||||
	// Registers a NO-OP provider if not enabled
 | 
						// Registers a NO-OP provider if not enabled
 | 
				
			||||||
	a.initOTEL()
 | 
						a.InitOTEL()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// With OTEL ready, create an init span to track startup
 | 
						// With OTEL ready, create an init span to track startup
 | 
				
			||||||
	ctx, initSpan := a.tracer.Start(a.AppContext, "init")
 | 
						ctx, initSpan := a.tracer.Start(a.AppContext, "init")
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,11 +6,11 @@ import (
 | 
				
			|||||||
	js "github.com/swaggest/jsonschema-go"
 | 
						js "github.com/swaggest/jsonschema-go"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Generates json schema for app's config.AppConfig
 | 
					// Schema generates json schema for app's config.AppConfig
 | 
				
			||||||
func (app *App) Schema() ([]byte, error) {
 | 
					func (a *App) Schema() ([]byte, error) {
 | 
				
			||||||
	r := js.Reflector{}
 | 
						r := js.Reflector{}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	s, err := r.Reflect(*app.cfg)
 | 
						s, err := r.Reflect(*a.cfg)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -18,7 +18,7 @@ func (app *App) Schema() ([]byte, error) {
 | 
				
			|||||||
	return json.MarshalIndent(s, "", "  ")
 | 
						return json.MarshalIndent(s, "", "  ")
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Generates json schema for custom config
 | 
					// CustomSchema generates json schema for custom config
 | 
				
			||||||
// which embeds *config.AppConfig into it
 | 
					// which embeds *config.AppConfig into it
 | 
				
			||||||
// Panics if no *config.AppConfig is embedded into custom
 | 
					// Panics if no *config.AppConfig is embedded into custom
 | 
				
			||||||
// config type
 | 
					// config type
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,7 +9,7 @@ import (
 | 
				
			|||||||
	"gitea.libretechconsulting.com/rmcguire/go-app/pkg/logging"
 | 
						"gitea.libretechconsulting.com/rmcguire/go-app/pkg/logging"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Helper function to return a context loaded up with
 | 
					// MustSetupConfigAndLogging is a helper function to return a context loaded up with
 | 
				
			||||||
// config.AppConfig and a logger
 | 
					// config.AppConfig and a logger
 | 
				
			||||||
func MustSetupConfigAndLogging(ctx context.Context) context.Context {
 | 
					func MustSetupConfigAndLogging(ctx context.Context) context.Context {
 | 
				
			||||||
	ctx, err := config.LoadConfig(ctx)
 | 
						ctx, err := config.LoadConfig(ctx)
 | 
				
			||||||
@@ -24,7 +24,7 @@ func MustSetupConfigAndLogging(ctx context.Context) context.Context {
 | 
				
			|||||||
	return ctx
 | 
						return ctx
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Unmarshal config into a custom type
 | 
					// MustSetupConfigAndLoggingInto will unmarshal config into a custom type
 | 
				
			||||||
// Type MUST include *config.AppConfig
 | 
					// Type MUST include *config.AppConfig
 | 
				
			||||||
// Stored in context as *config.AppConfig but can be asserted back
 | 
					// Stored in context as *config.AppConfig but can be asserted back
 | 
				
			||||||
func MustSetupConfigAndLoggingInto[T any](ctx context.Context, into T) (context.Context, T) {
 | 
					func MustSetupConfigAndLoggingInto[T any](ctx context.Context, into T) (context.Context, T) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,7 +13,7 @@ import (
 | 
				
			|||||||
	"gitea.libretechconsulting.com/rmcguire/go-app/pkg/config"
 | 
						"gitea.libretechconsulting.com/rmcguire/go-app/pkg/config"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Used to unmarshal config and environment into a custom type
 | 
					// MustLoadConfigInto is used to unmarshal config and environment into a custom type
 | 
				
			||||||
// that overloads *config.AppConfig. Will perform normal env
 | 
					// that overloads *config.AppConfig. Will perform normal env
 | 
				
			||||||
// substitutions for AppConfig, but env overrides for custom type
 | 
					// substitutions for AppConfig, but env overrides for custom type
 | 
				
			||||||
// are up to the caller.
 | 
					// are up to the caller.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,3 +1,7 @@
 | 
				
			|||||||
 | 
					// Package config provides types and methods for managing
 | 
				
			||||||
 | 
					// app config. A go-app configuration can be extended by any type
 | 
				
			||||||
 | 
					// that embeds AppConfig, and has helpers to generate json
 | 
				
			||||||
 | 
					// schema merged with the custom type's fields
 | 
				
			||||||
package config
 | 
					package config
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
@@ -13,15 +17,15 @@ import (
 | 
				
			|||||||
	"gopkg.in/yaml.v3"
 | 
						"gopkg.in/yaml.v3"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// To be set by ldflags in go build command or
 | 
					// Version is to be set by ldflags in go build command or
 | 
				
			||||||
// retrieved from build meta below
 | 
					// retrieved from build meta below.
 | 
				
			||||||
var Version = "(devel)"
 | 
					var Version = "(devel)"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Calling this will try to load from config if -config is
 | 
					// LoadConfig will try to load from config if -config is
 | 
				
			||||||
// provided as a file, and will apply any environment overrides
 | 
					// provided as a file, and will apply any environment overrides
 | 
				
			||||||
// on-top of configuration defaults.
 | 
					// on-top of configuration defaults.
 | 
				
			||||||
// Config is stored in returned context, and can be retrieved
 | 
					// Config is stored in returned context, and can be retrieved
 | 
				
			||||||
// using config.FromCtx(ctx)
 | 
					// using config.FromCtx(ctx).
 | 
				
			||||||
func LoadConfig(ctx context.Context) (context.Context, error) {
 | 
					func LoadConfig(ctx context.Context) (context.Context, error) {
 | 
				
			||||||
	configPath := flag.String("config", "", "Path to the configuration file")
 | 
						configPath := flag.String("config", "", "Path to the configuration file")
 | 
				
			||||||
	flag.Parse()
 | 
						flag.Parse()
 | 
				
			||||||
@@ -40,6 +44,8 @@ func LoadConfig(ctx context.Context) (context.Context, error) {
 | 
				
			|||||||
	return ctx, nil
 | 
						return ctx, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// loadConfig loads the application configuration from the specified path,
 | 
				
			||||||
 | 
					// applying environment variable overrides.
 | 
				
			||||||
func loadConfig(configPath string) (*AppConfig, error) {
 | 
					func loadConfig(configPath string) (*AppConfig, error) {
 | 
				
			||||||
	cfg := *DefaultConfig
 | 
						cfg := *DefaultConfig
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -69,6 +75,8 @@ func loadConfig(configPath string) (*AppConfig, error) {
 | 
				
			|||||||
	return &cfg, nil
 | 
						return &cfg, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// prepareConfig enriches and validates the AppConfig, parsing duration strings
 | 
				
			||||||
 | 
					// for HTTP timeouts.
 | 
				
			||||||
func prepareConfig(cfg *AppConfig) error {
 | 
					func prepareConfig(cfg *AppConfig) error {
 | 
				
			||||||
	var errs error
 | 
						var errs error
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -100,12 +108,14 @@ func prepareConfig(cfg *AppConfig) error {
 | 
				
			|||||||
	return errs
 | 
						return errs
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Returns read timeout, write timeout, and idle timeout, in that order
 | 
					// Timeouts returns read timeout, write timeout, and idle timeout, in that order.
 | 
				
			||||||
// nil if unset
 | 
					// Returns nil if unset.
 | 
				
			||||||
func (h *HTTPConfig) Timeouts() (*time.Duration, *time.Duration, *time.Duration) {
 | 
					func (h *HTTPConfig) Timeouts() (*time.Duration, *time.Duration, *time.Duration) {
 | 
				
			||||||
	return h.rT, h.wT, h.iT
 | 
						return h.rT, h.wT, h.iT
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// getVersion returns the application version, preferring the build info version
 | 
				
			||||||
 | 
					// over the compile-time set Version variable.
 | 
				
			||||||
func getVersion() string {
 | 
					func getVersion() string {
 | 
				
			||||||
	if info, ok := debug.ReadBuildInfo(); ok && info.Main.Version != "(devel)" {
 | 
						if info, ok := debug.ReadBuildInfo(); ok && info.Main.Version != "(devel)" {
 | 
				
			||||||
		return info.Main.Version
 | 
							return info.Main.Version
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,10 +9,12 @@ type appConfigKey uint8
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
const appConfigCtxKey appConfigKey = iota
 | 
					const appConfigCtxKey appConfigKey = iota
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (a *AppConfig) AddToCtx(ctx context.Context) context.Context {
 | 
					// AddToCtx adds the AppConfig to the provided context.
 | 
				
			||||||
	return context.WithValue(ctx, appConfigCtxKey, a)
 | 
					func (ac *AppConfig) AddToCtx(ctx context.Context) context.Context {
 | 
				
			||||||
 | 
						return context.WithValue(ctx, appConfigCtxKey, ac)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// MustFromCtx retrieves the AppConfig from the context, or panics if not found.
 | 
				
			||||||
func MustFromCtx(ctx context.Context) *AppConfig {
 | 
					func MustFromCtx(ctx context.Context) *AppConfig {
 | 
				
			||||||
	cfg, err := FromCtx(ctx)
 | 
						cfg, err := FromCtx(ctx)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
@@ -21,6 +23,7 @@ func MustFromCtx(ctx context.Context) *AppConfig {
 | 
				
			|||||||
	return cfg
 | 
						return cfg
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// FromCtx retrieves the AppConfig from the context.
 | 
				
			||||||
func FromCtx(ctx context.Context) (*AppConfig, error) {
 | 
					func FromCtx(ctx context.Context) (*AppConfig, error) {
 | 
				
			||||||
	ctxData := ctx.Value(appConfigCtxKey)
 | 
						ctxData := ctx.Value(appConfigCtxKey)
 | 
				
			||||||
	if ctxData == nil {
 | 
						if ctxData == nil {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
package config
 | 
					package config
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Default Settings
 | 
					// DefaultConfig provides a default application configuration.
 | 
				
			||||||
var DefaultConfig = &AppConfig{
 | 
					var DefaultConfig = &AppConfig{
 | 
				
			||||||
	Environment: "development",
 | 
						Environment: "development",
 | 
				
			||||||
	Version:     getVersion(),
 | 
						Version:     getVersion(),
 | 
				
			||||||
@@ -23,6 +23,7 @@ type AppConfig struct {
 | 
				
			|||||||
	GRPC    *GRPCConfig `yaml:"grpc,omitempty" json:"grpc,omitempty"`
 | 
						GRPC    *GRPCConfig `yaml:"grpc,omitempty" json:"grpc,omitempty"`
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// HTTPEnabled returns true if HTTP is enabled in the AppConfig.
 | 
				
			||||||
func (ac *AppConfig) HTTPEnabled() bool {
 | 
					func (ac *AppConfig) HTTPEnabled() bool {
 | 
				
			||||||
	if ac.HTTP != nil && ac.HTTP.Enabled {
 | 
						if ac.HTTP != nil && ac.HTTP.Enabled {
 | 
				
			||||||
		return true
 | 
							return true
 | 
				
			||||||
@@ -30,6 +31,7 @@ func (ac *AppConfig) HTTPEnabled() bool {
 | 
				
			|||||||
	return false
 | 
						return false
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// GRPCEnabled returns true if gRPC is enabled in the AppConfig.
 | 
				
			||||||
func (ac *AppConfig) GRPCEnabled() bool {
 | 
					func (ac *AppConfig) GRPCEnabled() bool {
 | 
				
			||||||
	if ac.GRPC != nil && ac.GRPC.Enabled {
 | 
						if ac.GRPC != nil && ac.GRPC.Enabled {
 | 
				
			||||||
		return true
 | 
							return true
 | 
				
			||||||
@@ -37,6 +39,7 @@ func (ac *AppConfig) GRPCEnabled() bool {
 | 
				
			|||||||
	return false
 | 
						return false
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// OTELEnabled returns true if OpenTelemetry is enabled in the AppConfig.
 | 
				
			||||||
func (ac *AppConfig) OTELEnabled() bool {
 | 
					func (ac *AppConfig) OTELEnabled() bool {
 | 
				
			||||||
	if ac.OTEL != nil && ac.OTEL.Enabled {
 | 
						if ac.OTEL != nil && ac.OTEL.Enabled {
 | 
				
			||||||
		return true
 | 
							return true
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,6 +13,7 @@ type GRPCConfig struct {
 | 
				
			|||||||
	Enabled               bool   `yaml:"enabled" env:"APP_GRPC_ENABLED" json:"enabled,omitempty"`
 | 
						Enabled               bool   `yaml:"enabled" env:"APP_GRPC_ENABLED" json:"enabled,omitempty"`
 | 
				
			||||||
	Listen                string `yaml:"listen" env:"APP_GRPC_LISTEN" json:"listen,omitempty"`
 | 
						Listen                string `yaml:"listen" env:"APP_GRPC_LISTEN" json:"listen,omitempty"`
 | 
				
			||||||
	LogRequests           bool   `yaml:"logRequests" env:"APP_GRPC_LOG_REQUESTS" json:"logRequests,omitempty"`
 | 
						LogRequests           bool   `yaml:"logRequests" env:"APP_GRPC_LOG_REQUESTS" json:"logRequests,omitempty"`
 | 
				
			||||||
 | 
						EnableProtovalidate   bool   `yaml:"enableProtovalidate" env:"APP_GRPC_ENABLE_PROTOVALIDATE" json:"enableProtovalidate,omitempty" default:"false" description:"Add a chain unary and streaming interceptor for buf.build/go/protovalidate"`
 | 
				
			||||||
	EnableReflection      bool   `yaml:"enableReflection" env:"APP_GRPC_ENABLE_REFLECTION" json:"enableReflection,omitempty"`
 | 
						EnableReflection      bool   `yaml:"enableReflection" env:"APP_GRPC_ENABLE_REFLECTION" json:"enableReflection,omitempty"`
 | 
				
			||||||
	EnableInstrumentation bool   `yaml:"enableInstrumentation" env:"APP_GRPC_ENABLE_INSTRUMENTATION" json:"enableInstrumentation,omitempty"` // requires OTEL
 | 
						EnableInstrumentation bool   `yaml:"enableInstrumentation" env:"APP_GRPC_ENABLE_INSTRUMENTATION" json:"enableInstrumentation,omitempty"` // requires OTEL
 | 
				
			||||||
	EnableGRPCGateway     bool   `yaml:"enableGRPCGateway" json:"enableGRPCGateway,omitempty" env:"APP_GRPC_ENABLE_GATEWAY" default:"true"`
 | 
						EnableGRPCGateway     bool   `yaml:"enableGRPCGateway" json:"enableGRPCGateway,omitempty" env:"APP_GRPC_ENABLE_GATEWAY" default:"true"`
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,7 +12,7 @@ var defaultHTTPConfig = &HTTPConfig{
 | 
				
			|||||||
	IdleTimeout:  "1m",
 | 
						IdleTimeout:  "1m",
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// HTTP Configuration
 | 
					// HTTPConfig provides HTTP server Configuration
 | 
				
			||||||
type HTTPConfig struct {
 | 
					type HTTPConfig struct {
 | 
				
			||||||
	Enabled      bool   `yaml:"enabled" env:"APP_HTTP_ENABLED" json:"enabled,omitempty"`
 | 
						Enabled      bool   `yaml:"enabled" env:"APP_HTTP_ENABLED" json:"enabled,omitempty"`
 | 
				
			||||||
	Listen       string `yaml:"listen,omitempty" env:"APP_HTTP_LISTEN" json:"listen,omitempty"`
 | 
						Listen       string `yaml:"listen,omitempty" env:"APP_HTTP_LISTEN" json:"listen,omitempty"`
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,7 +8,7 @@ var defaultLoggingConfig = &LogConfig{
 | 
				
			|||||||
	TimeFormat: TimeFormatLong,
 | 
						TimeFormat: TimeFormatLong,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Logging Configuration
 | 
					// LogConfig provides Logging Configuration
 | 
				
			||||||
type LogConfig struct {
 | 
					type LogConfig struct {
 | 
				
			||||||
	Enabled    bool       `yaml:"enabled,omitempty" env:"APP_LOG_ENABLED" json:"enabled,omitempty"`
 | 
						Enabled    bool       `yaml:"enabled,omitempty" env:"APP_LOG_ENABLED" json:"enabled,omitempty"`
 | 
				
			||||||
	Level      string     `yaml:"level,omitempty" env:"APP_LOG_LEVEL" json:"level,omitempty"`
 | 
						Level      string     `yaml:"level,omitempty" env:"APP_LOG_LEVEL" json:"level,omitempty"`
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,7 +8,7 @@ var defaultOTELConfig = &OTELConfig{
 | 
				
			|||||||
	MetricIntervalSecs: 30,
 | 
						MetricIntervalSecs: 30,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// OTEL Configuration
 | 
					// OtelConfig provides OTEL Configuration
 | 
				
			||||||
type OTELConfig struct {
 | 
					type OTELConfig struct {
 | 
				
			||||||
	Enabled            bool   `yaml:"enabled,omitempty" env:"APP_OTEL_ENABLED" json:"enabled,omitempty"`
 | 
						Enabled            bool   `yaml:"enabled,omitempty" env:"APP_OTEL_ENABLED" json:"enabled,omitempty"`
 | 
				
			||||||
	PrometheusEnabled  bool   `yaml:"prometheusEnabled,omitempty" env:"APP_OTEL_PROMETHEUS_ENABLED" json:"prometheusEnabled,omitempty"`
 | 
						PrometheusEnabled  bool   `yaml:"prometheusEnabled,omitempty" env:"APP_OTEL_PROMETHEUS_ENABLED" json:"prometheusEnabled,omitempty"`
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,3 +1,5 @@
 | 
				
			|||||||
 | 
					// Package logging provides a centralized logging utility using zerolog,
 | 
				
			||||||
 | 
					// with configurable output formats and log levels.
 | 
				
			||||||
package logging
 | 
					package logging
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,3 +1,4 @@
 | 
				
			|||||||
 | 
					// Package otel provides OpenTelemetry initialization and configuration for tracing and metrics.
 | 
				
			||||||
package otel
 | 
					package otel
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
@@ -39,6 +40,7 @@ var (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
const defMetricInterval = 15 * time.Second
 | 
					const defMetricInterval = 15 * time.Second
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Init prepares otel, loading a tracer and meter stored in appp context.
 | 
				
			||||||
// Context must carry config.AppConfig
 | 
					// Context must carry config.AppConfig
 | 
				
			||||||
func Init(ctx context.Context) (context.Context, func(context.Context) error) {
 | 
					func Init(ctx context.Context) (context.Context, func(context.Context) error) {
 | 
				
			||||||
	cfg := config.MustFromCtx(ctx)
 | 
						cfg := config.MustFromCtx(ctx)
 | 
				
			||||||
@@ -232,7 +234,7 @@ func (s *settings) newMeterProvider(ctx context.Context) (*metric.MeterProvider,
 | 
				
			|||||||
	return meterProvider, nil
 | 
						return meterProvider, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Creates a new tracer from the global opentelemetry provider
 | 
					// NewTracer creates a new tracer from the global opentelemetry provider
 | 
				
			||||||
func NewTracer(options ...trace.TracerOption) trace.Tracer {
 | 
					func NewTracer(options ...trace.TracerOption) trace.Tracer {
 | 
				
			||||||
	return opentelemetry.GetTracerProvider().Tracer(
 | 
						return opentelemetry.GetTracerProvider().Tracer(
 | 
				
			||||||
		os.Getenv("OTEL_SERVICE_NAME"),
 | 
							os.Getenv("OTEL_SERVICE_NAME"),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,3 +1,5 @@
 | 
				
			|||||||
 | 
					// Package grpc provides a gRPC server implementation with OpenTelemetry integration
 | 
				
			||||||
 | 
					// and gRPC Gateway for RESTful API exposure.
 | 
				
			||||||
package grpc
 | 
					package grpc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,7 +4,9 @@ import (
 | 
				
			|||||||
	"context"
 | 
						"context"
 | 
				
			||||||
	"errors"
 | 
						"errors"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						"buf.build/go/protovalidate"
 | 
				
			||||||
	grpclogging "github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/logging"
 | 
						grpclogging "github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/logging"
 | 
				
			||||||
 | 
						protovalidate_middleware "github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/protovalidate"
 | 
				
			||||||
	"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
 | 
						"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
 | 
				
			||||||
	"go.opentelemetry.io/otel"
 | 
						"go.opentelemetry.io/otel"
 | 
				
			||||||
	"go.opentelemetry.io/otel/attribute"
 | 
						"go.opentelemetry.io/otel/attribute"
 | 
				
			||||||
@@ -29,6 +31,7 @@ func (a *appGRPCServer) prepGRPCServer(spanCtx context.Context) error {
 | 
				
			|||||||
	// Prepare GRPC Server Opts
 | 
						// Prepare GRPC Server Opts
 | 
				
			||||||
	a.prepareOTEL(ctx)
 | 
						a.prepareOTEL(ctx)
 | 
				
			||||||
	a.prepareLogging(ctx)
 | 
						a.prepareLogging(ctx)
 | 
				
			||||||
 | 
						a.prepareProtovalidate(ctx)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Chain interceptors for unary RPCs
 | 
						// Chain interceptors for unary RPCs
 | 
				
			||||||
	a.serverOpts = append(a.serverOpts,
 | 
						a.serverOpts = append(a.serverOpts,
 | 
				
			||||||
@@ -69,6 +72,28 @@ func (a *appGRPCServer) prepGRPCServer(spanCtx context.Context) error {
 | 
				
			|||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// prepareProtovalidate() adds interceptors for buf.build protovalidate
 | 
				
			||||||
 | 
					func (a *appGRPCServer) prepareProtovalidate(spanCtx context.Context) {
 | 
				
			||||||
 | 
						_, span := a.tracer.Start(spanCtx, "appgrpc.init.prepare.protovalidate", trace.WithAttributes(
 | 
				
			||||||
 | 
							attribute.Bool("grpc.server.protovalidate", a.opts.EnableProtovalidate)))
 | 
				
			||||||
 | 
						defer span.End()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if !a.opts.EnableProtovalidate {
 | 
				
			||||||
 | 
							return
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						validator, err := protovalidate.New()
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							span.RecordError(err)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						a.opts.UnaryInterceptors = append(a.opts.UnaryInterceptors,
 | 
				
			||||||
 | 
							protovalidate_middleware.UnaryServerInterceptor(validator))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						a.opts.StreamInterceptors = append(a.opts.StreamInterceptors,
 | 
				
			||||||
 | 
							protovalidate_middleware.StreamServerInterceptor(validator))
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (a *appGRPCServer) prepareOTEL(spanCtx context.Context) {
 | 
					func (a *appGRPCServer) prepareOTEL(spanCtx context.Context) {
 | 
				
			||||||
	_, span := a.tracer.Start(spanCtx, "appgrpc.init.prepare.otel", trace.WithAttributes(
 | 
						_, span := a.tracer.Start(spanCtx, "appgrpc.init.prepare.otel", trace.WithAttributes(
 | 
				
			||||||
		attribute.Bool("grpc.server.instrumented", a.opts.EnableInstrumentation)))
 | 
							attribute.Bool("grpc.server.instrumented", a.opts.EnableInstrumentation)))
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -55,7 +55,7 @@ func handleHealthCheckFunc(ctx context.Context, hcFuncs ...opts.HealthCheckFunc)
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func dummyHealthCheck(ctx context.Context) error {
 | 
					func dummyHealthCheck(ctx context.Context) error {
 | 
				
			||||||
	workFor := rand.Intn(750)
 | 
						workFor := rand.Intn(740) + 10 // ensure positive
 | 
				
			||||||
	ticker := time.NewTicker(time.Duration(time.Duration(workFor) * time.Millisecond))
 | 
						ticker := time.NewTicker(time.Duration(time.Duration(workFor) * time.Millisecond))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	select {
 | 
						select {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user