update config dependency (#11611)
This PR does a couple of things that I couldn't quite split up so I put together a PR w/ individual commits to help reviewers get through it. This PR does the following: 1. update `go.opentelemetry.io/contrib/config` package to latest. this brings in breaking changes. in order to prevent those breaking changes from impacting end users, i've also added a layer of config unmarshaling 2. updates the collector to instantiate the meter provider (and exporters) via the config package. this allows us to remove all the code in `otelinit`. the reason for including this change was that unmarshaling the config was causing circular dependencies i didn't want to address by moving code that could be deleted around. Replacement for https://github.com/open-telemetry/opentelemetry-collector/pull/11458. Fixes https://github.com/open-telemetry/opentelemetry-collector/issues/12021 --------- Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									2447a81885
								
							
						
					
					
						commit
						4edaacddf9
					
				| 
						 | 
				
			
			@ -0,0 +1,25 @@
 | 
			
		|||
# Use this changelog template to create an entry for release notes.
 | 
			
		||||
 | 
			
		||||
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
 | 
			
		||||
change_type: enhancement
 | 
			
		||||
 | 
			
		||||
# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
 | 
			
		||||
component: service
 | 
			
		||||
 | 
			
		||||
# A brief description of the change.  Surround your text with quotes ("") if it needs to start with a backtick (`).
 | 
			
		||||
note: remove custom code and instead use config package to instantiate meter provider.
 | 
			
		||||
 | 
			
		||||
# One or more tracking issues or pull requests related to the change
 | 
			
		||||
issues: [11611]
 | 
			
		||||
 | 
			
		||||
# (Optional) One or more lines of additional information to render under the primary note.
 | 
			
		||||
# These lines will be padded with 2 spaces and then inserted directly into the document.
 | 
			
		||||
# Use pipe (|) for multiline entries.
 | 
			
		||||
subtext:
 | 
			
		||||
 | 
			
		||||
# Optional: The change log or logs in which this entry should be included.
 | 
			
		||||
# e.g. '[user]' or '[user, api]'
 | 
			
		||||
# Include 'user' if the change is relevant to end users.
 | 
			
		||||
# Include 'api' if there is a change to a library API.
 | 
			
		||||
# Default: '[user]'
 | 
			
		||||
change_logs: []
 | 
			
		||||
| 
						 | 
				
			
			@ -123,26 +123,27 @@ require (
 | 
			
		|||
	go.opentelemetry.io/collector/semconv v0.118.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/collector/service v0.118.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/contrib/bridges/otelzap v0.9.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/contrib/config v0.10.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/contrib/config v0.14.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.59.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.59.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/contrib/propagators/b3 v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/contrib/zpages v0.59.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.7.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.10.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.10.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.31.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.31.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/prometheus v0.56.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.7.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.10.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.31.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/log v0.10.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/metric v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/sdk v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/sdk/log v0.7.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/sdk/log v0.10.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/sdk/metric v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/trace v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/proto/otlp v1.5.0 // indirect
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -115,8 +115,8 @@ go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJyS
 | 
			
		|||
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
 | 
			
		||||
go.opentelemetry.io/contrib/bridges/otelzap v0.9.0 h1:f+xpAfhQTjR8beiSMe1bnT/25PkeyWmOcI+SjXWguNw=
 | 
			
		||||
go.opentelemetry.io/contrib/bridges/otelzap v0.9.0/go.mod h1:T1Z1jyS5FttgQoF6UcGhnM+gF9wU32B4lHO69nXw4FE=
 | 
			
		||||
go.opentelemetry.io/contrib/config v0.10.0 h1:2JknAzMaYjxrHkTnZh3eOme/Y2P5eHE2SWfhfV6Xd6c=
 | 
			
		||||
go.opentelemetry.io/contrib/config v0.10.0/go.mod h1:aND2M6/KfNkntI5cyvHriR/zvZgPf8j9yETdSmvpfmc=
 | 
			
		||||
go.opentelemetry.io/contrib/config v0.14.0 h1:QAG8uHNp5ZiCkpT7XggSmg5AyW1sA0LgypMoXgBB1+4=
 | 
			
		||||
go.opentelemetry.io/contrib/config v0.14.0/go.mod h1:77rDmFPqBae5jtQ2C78RuDTHz4P27C8LzoN0MZyumYQ=
 | 
			
		||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.59.0 h1:rgMkmiGfix9vFJDcDi1PK8WEQP4FLQwLDfhp5ZLpFeE=
 | 
			
		||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.59.0/go.mod h1:ijPqXp5P6IRRByFVVg9DY8P5HkxkHE5ARIa+86aXPf4=
 | 
			
		||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.59.0 h1:CV7UdSGJt/Ao6Gp4CXckLxVRRsRgDHoI8XjbL3PDl8s=
 | 
			
		||||
| 
						 | 
				
			
			@ -127,34 +127,36 @@ go.opentelemetry.io/contrib/zpages v0.59.0 h1:t0H5zUy8fifIhRuVwm2FrA/D70Kk10SSpA
 | 
			
		|||
go.opentelemetry.io/contrib/zpages v0.59.0/go.mod h1:9wo+yUPvHnBQEzoHJ8R3nA/Q5rkef7HjtLlSFI0Tgrc=
 | 
			
		||||
go.opentelemetry.io/otel v1.34.0 h1:zRLXxLCgL1WyKsPVrgbSdMN4c0FMkDAskSTQP+0hdUY=
 | 
			
		||||
go.opentelemetry.io/otel v1.34.0/go.mod h1:OWFPOQ+h4G8xpyjgqo4SxJYdDQ/qmRH+wivy7zzx9oI=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.7.0 h1:mMOmtYie9Fx6TSVzw4W+NTpvoaS1JWWga37oI1a/4qQ=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.7.0/go.mod h1:yy7nDsMMBUkD+jeekJ36ur5f3jJIrmCwUrY67VFhNpA=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.10.0 h1:5dTKu4I5Dn4P2hxyW3l3jTaZx9ACgg0ECos1eAVrheY=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.10.0/go.mod h1:P5HcUI8obLrCCmM3sbVBohZFH34iszk/+CPWuakZWL8=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.10.0 h1:q/heq5Zh8xV1+7GoMGJpTxM2Lhq5+bFxB29tshuRuw0=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.10.0/go.mod h1:leO2CSTg0Y+LyvmR7Wm4pUxE8KAmaM2GCVx7O+RATLA=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.34.0 h1:ajl4QczuJVA2TU9W9AGw++86Xga/RKt//16z/yxPgdk=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.34.0/go.mod h1:Vn3/rlOJ3ntf/Q3zAI0V5lDnTbHGaUsNUeF6nZmm7pA=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.34.0 h1:opwv08VbCZ8iecIWs+McMdHRcAXzjAeda3uG2kI/hcA=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.34.0/go.mod h1:oOP3ABpW7vFHulLpE8aYtNBodrHhMTrvfxUXGvqm7Ac=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0 h1:K0XaT3DwHAcV4nKLzcQvwAgSyisUghWoY20I7huthMk=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0/go.mod h1:B5Ki776z/MBnVha1Nzwp5arlzBbE3+1jk+pGmaP5HME=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.31.0 h1:FFeLy03iVTXP6ffeN2iXrxfGsZGCjVx0/4KlizjyBwU=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.31.0/go.mod h1:TMu73/k1CP8nBUpDLc71Wj/Kf7ZS9FK5b53VapRsP9o=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.31.0 h1:lUsI2TYsQw2r1IASwoROaCnjdj2cvC2+Jbxvk6nHnWU=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.31.0/go.mod h1:2HpZxxQurfGxJlJDblybejHB6RX6pmExPNe517hREw4=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.34.0 h1:OeNbIYk/2C15ckl7glBlOBp5+WlYsOElzTNmiPW/x60=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.34.0/go.mod h1:7Bept48yIeqxP2OZ9/AqIpYS94h2or0aB4FypJTc8ZM=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.34.0 h1:tgJ0uaNS4c98WRNUEx5U3aDlrDOI5Rs+1Vifcw4DJ8U=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.34.0/go.mod h1:U7HYyW0zt/a9x5J1Kjs+r1f/d4ZHnYFclhYY2+YbeoE=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.34.0 h1:BEj3SPM81McUZHYjRS5pEgNgnmzGJ5tRpU5krWnV8Bs=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.34.0/go.mod h1:9cKLGBDzI/F3NoHLQGm4ZrYdIHsvGt6ej6hUowxY0J4=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/prometheus v0.56.0 h1:GnCIi0QyG0yy2MrJLzVrIM7laaJstj//flf1zEJCG+E=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/prometheus v0.56.0/go.mod h1:JQcVZtbIIPM+7SWBB+T6FK+xunlyidwLp++fN0sUaOk=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.7.0 h1:TwmL3O3fRR80m8EshBrd8YydEZMcUCsZXzOUlnFohwM=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.7.0/go.mod h1:tH98dDv5KPmPThswbXA0fr0Lwfs+OhK8HgaCo7PjRrk=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.10.0 h1:GKCEAZLEpEf78cUvudQdTg0aET2ObOZRB2HtXA0qPAI=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.10.0/go.mod h1:9/zqSWLCmHT/9Jo6fYeUDRRogOLL60ABLsHWS99lF8s=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.34.0 h1:czJDQwFrMbOr9Kk+BPo1y8WZIIFIK58SA1kykuVeiOU=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.34.0/go.mod h1:lT7bmsxOe58Tq+JIOkTQMCGXdu47oA+VJKLZHbaBKbs=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.31.0 h1:UGZ1QwZWY67Z6BmckTU+9Rxn04m2bD3gD6Mk0OIOCPk=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.31.0/go.mod h1:fcwWuDuaObkkChiDlhEpSq9+X1C0omv+s5mBtToAQ64=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.34.0 h1:jBpDk4HAUsrnVO1FsfCfCOTEc/MkInJmvfCHYLFiT80=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.34.0/go.mod h1:H9LUIM1daaeZaz91vZcfeM0fejXPmgCYE8ZhzqfJuiU=
 | 
			
		||||
go.opentelemetry.io/otel/log v0.10.0 h1:1CXmspaRITvFcjA4kyVszuG4HjA61fPDxMb7q3BuyF0=
 | 
			
		||||
go.opentelemetry.io/otel/log v0.10.0/go.mod h1:PbVdm9bXKku/gL0oFfUF4wwsQsOPlpo4VEqjvxih+FM=
 | 
			
		||||
go.opentelemetry.io/otel/metric v1.34.0 h1:+eTR3U0MyfWjRDhmFMxe2SsW64QrZ84AOhvqS7Y+PoQ=
 | 
			
		||||
go.opentelemetry.io/otel/metric v1.34.0/go.mod h1:CEDrp0fy2D0MvkXE+dPV7cMi8tWZwX3dmaIhwPOaqHE=
 | 
			
		||||
go.opentelemetry.io/otel/sdk v1.34.0 h1:95zS4k/2GOy069d321O8jWgYsW3MzVV+KuSPKp7Wr1A=
 | 
			
		||||
go.opentelemetry.io/otel/sdk v1.34.0/go.mod h1:0e/pNiaMAqaykJGKbi+tSjWfNNHMTxoC9qANsCzbyxU=
 | 
			
		||||
go.opentelemetry.io/otel/sdk/log v0.7.0 h1:dXkeI2S0MLc5g0/AwxTZv6EUEjctiH8aG14Am56NTmQ=
 | 
			
		||||
go.opentelemetry.io/otel/sdk/log v0.7.0/go.mod h1:oIRXpW+WD6M8BuGj5rtS0aRu/86cbDV/dAfNaZBIjYM=
 | 
			
		||||
go.opentelemetry.io/otel/sdk/log v0.10.0 h1:lR4teQGWfeDVGoute6l0Ou+RpFqQ9vaPdrNJlST0bvw=
 | 
			
		||||
go.opentelemetry.io/otel/sdk/log v0.10.0/go.mod h1:A+V1UTWREhWAittaQEG4bYm4gAZa6xnvVu+xKrIRkzo=
 | 
			
		||||
go.opentelemetry.io/otel/sdk/metric v1.34.0 h1:5CeK9ujjbFVL5c1PhLuStg1wxA7vQv7ce1EK0Gyvahk=
 | 
			
		||||
go.opentelemetry.io/otel/sdk/metric v1.34.0/go.mod h1:jQ/r8Ze28zRKoNRdkjCZxfs6YvBTG1+YIqyFVFYec5w=
 | 
			
		||||
go.opentelemetry.io/otel/trace v1.34.0 h1:+ouXS2V8Rd4hp4580a8q23bg0azF2nI8cqLYnC8mh/k=
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -122,6 +122,9 @@ func checkStructFieldTags(f reflect.StructField) error {
 | 
			
		|||
	default:
 | 
			
		||||
		fieldTag := tagParts[0]
 | 
			
		||||
		if !configFieldTagRegExp.MatchString(fieldTag) {
 | 
			
		||||
			if f.Name == "AdditionalProperties" {
 | 
			
		||||
				return nil
 | 
			
		||||
			}
 | 
			
		||||
			return fmt.Errorf(
 | 
			
		||||
				"field %q has config tag %q which doesn't satisfy %q",
 | 
			
		||||
				f.Name,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -102,25 +102,26 @@ require (
 | 
			
		|||
	go.opentelemetry.io/collector/receiver/xreceiver v0.118.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/collector/semconv v0.118.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/contrib/bridges/otelzap v0.9.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/contrib/config v0.10.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/contrib/config v0.14.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.59.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.59.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/contrib/propagators/b3 v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.7.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.10.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.10.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.31.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.31.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/prometheus v0.56.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.7.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.10.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.31.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/log v0.10.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/metric v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/sdk v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/sdk/log v0.7.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/sdk/log v0.10.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/sdk/metric v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/trace v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/proto/otlp v1.5.0 // indirect
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -107,8 +107,8 @@ go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJyS
 | 
			
		|||
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
 | 
			
		||||
go.opentelemetry.io/contrib/bridges/otelzap v0.9.0 h1:f+xpAfhQTjR8beiSMe1bnT/25PkeyWmOcI+SjXWguNw=
 | 
			
		||||
go.opentelemetry.io/contrib/bridges/otelzap v0.9.0/go.mod h1:T1Z1jyS5FttgQoF6UcGhnM+gF9wU32B4lHO69nXw4FE=
 | 
			
		||||
go.opentelemetry.io/contrib/config v0.10.0 h1:2JknAzMaYjxrHkTnZh3eOme/Y2P5eHE2SWfhfV6Xd6c=
 | 
			
		||||
go.opentelemetry.io/contrib/config v0.10.0/go.mod h1:aND2M6/KfNkntI5cyvHriR/zvZgPf8j9yETdSmvpfmc=
 | 
			
		||||
go.opentelemetry.io/contrib/config v0.14.0 h1:QAG8uHNp5ZiCkpT7XggSmg5AyW1sA0LgypMoXgBB1+4=
 | 
			
		||||
go.opentelemetry.io/contrib/config v0.14.0/go.mod h1:77rDmFPqBae5jtQ2C78RuDTHz4P27C8LzoN0MZyumYQ=
 | 
			
		||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.59.0 h1:rgMkmiGfix9vFJDcDi1PK8WEQP4FLQwLDfhp5ZLpFeE=
 | 
			
		||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.59.0/go.mod h1:ijPqXp5P6IRRByFVVg9DY8P5HkxkHE5ARIa+86aXPf4=
 | 
			
		||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.59.0 h1:CV7UdSGJt/Ao6Gp4CXckLxVRRsRgDHoI8XjbL3PDl8s=
 | 
			
		||||
| 
						 | 
				
			
			@ -119,34 +119,36 @@ go.opentelemetry.io/contrib/zpages v0.59.0 h1:t0H5zUy8fifIhRuVwm2FrA/D70Kk10SSpA
 | 
			
		|||
go.opentelemetry.io/contrib/zpages v0.59.0/go.mod h1:9wo+yUPvHnBQEzoHJ8R3nA/Q5rkef7HjtLlSFI0Tgrc=
 | 
			
		||||
go.opentelemetry.io/otel v1.34.0 h1:zRLXxLCgL1WyKsPVrgbSdMN4c0FMkDAskSTQP+0hdUY=
 | 
			
		||||
go.opentelemetry.io/otel v1.34.0/go.mod h1:OWFPOQ+h4G8xpyjgqo4SxJYdDQ/qmRH+wivy7zzx9oI=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.7.0 h1:mMOmtYie9Fx6TSVzw4W+NTpvoaS1JWWga37oI1a/4qQ=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.7.0/go.mod h1:yy7nDsMMBUkD+jeekJ36ur5f3jJIrmCwUrY67VFhNpA=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.10.0 h1:5dTKu4I5Dn4P2hxyW3l3jTaZx9ACgg0ECos1eAVrheY=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.10.0/go.mod h1:P5HcUI8obLrCCmM3sbVBohZFH34iszk/+CPWuakZWL8=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.10.0 h1:q/heq5Zh8xV1+7GoMGJpTxM2Lhq5+bFxB29tshuRuw0=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.10.0/go.mod h1:leO2CSTg0Y+LyvmR7Wm4pUxE8KAmaM2GCVx7O+RATLA=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.34.0 h1:ajl4QczuJVA2TU9W9AGw++86Xga/RKt//16z/yxPgdk=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.34.0/go.mod h1:Vn3/rlOJ3ntf/Q3zAI0V5lDnTbHGaUsNUeF6nZmm7pA=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.34.0 h1:opwv08VbCZ8iecIWs+McMdHRcAXzjAeda3uG2kI/hcA=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.34.0/go.mod h1:oOP3ABpW7vFHulLpE8aYtNBodrHhMTrvfxUXGvqm7Ac=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0 h1:K0XaT3DwHAcV4nKLzcQvwAgSyisUghWoY20I7huthMk=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0/go.mod h1:B5Ki776z/MBnVha1Nzwp5arlzBbE3+1jk+pGmaP5HME=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.31.0 h1:FFeLy03iVTXP6ffeN2iXrxfGsZGCjVx0/4KlizjyBwU=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.31.0/go.mod h1:TMu73/k1CP8nBUpDLc71Wj/Kf7ZS9FK5b53VapRsP9o=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.31.0 h1:lUsI2TYsQw2r1IASwoROaCnjdj2cvC2+Jbxvk6nHnWU=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.31.0/go.mod h1:2HpZxxQurfGxJlJDblybejHB6RX6pmExPNe517hREw4=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.34.0 h1:OeNbIYk/2C15ckl7glBlOBp5+WlYsOElzTNmiPW/x60=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.34.0/go.mod h1:7Bept48yIeqxP2OZ9/AqIpYS94h2or0aB4FypJTc8ZM=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.34.0 h1:tgJ0uaNS4c98WRNUEx5U3aDlrDOI5Rs+1Vifcw4DJ8U=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.34.0/go.mod h1:U7HYyW0zt/a9x5J1Kjs+r1f/d4ZHnYFclhYY2+YbeoE=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.34.0 h1:BEj3SPM81McUZHYjRS5pEgNgnmzGJ5tRpU5krWnV8Bs=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.34.0/go.mod h1:9cKLGBDzI/F3NoHLQGm4ZrYdIHsvGt6ej6hUowxY0J4=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/prometheus v0.56.0 h1:GnCIi0QyG0yy2MrJLzVrIM7laaJstj//flf1zEJCG+E=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/prometheus v0.56.0/go.mod h1:JQcVZtbIIPM+7SWBB+T6FK+xunlyidwLp++fN0sUaOk=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.7.0 h1:TwmL3O3fRR80m8EshBrd8YydEZMcUCsZXzOUlnFohwM=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.7.0/go.mod h1:tH98dDv5KPmPThswbXA0fr0Lwfs+OhK8HgaCo7PjRrk=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.10.0 h1:GKCEAZLEpEf78cUvudQdTg0aET2ObOZRB2HtXA0qPAI=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.10.0/go.mod h1:9/zqSWLCmHT/9Jo6fYeUDRRogOLL60ABLsHWS99lF8s=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.34.0 h1:czJDQwFrMbOr9Kk+BPo1y8WZIIFIK58SA1kykuVeiOU=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.34.0/go.mod h1:lT7bmsxOe58Tq+JIOkTQMCGXdu47oA+VJKLZHbaBKbs=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.31.0 h1:UGZ1QwZWY67Z6BmckTU+9Rxn04m2bD3gD6Mk0OIOCPk=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.31.0/go.mod h1:fcwWuDuaObkkChiDlhEpSq9+X1C0omv+s5mBtToAQ64=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.34.0 h1:jBpDk4HAUsrnVO1FsfCfCOTEc/MkInJmvfCHYLFiT80=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.34.0/go.mod h1:H9LUIM1daaeZaz91vZcfeM0fejXPmgCYE8ZhzqfJuiU=
 | 
			
		||||
go.opentelemetry.io/otel/log v0.10.0 h1:1CXmspaRITvFcjA4kyVszuG4HjA61fPDxMb7q3BuyF0=
 | 
			
		||||
go.opentelemetry.io/otel/log v0.10.0/go.mod h1:PbVdm9bXKku/gL0oFfUF4wwsQsOPlpo4VEqjvxih+FM=
 | 
			
		||||
go.opentelemetry.io/otel/metric v1.34.0 h1:+eTR3U0MyfWjRDhmFMxe2SsW64QrZ84AOhvqS7Y+PoQ=
 | 
			
		||||
go.opentelemetry.io/otel/metric v1.34.0/go.mod h1:CEDrp0fy2D0MvkXE+dPV7cMi8tWZwX3dmaIhwPOaqHE=
 | 
			
		||||
go.opentelemetry.io/otel/sdk v1.34.0 h1:95zS4k/2GOy069d321O8jWgYsW3MzVV+KuSPKp7Wr1A=
 | 
			
		||||
go.opentelemetry.io/otel/sdk v1.34.0/go.mod h1:0e/pNiaMAqaykJGKbi+tSjWfNNHMTxoC9qANsCzbyxU=
 | 
			
		||||
go.opentelemetry.io/otel/sdk/log v0.7.0 h1:dXkeI2S0MLc5g0/AwxTZv6EUEjctiH8aG14Am56NTmQ=
 | 
			
		||||
go.opentelemetry.io/otel/sdk/log v0.7.0/go.mod h1:oIRXpW+WD6M8BuGj5rtS0aRu/86cbDV/dAfNaZBIjYM=
 | 
			
		||||
go.opentelemetry.io/otel/sdk/log v0.10.0 h1:lR4teQGWfeDVGoute6l0Ou+RpFqQ9vaPdrNJlST0bvw=
 | 
			
		||||
go.opentelemetry.io/otel/sdk/log v0.10.0/go.mod h1:A+V1UTWREhWAittaQEG4bYm4gAZa6xnvVu+xKrIRkzo=
 | 
			
		||||
go.opentelemetry.io/otel/sdk/metric v1.34.0 h1:5CeK9ujjbFVL5c1PhLuStg1wxA7vQv7ce1EK0Gyvahk=
 | 
			
		||||
go.opentelemetry.io/otel/sdk/metric v1.34.0/go.mod h1:jQ/r8Ze28zRKoNRdkjCZxfs6YvBTG1+YIqyFVFYec5w=
 | 
			
		||||
go.opentelemetry.io/otel/trace v1.34.0 h1:+ouXS2V8Rd4hp4580a8q23bg0azF2nI8cqLYnC8mh/k=
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,7 +9,7 @@ import (
 | 
			
		|||
	"testing"
 | 
			
		||||
 | 
			
		||||
	"github.com/stretchr/testify/assert"
 | 
			
		||||
	"go.opentelemetry.io/contrib/config"
 | 
			
		||||
	config "go.opentelemetry.io/contrib/config/v0.3.0"
 | 
			
		||||
	"go.uber.org/zap/zapcore"
 | 
			
		||||
 | 
			
		||||
	"go.opentelemetry.io/collector/component"
 | 
			
		||||
| 
						 | 
				
			
			@ -279,7 +279,7 @@ func generateConfig() *Config {
 | 
			
		|||
					Level: configtelemetry.LevelNormal,
 | 
			
		||||
					Readers: []config.MetricReader{
 | 
			
		||||
						{
 | 
			
		||||
							Pull: &config.PullMetricReader{Exporter: config.MetricExporter{
 | 
			
		||||
							Pull: &config.PullMetricReader{Exporter: config.PullMetricExporter{
 | 
			
		||||
								Prometheus: &config.Prometheus{
 | 
			
		||||
									Host: newPtr("localhost"),
 | 
			
		||||
									Port: newPtr(8080),
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,7 +22,7 @@ require (
 | 
			
		|||
	go.opentelemetry.io/collector/receiver v0.118.0
 | 
			
		||||
	go.opentelemetry.io/collector/receiver/receivertest v0.118.0
 | 
			
		||||
	go.opentelemetry.io/collector/service v0.118.0
 | 
			
		||||
	go.opentelemetry.io/contrib/config v0.10.0
 | 
			
		||||
	go.opentelemetry.io/contrib/config v0.14.0
 | 
			
		||||
	go.uber.org/goleak v1.3.0
 | 
			
		||||
	go.uber.org/multierr v1.11.0
 | 
			
		||||
	go.uber.org/zap v1.27.0
 | 
			
		||||
| 
						 | 
				
			
			@ -38,7 +38,6 @@ require (
 | 
			
		|||
	github.com/cespare/xxhash/v2 v2.3.0 // indirect
 | 
			
		||||
	github.com/davecgh/go-spew v1.1.1 // indirect
 | 
			
		||||
	github.com/ebitengine/purego v0.8.1 // indirect
 | 
			
		||||
	github.com/felixge/httpsnoop v1.0.4 // indirect
 | 
			
		||||
	github.com/go-logr/logr v1.4.2 // indirect
 | 
			
		||||
	github.com/go-logr/stdr v1.2.2 // indirect
 | 
			
		||||
	github.com/go-ole/go-ole v1.2.6 // indirect
 | 
			
		||||
| 
						 | 
				
			
			@ -88,24 +87,23 @@ require (
 | 
			
		|||
	go.opentelemetry.io/collector/receiver/xreceiver v0.118.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/collector/semconv v0.118.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/contrib/bridges/otelzap v0.9.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.59.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.59.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/contrib/propagators/b3 v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.7.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.10.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.10.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.31.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.31.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/prometheus v0.56.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.7.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.10.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.31.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/log v0.10.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/metric v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/sdk v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/sdk/log v0.7.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/sdk/log v0.10.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/sdk/metric v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/trace v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/proto/otlp v1.5.0 // indirect
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -113,10 +113,8 @@ go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJyS
 | 
			
		|||
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
 | 
			
		||||
go.opentelemetry.io/contrib/bridges/otelzap v0.9.0 h1:f+xpAfhQTjR8beiSMe1bnT/25PkeyWmOcI+SjXWguNw=
 | 
			
		||||
go.opentelemetry.io/contrib/bridges/otelzap v0.9.0/go.mod h1:T1Z1jyS5FttgQoF6UcGhnM+gF9wU32B4lHO69nXw4FE=
 | 
			
		||||
go.opentelemetry.io/contrib/config v0.10.0 h1:2JknAzMaYjxrHkTnZh3eOme/Y2P5eHE2SWfhfV6Xd6c=
 | 
			
		||||
go.opentelemetry.io/contrib/config v0.10.0/go.mod h1:aND2M6/KfNkntI5cyvHriR/zvZgPf8j9yETdSmvpfmc=
 | 
			
		||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.59.0 h1:rgMkmiGfix9vFJDcDi1PK8WEQP4FLQwLDfhp5ZLpFeE=
 | 
			
		||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.59.0/go.mod h1:ijPqXp5P6IRRByFVVg9DY8P5HkxkHE5ARIa+86aXPf4=
 | 
			
		||||
go.opentelemetry.io/contrib/config v0.14.0 h1:QAG8uHNp5ZiCkpT7XggSmg5AyW1sA0LgypMoXgBB1+4=
 | 
			
		||||
go.opentelemetry.io/contrib/config v0.14.0/go.mod h1:77rDmFPqBae5jtQ2C78RuDTHz4P27C8LzoN0MZyumYQ=
 | 
			
		||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.59.0 h1:CV7UdSGJt/Ao6Gp4CXckLxVRRsRgDHoI8XjbL3PDl8s=
 | 
			
		||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.59.0/go.mod h1:FRmFuRJfag1IZ2dPkHnEoSFVgTVPUd2qf5Vi69hLb8I=
 | 
			
		||||
go.opentelemetry.io/contrib/propagators/b3 v1.34.0 h1:9pQdCEvV/6RWQmag94D6rhU+A4rzUhYBEJ8bpscx5p8=
 | 
			
		||||
| 
						 | 
				
			
			@ -125,34 +123,36 @@ go.opentelemetry.io/contrib/zpages v0.59.0 h1:t0H5zUy8fifIhRuVwm2FrA/D70Kk10SSpA
 | 
			
		|||
go.opentelemetry.io/contrib/zpages v0.59.0/go.mod h1:9wo+yUPvHnBQEzoHJ8R3nA/Q5rkef7HjtLlSFI0Tgrc=
 | 
			
		||||
go.opentelemetry.io/otel v1.34.0 h1:zRLXxLCgL1WyKsPVrgbSdMN4c0FMkDAskSTQP+0hdUY=
 | 
			
		||||
go.opentelemetry.io/otel v1.34.0/go.mod h1:OWFPOQ+h4G8xpyjgqo4SxJYdDQ/qmRH+wivy7zzx9oI=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.7.0 h1:mMOmtYie9Fx6TSVzw4W+NTpvoaS1JWWga37oI1a/4qQ=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.7.0/go.mod h1:yy7nDsMMBUkD+jeekJ36ur5f3jJIrmCwUrY67VFhNpA=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.10.0 h1:5dTKu4I5Dn4P2hxyW3l3jTaZx9ACgg0ECos1eAVrheY=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.10.0/go.mod h1:P5HcUI8obLrCCmM3sbVBohZFH34iszk/+CPWuakZWL8=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.10.0 h1:q/heq5Zh8xV1+7GoMGJpTxM2Lhq5+bFxB29tshuRuw0=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.10.0/go.mod h1:leO2CSTg0Y+LyvmR7Wm4pUxE8KAmaM2GCVx7O+RATLA=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.34.0 h1:ajl4QczuJVA2TU9W9AGw++86Xga/RKt//16z/yxPgdk=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.34.0/go.mod h1:Vn3/rlOJ3ntf/Q3zAI0V5lDnTbHGaUsNUeF6nZmm7pA=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.34.0 h1:opwv08VbCZ8iecIWs+McMdHRcAXzjAeda3uG2kI/hcA=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.34.0/go.mod h1:oOP3ABpW7vFHulLpE8aYtNBodrHhMTrvfxUXGvqm7Ac=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0 h1:K0XaT3DwHAcV4nKLzcQvwAgSyisUghWoY20I7huthMk=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0/go.mod h1:B5Ki776z/MBnVha1Nzwp5arlzBbE3+1jk+pGmaP5HME=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.31.0 h1:FFeLy03iVTXP6ffeN2iXrxfGsZGCjVx0/4KlizjyBwU=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.31.0/go.mod h1:TMu73/k1CP8nBUpDLc71Wj/Kf7ZS9FK5b53VapRsP9o=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.31.0 h1:lUsI2TYsQw2r1IASwoROaCnjdj2cvC2+Jbxvk6nHnWU=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.31.0/go.mod h1:2HpZxxQurfGxJlJDblybejHB6RX6pmExPNe517hREw4=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.34.0 h1:OeNbIYk/2C15ckl7glBlOBp5+WlYsOElzTNmiPW/x60=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.34.0/go.mod h1:7Bept48yIeqxP2OZ9/AqIpYS94h2or0aB4FypJTc8ZM=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.34.0 h1:tgJ0uaNS4c98WRNUEx5U3aDlrDOI5Rs+1Vifcw4DJ8U=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.34.0/go.mod h1:U7HYyW0zt/a9x5J1Kjs+r1f/d4ZHnYFclhYY2+YbeoE=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.34.0 h1:BEj3SPM81McUZHYjRS5pEgNgnmzGJ5tRpU5krWnV8Bs=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.34.0/go.mod h1:9cKLGBDzI/F3NoHLQGm4ZrYdIHsvGt6ej6hUowxY0J4=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/prometheus v0.56.0 h1:GnCIi0QyG0yy2MrJLzVrIM7laaJstj//flf1zEJCG+E=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/prometheus v0.56.0/go.mod h1:JQcVZtbIIPM+7SWBB+T6FK+xunlyidwLp++fN0sUaOk=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.7.0 h1:TwmL3O3fRR80m8EshBrd8YydEZMcUCsZXzOUlnFohwM=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.7.0/go.mod h1:tH98dDv5KPmPThswbXA0fr0Lwfs+OhK8HgaCo7PjRrk=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.10.0 h1:GKCEAZLEpEf78cUvudQdTg0aET2ObOZRB2HtXA0qPAI=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.10.0/go.mod h1:9/zqSWLCmHT/9Jo6fYeUDRRogOLL60ABLsHWS99lF8s=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.34.0 h1:czJDQwFrMbOr9Kk+BPo1y8WZIIFIK58SA1kykuVeiOU=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.34.0/go.mod h1:lT7bmsxOe58Tq+JIOkTQMCGXdu47oA+VJKLZHbaBKbs=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.31.0 h1:UGZ1QwZWY67Z6BmckTU+9Rxn04m2bD3gD6Mk0OIOCPk=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.31.0/go.mod h1:fcwWuDuaObkkChiDlhEpSq9+X1C0omv+s5mBtToAQ64=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.34.0 h1:jBpDk4HAUsrnVO1FsfCfCOTEc/MkInJmvfCHYLFiT80=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.34.0/go.mod h1:H9LUIM1daaeZaz91vZcfeM0fejXPmgCYE8ZhzqfJuiU=
 | 
			
		||||
go.opentelemetry.io/otel/log v0.10.0 h1:1CXmspaRITvFcjA4kyVszuG4HjA61fPDxMb7q3BuyF0=
 | 
			
		||||
go.opentelemetry.io/otel/log v0.10.0/go.mod h1:PbVdm9bXKku/gL0oFfUF4wwsQsOPlpo4VEqjvxih+FM=
 | 
			
		||||
go.opentelemetry.io/otel/metric v1.34.0 h1:+eTR3U0MyfWjRDhmFMxe2SsW64QrZ84AOhvqS7Y+PoQ=
 | 
			
		||||
go.opentelemetry.io/otel/metric v1.34.0/go.mod h1:CEDrp0fy2D0MvkXE+dPV7cMi8tWZwX3dmaIhwPOaqHE=
 | 
			
		||||
go.opentelemetry.io/otel/sdk v1.34.0 h1:95zS4k/2GOy069d321O8jWgYsW3MzVV+KuSPKp7Wr1A=
 | 
			
		||||
go.opentelemetry.io/otel/sdk v1.34.0/go.mod h1:0e/pNiaMAqaykJGKbi+tSjWfNNHMTxoC9qANsCzbyxU=
 | 
			
		||||
go.opentelemetry.io/otel/sdk/log v0.7.0 h1:dXkeI2S0MLc5g0/AwxTZv6EUEjctiH8aG14Am56NTmQ=
 | 
			
		||||
go.opentelemetry.io/otel/sdk/log v0.7.0/go.mod h1:oIRXpW+WD6M8BuGj5rtS0aRu/86cbDV/dAfNaZBIjYM=
 | 
			
		||||
go.opentelemetry.io/otel/sdk/log v0.10.0 h1:lR4teQGWfeDVGoute6l0Ou+RpFqQ9vaPdrNJlST0bvw=
 | 
			
		||||
go.opentelemetry.io/otel/sdk/log v0.10.0/go.mod h1:A+V1UTWREhWAittaQEG4bYm4gAZa6xnvVu+xKrIRkzo=
 | 
			
		||||
go.opentelemetry.io/otel/sdk/metric v1.34.0 h1:5CeK9ujjbFVL5c1PhLuStg1wxA7vQv7ce1EK0Gyvahk=
 | 
			
		||||
go.opentelemetry.io/otel/sdk/metric v1.34.0/go.mod h1:jQ/r8Ze28zRKoNRdkjCZxfs6YvBTG1+YIqyFVFYec5w=
 | 
			
		||||
go.opentelemetry.io/otel/trace v1.34.0 h1:+ouXS2V8Rd4hp4580a8q23bg0azF2nI8cqLYnC8mh/k=
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -32,7 +32,6 @@ require (
 | 
			
		|||
	github.com/cespare/xxhash/v2 v2.3.0 // indirect
 | 
			
		||||
	github.com/davecgh/go-spew v1.1.1 // indirect
 | 
			
		||||
	github.com/ebitengine/purego v0.8.1 // indirect
 | 
			
		||||
	github.com/felixge/httpsnoop v1.0.4 // indirect
 | 
			
		||||
	github.com/go-logr/logr v1.4.2 // indirect
 | 
			
		||||
	github.com/go-logr/stdr v1.2.2 // indirect
 | 
			
		||||
	github.com/go-ole/go-ole v1.2.6 // indirect
 | 
			
		||||
| 
						 | 
				
			
			@ -86,25 +85,24 @@ require (
 | 
			
		|||
	go.opentelemetry.io/collector/receiver/xreceiver v0.118.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/collector/semconv v0.118.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/contrib/bridges/otelzap v0.9.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/contrib/config v0.10.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.59.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.59.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/contrib/config v0.14.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/contrib/propagators/b3 v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.7.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.10.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.10.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.31.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.31.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/prometheus v0.56.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.7.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.10.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.31.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/log v0.10.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/metric v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/sdk v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/sdk/log v0.7.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/sdk/log v0.10.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/sdk/metric v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/trace v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/proto/otlp v1.5.0 // indirect
 | 
			
		||||
| 
						 | 
				
			
			@ -138,12 +136,6 @@ replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/con
 | 
			
		|||
 | 
			
		||||
replace go.opentelemetry.io/collector/processor => ../../processor
 | 
			
		||||
 | 
			
		||||
replace go.opentelemetry.io/collector/processor/processortest => ../../processor/processortest
 | 
			
		||||
 | 
			
		||||
replace go.opentelemetry.io/collector/confmap => ../../confmap
 | 
			
		||||
 | 
			
		||||
replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata
 | 
			
		||||
 | 
			
		||||
replace go.opentelemetry.io/collector/pdata => ../../pdata
 | 
			
		||||
 | 
			
		||||
replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile
 | 
			
		||||
| 
						 | 
				
			
			@ -221,3 +213,9 @@ replace go.opentelemetry.io/collector/extension/extensiontest => ../../extension
 | 
			
		|||
replace go.opentelemetry.io/collector/extension/auth/authtest => ../../extension/auth/authtest
 | 
			
		||||
 | 
			
		||||
replace go.opentelemetry.io/collector/extension/xextension => ../../extension/xextension
 | 
			
		||||
 | 
			
		||||
replace go.opentelemetry.io/collector/confmap => ../../confmap
 | 
			
		||||
 | 
			
		||||
replace go.opentelemetry.io/collector/processor/processortest => ../../processor/processortest
 | 
			
		||||
 | 
			
		||||
replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -113,10 +113,8 @@ go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJyS
 | 
			
		|||
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
 | 
			
		||||
go.opentelemetry.io/contrib/bridges/otelzap v0.9.0 h1:f+xpAfhQTjR8beiSMe1bnT/25PkeyWmOcI+SjXWguNw=
 | 
			
		||||
go.opentelemetry.io/contrib/bridges/otelzap v0.9.0/go.mod h1:T1Z1jyS5FttgQoF6UcGhnM+gF9wU32B4lHO69nXw4FE=
 | 
			
		||||
go.opentelemetry.io/contrib/config v0.10.0 h1:2JknAzMaYjxrHkTnZh3eOme/Y2P5eHE2SWfhfV6Xd6c=
 | 
			
		||||
go.opentelemetry.io/contrib/config v0.10.0/go.mod h1:aND2M6/KfNkntI5cyvHriR/zvZgPf8j9yETdSmvpfmc=
 | 
			
		||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.59.0 h1:rgMkmiGfix9vFJDcDi1PK8WEQP4FLQwLDfhp5ZLpFeE=
 | 
			
		||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.59.0/go.mod h1:ijPqXp5P6IRRByFVVg9DY8P5HkxkHE5ARIa+86aXPf4=
 | 
			
		||||
go.opentelemetry.io/contrib/config v0.14.0 h1:QAG8uHNp5ZiCkpT7XggSmg5AyW1sA0LgypMoXgBB1+4=
 | 
			
		||||
go.opentelemetry.io/contrib/config v0.14.0/go.mod h1:77rDmFPqBae5jtQ2C78RuDTHz4P27C8LzoN0MZyumYQ=
 | 
			
		||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.59.0 h1:CV7UdSGJt/Ao6Gp4CXckLxVRRsRgDHoI8XjbL3PDl8s=
 | 
			
		||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.59.0/go.mod h1:FRmFuRJfag1IZ2dPkHnEoSFVgTVPUd2qf5Vi69hLb8I=
 | 
			
		||||
go.opentelemetry.io/contrib/propagators/b3 v1.34.0 h1:9pQdCEvV/6RWQmag94D6rhU+A4rzUhYBEJ8bpscx5p8=
 | 
			
		||||
| 
						 | 
				
			
			@ -125,34 +123,36 @@ go.opentelemetry.io/contrib/zpages v0.59.0 h1:t0H5zUy8fifIhRuVwm2FrA/D70Kk10SSpA
 | 
			
		|||
go.opentelemetry.io/contrib/zpages v0.59.0/go.mod h1:9wo+yUPvHnBQEzoHJ8R3nA/Q5rkef7HjtLlSFI0Tgrc=
 | 
			
		||||
go.opentelemetry.io/otel v1.34.0 h1:zRLXxLCgL1WyKsPVrgbSdMN4c0FMkDAskSTQP+0hdUY=
 | 
			
		||||
go.opentelemetry.io/otel v1.34.0/go.mod h1:OWFPOQ+h4G8xpyjgqo4SxJYdDQ/qmRH+wivy7zzx9oI=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.7.0 h1:mMOmtYie9Fx6TSVzw4W+NTpvoaS1JWWga37oI1a/4qQ=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.7.0/go.mod h1:yy7nDsMMBUkD+jeekJ36ur5f3jJIrmCwUrY67VFhNpA=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.10.0 h1:5dTKu4I5Dn4P2hxyW3l3jTaZx9ACgg0ECos1eAVrheY=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.10.0/go.mod h1:P5HcUI8obLrCCmM3sbVBohZFH34iszk/+CPWuakZWL8=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.10.0 h1:q/heq5Zh8xV1+7GoMGJpTxM2Lhq5+bFxB29tshuRuw0=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.10.0/go.mod h1:leO2CSTg0Y+LyvmR7Wm4pUxE8KAmaM2GCVx7O+RATLA=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.34.0 h1:ajl4QczuJVA2TU9W9AGw++86Xga/RKt//16z/yxPgdk=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.34.0/go.mod h1:Vn3/rlOJ3ntf/Q3zAI0V5lDnTbHGaUsNUeF6nZmm7pA=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.34.0 h1:opwv08VbCZ8iecIWs+McMdHRcAXzjAeda3uG2kI/hcA=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.34.0/go.mod h1:oOP3ABpW7vFHulLpE8aYtNBodrHhMTrvfxUXGvqm7Ac=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0 h1:K0XaT3DwHAcV4nKLzcQvwAgSyisUghWoY20I7huthMk=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0/go.mod h1:B5Ki776z/MBnVha1Nzwp5arlzBbE3+1jk+pGmaP5HME=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.31.0 h1:FFeLy03iVTXP6ffeN2iXrxfGsZGCjVx0/4KlizjyBwU=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.31.0/go.mod h1:TMu73/k1CP8nBUpDLc71Wj/Kf7ZS9FK5b53VapRsP9o=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.31.0 h1:lUsI2TYsQw2r1IASwoROaCnjdj2cvC2+Jbxvk6nHnWU=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.31.0/go.mod h1:2HpZxxQurfGxJlJDblybejHB6RX6pmExPNe517hREw4=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.34.0 h1:OeNbIYk/2C15ckl7glBlOBp5+WlYsOElzTNmiPW/x60=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.34.0/go.mod h1:7Bept48yIeqxP2OZ9/AqIpYS94h2or0aB4FypJTc8ZM=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.34.0 h1:tgJ0uaNS4c98WRNUEx5U3aDlrDOI5Rs+1Vifcw4DJ8U=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.34.0/go.mod h1:U7HYyW0zt/a9x5J1Kjs+r1f/d4ZHnYFclhYY2+YbeoE=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.34.0 h1:BEj3SPM81McUZHYjRS5pEgNgnmzGJ5tRpU5krWnV8Bs=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.34.0/go.mod h1:9cKLGBDzI/F3NoHLQGm4ZrYdIHsvGt6ej6hUowxY0J4=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/prometheus v0.56.0 h1:GnCIi0QyG0yy2MrJLzVrIM7laaJstj//flf1zEJCG+E=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/prometheus v0.56.0/go.mod h1:JQcVZtbIIPM+7SWBB+T6FK+xunlyidwLp++fN0sUaOk=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.7.0 h1:TwmL3O3fRR80m8EshBrd8YydEZMcUCsZXzOUlnFohwM=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.7.0/go.mod h1:tH98dDv5KPmPThswbXA0fr0Lwfs+OhK8HgaCo7PjRrk=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.10.0 h1:GKCEAZLEpEf78cUvudQdTg0aET2ObOZRB2HtXA0qPAI=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.10.0/go.mod h1:9/zqSWLCmHT/9Jo6fYeUDRRogOLL60ABLsHWS99lF8s=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.34.0 h1:czJDQwFrMbOr9Kk+BPo1y8WZIIFIK58SA1kykuVeiOU=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.34.0/go.mod h1:lT7bmsxOe58Tq+JIOkTQMCGXdu47oA+VJKLZHbaBKbs=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.31.0 h1:UGZ1QwZWY67Z6BmckTU+9Rxn04m2bD3gD6Mk0OIOCPk=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.31.0/go.mod h1:fcwWuDuaObkkChiDlhEpSq9+X1C0omv+s5mBtToAQ64=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.34.0 h1:jBpDk4HAUsrnVO1FsfCfCOTEc/MkInJmvfCHYLFiT80=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.34.0/go.mod h1:H9LUIM1daaeZaz91vZcfeM0fejXPmgCYE8ZhzqfJuiU=
 | 
			
		||||
go.opentelemetry.io/otel/log v0.10.0 h1:1CXmspaRITvFcjA4kyVszuG4HjA61fPDxMb7q3BuyF0=
 | 
			
		||||
go.opentelemetry.io/otel/log v0.10.0/go.mod h1:PbVdm9bXKku/gL0oFfUF4wwsQsOPlpo4VEqjvxih+FM=
 | 
			
		||||
go.opentelemetry.io/otel/metric v1.34.0 h1:+eTR3U0MyfWjRDhmFMxe2SsW64QrZ84AOhvqS7Y+PoQ=
 | 
			
		||||
go.opentelemetry.io/otel/metric v1.34.0/go.mod h1:CEDrp0fy2D0MvkXE+dPV7cMi8tWZwX3dmaIhwPOaqHE=
 | 
			
		||||
go.opentelemetry.io/otel/sdk v1.34.0 h1:95zS4k/2GOy069d321O8jWgYsW3MzVV+KuSPKp7Wr1A=
 | 
			
		||||
go.opentelemetry.io/otel/sdk v1.34.0/go.mod h1:0e/pNiaMAqaykJGKbi+tSjWfNNHMTxoC9qANsCzbyxU=
 | 
			
		||||
go.opentelemetry.io/otel/sdk/log v0.7.0 h1:dXkeI2S0MLc5g0/AwxTZv6EUEjctiH8aG14Am56NTmQ=
 | 
			
		||||
go.opentelemetry.io/otel/sdk/log v0.7.0/go.mod h1:oIRXpW+WD6M8BuGj5rtS0aRu/86cbDV/dAfNaZBIjYM=
 | 
			
		||||
go.opentelemetry.io/otel/sdk/log v0.10.0 h1:lR4teQGWfeDVGoute6l0Ou+RpFqQ9vaPdrNJlST0bvw=
 | 
			
		||||
go.opentelemetry.io/otel/sdk/log v0.10.0/go.mod h1:A+V1UTWREhWAittaQEG4bYm4gAZa6xnvVu+xKrIRkzo=
 | 
			
		||||
go.opentelemetry.io/otel/sdk/metric v1.34.0 h1:5CeK9ujjbFVL5c1PhLuStg1wxA7vQv7ce1EK0Gyvahk=
 | 
			
		||||
go.opentelemetry.io/otel/sdk/metric v1.34.0/go.mod h1:jQ/r8Ze28zRKoNRdkjCZxfs6YvBTG1+YIqyFVFYec5w=
 | 
			
		||||
go.opentelemetry.io/otel/trace v1.34.0 h1:+ouXS2V8Rd4hp4580a8q23bg0azF2nI8cqLYnC8mh/k=
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -157,7 +157,7 @@ func TestServiceUnmarshalError(t *testing.T) {
 | 
			
		|||
					},
 | 
			
		||||
				},
 | 
			
		||||
			}),
 | 
			
		||||
			expectError: "error decoding 'telemetry': decoding failed due to the following error(s):\n\nerror decoding 'logs.level': unrecognized level: \"UNKNOWN\"",
 | 
			
		||||
			expectError: "error decoding 'telemetry': decoding failed due to the following error(s):\n\nerror decoding 'logs': decoding failed due to the following error(s):\n\nerror decoding 'level': unrecognized level: \"UNKNOWN\"",
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "invalid-metrics-level",
 | 
			
		||||
| 
						 | 
				
			
			@ -168,7 +168,7 @@ func TestServiceUnmarshalError(t *testing.T) {
 | 
			
		|||
					},
 | 
			
		||||
				},
 | 
			
		||||
			}),
 | 
			
		||||
			expectError: "error decoding 'telemetry': decoding failed due to the following error(s):\n\nerror decoding 'metrics.level': unknown metrics level \"unknown\"",
 | 
			
		||||
			expectError: "error decoding 'telemetry': decoding failed due to the following error(s):\n\nerror decoding 'metrics': decoding failed due to the following error(s):\n\nerror decoding 'level': unknown metrics level \"unknown\"",
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "invalid-service-extensions-section",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,24 +4,31 @@
 | 
			
		|||
package service // import "go.opentelemetry.io/collector/service"
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	config "go.opentelemetry.io/contrib/config/v0.3.0"
 | 
			
		||||
	sdkresource "go.opentelemetry.io/otel/sdk/resource"
 | 
			
		||||
 | 
			
		||||
	"go.opentelemetry.io/collector/service/telemetry"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func attributes(res *sdkresource.Resource, cfg telemetry.Config) map[string]any {
 | 
			
		||||
	attrs := map[string]any{}
 | 
			
		||||
func attributes(res *sdkresource.Resource, cfg telemetry.Config) []config.AttributeNameValue {
 | 
			
		||||
	attrsMap := map[string]any{}
 | 
			
		||||
	for _, r := range res.Attributes() {
 | 
			
		||||
		attrs[string(r.Key)] = r.Value.AsString()
 | 
			
		||||
		attrsMap[string(r.Key)] = r.Value.AsString()
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for k, v := range cfg.Resource {
 | 
			
		||||
		if v != nil {
 | 
			
		||||
			attrs[k] = *v
 | 
			
		||||
			attrsMap[k] = *v
 | 
			
		||||
		} else {
 | 
			
		||||
			// the new value is nil, delete the existing key
 | 
			
		||||
			delete(attrs, k)
 | 
			
		||||
			delete(attrsMap, k)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	var attrs []config.AttributeNameValue
 | 
			
		||||
	for k, v := range attrsMap {
 | 
			
		||||
		attrs = append(attrs, config.AttributeNameValue{Name: k, Value: v})
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return attrs
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,6 +7,7 @@ import (
 | 
			
		|||
	"testing"
 | 
			
		||||
 | 
			
		||||
	"github.com/stretchr/testify/require"
 | 
			
		||||
	config "go.opentelemetry.io/contrib/config/v0.3.0"
 | 
			
		||||
 | 
			
		||||
	"go.opentelemetry.io/collector/component"
 | 
			
		||||
	"go.opentelemetry.io/collector/service/internal/resource"
 | 
			
		||||
| 
						 | 
				
			
			@ -18,46 +19,50 @@ func TestAttributes(t *testing.T) {
 | 
			
		|||
		name           string
 | 
			
		||||
		cfg            telemetry.Config
 | 
			
		||||
		buildInfo      component.BuildInfo
 | 
			
		||||
		wantAttributes map[string]any
 | 
			
		||||
		wantAttributes []config.AttributeNameValue
 | 
			
		||||
	}{
 | 
			
		||||
		{
 | 
			
		||||
			name:           "no build info and no resource config",
 | 
			
		||||
			cfg:            telemetry.Config{},
 | 
			
		||||
			wantAttributes: map[string]any{"service.name": "", "service.version": "", "service.instance.id": ""},
 | 
			
		||||
			wantAttributes: []config.AttributeNameValue{{Name: "service.name", Value: ""}, {Name: "service.version", Value: ""}, {Name: "service.instance.id", Value: ""}},
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name:           "build info and no resource config",
 | 
			
		||||
			cfg:            telemetry.Config{},
 | 
			
		||||
			buildInfo:      component.BuildInfo{Command: "otelcoltest", Version: "0.0.0-test"},
 | 
			
		||||
			wantAttributes: map[string]any{"service.name": "otelcoltest", "service.version": "0.0.0-test", "service.instance.id": ""},
 | 
			
		||||
			wantAttributes: []config.AttributeNameValue{{Name: "service.name", Value: "otelcoltest"}, {Name: "service.version", Value: "0.0.0-test"}, {Name: "service.instance.id", Value: ""}},
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name:           "no build info and resource config",
 | 
			
		||||
			cfg:            telemetry.Config{Resource: map[string]*string{"service.name": newPtr("resource.name"), "service.version": newPtr("resource.version"), "test": newPtr("test")}},
 | 
			
		||||
			wantAttributes: map[string]any{"service.name": "resource.name", "service.version": "resource.version", "test": "test", "service.instance.id": ""},
 | 
			
		||||
			cfg:            telemetry.Config{Resource: map[string]*string{"service.name": ptr("resource.name"), "service.version": ptr("resource.version"), "test": ptr("test")}},
 | 
			
		||||
			wantAttributes: []config.AttributeNameValue{{Name: "service.name", Value: "resource.name"}, {Name: "service.version", Value: "resource.version"}, {Name: "test", Value: "test"}, {Name: "service.instance.id", Value: ""}},
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name:           "build info and resource config",
 | 
			
		||||
			buildInfo:      component.BuildInfo{Command: "otelcoltest", Version: "0.0.0-test"},
 | 
			
		||||
			cfg:            telemetry.Config{Resource: map[string]*string{"service.name": newPtr("resource.name"), "service.version": newPtr("resource.version"), "test": newPtr("test")}},
 | 
			
		||||
			wantAttributes: map[string]any{"service.name": "resource.name", "service.version": "resource.version", "test": "test", "service.instance.id": ""},
 | 
			
		||||
			cfg:            telemetry.Config{Resource: map[string]*string{"service.name": ptr("resource.name"), "service.version": ptr("resource.version"), "test": ptr("test")}},
 | 
			
		||||
			wantAttributes: []config.AttributeNameValue{{Name: "service.name", Value: "resource.name"}, {Name: "service.version", Value: "resource.version"}, {Name: "test", Value: "test"}, {Name: "service.instance.id", Value: ""}},
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name:           "deleting a nil value",
 | 
			
		||||
			buildInfo:      component.BuildInfo{Command: "otelcoltest", Version: "0.0.0-test"},
 | 
			
		||||
			cfg:            telemetry.Config{Resource: map[string]*string{"service.name": nil, "service.version": newPtr("resource.version"), "test": newPtr("test")}},
 | 
			
		||||
			wantAttributes: map[string]any{"service.version": "resource.version", "test": "test", "service.instance.id": ""},
 | 
			
		||||
			cfg:            telemetry.Config{Resource: map[string]*string{"service.name": nil, "service.version": ptr("resource.version"), "test": ptr("test")}},
 | 
			
		||||
			wantAttributes: []config.AttributeNameValue{{Name: "service.version", Value: "resource.version"}, {Name: "test", Value: "test"}, {Name: "service.instance.id", Value: ""}},
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
	for _, tt := range tests {
 | 
			
		||||
		t.Run(tt.name, func(t *testing.T) {
 | 
			
		||||
			attrs := attributes(resource.New(tt.buildInfo, tt.cfg.Resource), tt.cfg)
 | 
			
		||||
			require.Len(t, attrs, len(tt.wantAttributes))
 | 
			
		||||
			for k, v := range tt.wantAttributes {
 | 
			
		||||
				if k == "service.instance.id" {
 | 
			
		||||
					require.NotNil(t, attrs[k])
 | 
			
		||||
			gotMap := map[string]any{}
 | 
			
		||||
			for _, v := range attrs {
 | 
			
		||||
				gotMap[v.Name] = v.Value
 | 
			
		||||
			}
 | 
			
		||||
			for _, v := range tt.wantAttributes {
 | 
			
		||||
				if v.Name == "service.instance.id" {
 | 
			
		||||
					require.NotNil(t, gotMap[v.Name])
 | 
			
		||||
				} else {
 | 
			
		||||
					require.Equal(t, v, attrs[k])
 | 
			
		||||
					require.Equal(t, v.Value, gotMap[v.Name])
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		})
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,7 +9,7 @@ import (
 | 
			
		|||
	"testing"
 | 
			
		||||
 | 
			
		||||
	"github.com/stretchr/testify/assert"
 | 
			
		||||
	"go.opentelemetry.io/contrib/config"
 | 
			
		||||
	config "go.opentelemetry.io/contrib/config/v0.3.0"
 | 
			
		||||
	"go.uber.org/zap/zapcore"
 | 
			
		||||
 | 
			
		||||
	"go.opentelemetry.io/collector/component"
 | 
			
		||||
| 
						 | 
				
			
			@ -100,7 +100,7 @@ func generateConfig() *Config {
 | 
			
		|||
				Level: configtelemetry.LevelNormal,
 | 
			
		||||
				Readers: []config.MetricReader{
 | 
			
		||||
					{
 | 
			
		||||
						Pull: &config.PullMetricReader{Exporter: config.MetricExporter{Prometheus: &config.Prometheus{
 | 
			
		||||
						Pull: &config.PullMetricReader{Exporter: config.PullMetricExporter{Prometheus: &config.Prometheus{
 | 
			
		||||
							Host: newPtr("localhost"),
 | 
			
		||||
							Port: newPtr(8080),
 | 
			
		||||
						}}},
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,7 +4,6 @@ go 1.22.0
 | 
			
		|||
 | 
			
		||||
require (
 | 
			
		||||
	github.com/google/uuid v1.6.0
 | 
			
		||||
	github.com/prometheus/client_golang v1.20.5
 | 
			
		||||
	github.com/prometheus/client_model v0.6.1
 | 
			
		||||
	github.com/prometheus/common v0.62.0
 | 
			
		||||
	github.com/shirou/gopsutil/v4 v4.24.12
 | 
			
		||||
| 
						 | 
				
			
			@ -44,15 +43,9 @@ require (
 | 
			
		|||
	go.opentelemetry.io/collector/receiver/xreceiver v0.118.0
 | 
			
		||||
	go.opentelemetry.io/collector/semconv v0.118.0
 | 
			
		||||
	go.opentelemetry.io/contrib/bridges/otelzap v0.9.0
 | 
			
		||||
	go.opentelemetry.io/contrib/config v0.10.0
 | 
			
		||||
	go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.59.0
 | 
			
		||||
	go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.59.0
 | 
			
		||||
	go.opentelemetry.io/contrib/config v0.14.0
 | 
			
		||||
	go.opentelemetry.io/contrib/propagators/b3 v1.34.0
 | 
			
		||||
	go.opentelemetry.io/otel v1.34.0
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.34.0
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.34.0
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/prometheus v0.56.0
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.34.0
 | 
			
		||||
	go.opentelemetry.io/otel/log v0.10.0
 | 
			
		||||
	go.opentelemetry.io/otel/metric v1.34.0
 | 
			
		||||
	go.opentelemetry.io/otel/sdk v1.34.0
 | 
			
		||||
| 
						 | 
				
			
			@ -62,7 +55,6 @@ require (
 | 
			
		|||
	go.uber.org/multierr v1.11.0
 | 
			
		||||
	go.uber.org/zap v1.27.0
 | 
			
		||||
	gonum.org/v1/gonum v0.15.1
 | 
			
		||||
	google.golang.org/grpc v1.69.4
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
require (
 | 
			
		||||
| 
						 | 
				
			
			@ -95,6 +87,7 @@ require (
 | 
			
		|||
	github.com/pierrec/lz4/v4 v4.1.22 // indirect
 | 
			
		||||
	github.com/pmezard/go-difflib v1.0.0 // indirect
 | 
			
		||||
	github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
 | 
			
		||||
	github.com/prometheus/client_golang v1.20.5 // indirect
 | 
			
		||||
	github.com/prometheus/procfs v0.15.1 // indirect
 | 
			
		||||
	github.com/rs/cors v1.11.1 // indirect
 | 
			
		||||
	github.com/tklauser/go-sysconf v0.3.12 // indirect
 | 
			
		||||
| 
						 | 
				
			
			@ -108,20 +101,27 @@ require (
 | 
			
		|||
	go.opentelemetry.io/collector/config/configtls v1.24.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/collector/consumer/consumererror v0.118.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/collector/extension/auth v0.118.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.59.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/contrib/zpages v0.59.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.7.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.31.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.31.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.7.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.31.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/sdk/log v0.7.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.10.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.10.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/prometheus v0.56.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.10.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.34.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/otel/sdk/log v0.10.0 // indirect
 | 
			
		||||
	go.opentelemetry.io/proto/otlp v1.5.0 // indirect
 | 
			
		||||
	golang.org/x/net v0.34.0 // indirect
 | 
			
		||||
	golang.org/x/sys v0.29.0 // indirect
 | 
			
		||||
	golang.org/x/text v0.21.0 // indirect
 | 
			
		||||
	google.golang.org/genproto/googleapis/api v0.0.0-20250115164207-1a7da9e5054f // indirect
 | 
			
		||||
	google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f // indirect
 | 
			
		||||
	google.golang.org/grpc v1.69.4 // indirect
 | 
			
		||||
	google.golang.org/protobuf v1.36.3 // indirect
 | 
			
		||||
	gopkg.in/yaml.v3 v3.0.1 // indirect
 | 
			
		||||
)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -105,10 +105,8 @@ go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJyS
 | 
			
		|||
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
 | 
			
		||||
go.opentelemetry.io/contrib/bridges/otelzap v0.9.0 h1:f+xpAfhQTjR8beiSMe1bnT/25PkeyWmOcI+SjXWguNw=
 | 
			
		||||
go.opentelemetry.io/contrib/bridges/otelzap v0.9.0/go.mod h1:T1Z1jyS5FttgQoF6UcGhnM+gF9wU32B4lHO69nXw4FE=
 | 
			
		||||
go.opentelemetry.io/contrib/config v0.10.0 h1:2JknAzMaYjxrHkTnZh3eOme/Y2P5eHE2SWfhfV6Xd6c=
 | 
			
		||||
go.opentelemetry.io/contrib/config v0.10.0/go.mod h1:aND2M6/KfNkntI5cyvHriR/zvZgPf8j9yETdSmvpfmc=
 | 
			
		||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.59.0 h1:rgMkmiGfix9vFJDcDi1PK8WEQP4FLQwLDfhp5ZLpFeE=
 | 
			
		||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.59.0/go.mod h1:ijPqXp5P6IRRByFVVg9DY8P5HkxkHE5ARIa+86aXPf4=
 | 
			
		||||
go.opentelemetry.io/contrib/config v0.14.0 h1:QAG8uHNp5ZiCkpT7XggSmg5AyW1sA0LgypMoXgBB1+4=
 | 
			
		||||
go.opentelemetry.io/contrib/config v0.14.0/go.mod h1:77rDmFPqBae5jtQ2C78RuDTHz4P27C8LzoN0MZyumYQ=
 | 
			
		||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.59.0 h1:CV7UdSGJt/Ao6Gp4CXckLxVRRsRgDHoI8XjbL3PDl8s=
 | 
			
		||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.59.0/go.mod h1:FRmFuRJfag1IZ2dPkHnEoSFVgTVPUd2qf5Vi69hLb8I=
 | 
			
		||||
go.opentelemetry.io/contrib/propagators/b3 v1.34.0 h1:9pQdCEvV/6RWQmag94D6rhU+A4rzUhYBEJ8bpscx5p8=
 | 
			
		||||
| 
						 | 
				
			
			@ -117,34 +115,36 @@ go.opentelemetry.io/contrib/zpages v0.59.0 h1:t0H5zUy8fifIhRuVwm2FrA/D70Kk10SSpA
 | 
			
		|||
go.opentelemetry.io/contrib/zpages v0.59.0/go.mod h1:9wo+yUPvHnBQEzoHJ8R3nA/Q5rkef7HjtLlSFI0Tgrc=
 | 
			
		||||
go.opentelemetry.io/otel v1.34.0 h1:zRLXxLCgL1WyKsPVrgbSdMN4c0FMkDAskSTQP+0hdUY=
 | 
			
		||||
go.opentelemetry.io/otel v1.34.0/go.mod h1:OWFPOQ+h4G8xpyjgqo4SxJYdDQ/qmRH+wivy7zzx9oI=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.7.0 h1:mMOmtYie9Fx6TSVzw4W+NTpvoaS1JWWga37oI1a/4qQ=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.7.0/go.mod h1:yy7nDsMMBUkD+jeekJ36ur5f3jJIrmCwUrY67VFhNpA=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.10.0 h1:5dTKu4I5Dn4P2hxyW3l3jTaZx9ACgg0ECos1eAVrheY=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.10.0/go.mod h1:P5HcUI8obLrCCmM3sbVBohZFH34iszk/+CPWuakZWL8=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.10.0 h1:q/heq5Zh8xV1+7GoMGJpTxM2Lhq5+bFxB29tshuRuw0=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.10.0/go.mod h1:leO2CSTg0Y+LyvmR7Wm4pUxE8KAmaM2GCVx7O+RATLA=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.34.0 h1:ajl4QczuJVA2TU9W9AGw++86Xga/RKt//16z/yxPgdk=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.34.0/go.mod h1:Vn3/rlOJ3ntf/Q3zAI0V5lDnTbHGaUsNUeF6nZmm7pA=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.34.0 h1:opwv08VbCZ8iecIWs+McMdHRcAXzjAeda3uG2kI/hcA=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.34.0/go.mod h1:oOP3ABpW7vFHulLpE8aYtNBodrHhMTrvfxUXGvqm7Ac=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0 h1:K0XaT3DwHAcV4nKLzcQvwAgSyisUghWoY20I7huthMk=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0/go.mod h1:B5Ki776z/MBnVha1Nzwp5arlzBbE3+1jk+pGmaP5HME=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.31.0 h1:FFeLy03iVTXP6ffeN2iXrxfGsZGCjVx0/4KlizjyBwU=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.31.0/go.mod h1:TMu73/k1CP8nBUpDLc71Wj/Kf7ZS9FK5b53VapRsP9o=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.31.0 h1:lUsI2TYsQw2r1IASwoROaCnjdj2cvC2+Jbxvk6nHnWU=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.31.0/go.mod h1:2HpZxxQurfGxJlJDblybejHB6RX6pmExPNe517hREw4=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.34.0 h1:OeNbIYk/2C15ckl7glBlOBp5+WlYsOElzTNmiPW/x60=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.34.0/go.mod h1:7Bept48yIeqxP2OZ9/AqIpYS94h2or0aB4FypJTc8ZM=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.34.0 h1:tgJ0uaNS4c98WRNUEx5U3aDlrDOI5Rs+1Vifcw4DJ8U=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.34.0/go.mod h1:U7HYyW0zt/a9x5J1Kjs+r1f/d4ZHnYFclhYY2+YbeoE=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.34.0 h1:BEj3SPM81McUZHYjRS5pEgNgnmzGJ5tRpU5krWnV8Bs=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.34.0/go.mod h1:9cKLGBDzI/F3NoHLQGm4ZrYdIHsvGt6ej6hUowxY0J4=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/prometheus v0.56.0 h1:GnCIi0QyG0yy2MrJLzVrIM7laaJstj//flf1zEJCG+E=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/prometheus v0.56.0/go.mod h1:JQcVZtbIIPM+7SWBB+T6FK+xunlyidwLp++fN0sUaOk=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.7.0 h1:TwmL3O3fRR80m8EshBrd8YydEZMcUCsZXzOUlnFohwM=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.7.0/go.mod h1:tH98dDv5KPmPThswbXA0fr0Lwfs+OhK8HgaCo7PjRrk=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.10.0 h1:GKCEAZLEpEf78cUvudQdTg0aET2ObOZRB2HtXA0qPAI=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.10.0/go.mod h1:9/zqSWLCmHT/9Jo6fYeUDRRogOLL60ABLsHWS99lF8s=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.34.0 h1:czJDQwFrMbOr9Kk+BPo1y8WZIIFIK58SA1kykuVeiOU=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.34.0/go.mod h1:lT7bmsxOe58Tq+JIOkTQMCGXdu47oA+VJKLZHbaBKbs=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.31.0 h1:UGZ1QwZWY67Z6BmckTU+9Rxn04m2bD3gD6Mk0OIOCPk=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.31.0/go.mod h1:fcwWuDuaObkkChiDlhEpSq9+X1C0omv+s5mBtToAQ64=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.34.0 h1:jBpDk4HAUsrnVO1FsfCfCOTEc/MkInJmvfCHYLFiT80=
 | 
			
		||||
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.34.0/go.mod h1:H9LUIM1daaeZaz91vZcfeM0fejXPmgCYE8ZhzqfJuiU=
 | 
			
		||||
go.opentelemetry.io/otel/log v0.10.0 h1:1CXmspaRITvFcjA4kyVszuG4HjA61fPDxMb7q3BuyF0=
 | 
			
		||||
go.opentelemetry.io/otel/log v0.10.0/go.mod h1:PbVdm9bXKku/gL0oFfUF4wwsQsOPlpo4VEqjvxih+FM=
 | 
			
		||||
go.opentelemetry.io/otel/metric v1.34.0 h1:+eTR3U0MyfWjRDhmFMxe2SsW64QrZ84AOhvqS7Y+PoQ=
 | 
			
		||||
go.opentelemetry.io/otel/metric v1.34.0/go.mod h1:CEDrp0fy2D0MvkXE+dPV7cMi8tWZwX3dmaIhwPOaqHE=
 | 
			
		||||
go.opentelemetry.io/otel/sdk v1.34.0 h1:95zS4k/2GOy069d321O8jWgYsW3MzVV+KuSPKp7Wr1A=
 | 
			
		||||
go.opentelemetry.io/otel/sdk v1.34.0/go.mod h1:0e/pNiaMAqaykJGKbi+tSjWfNNHMTxoC9qANsCzbyxU=
 | 
			
		||||
go.opentelemetry.io/otel/sdk/log v0.7.0 h1:dXkeI2S0MLc5g0/AwxTZv6EUEjctiH8aG14Am56NTmQ=
 | 
			
		||||
go.opentelemetry.io/otel/sdk/log v0.7.0/go.mod h1:oIRXpW+WD6M8BuGj5rtS0aRu/86cbDV/dAfNaZBIjYM=
 | 
			
		||||
go.opentelemetry.io/otel/sdk/log v0.10.0 h1:lR4teQGWfeDVGoute6l0Ou+RpFqQ9vaPdrNJlST0bvw=
 | 
			
		||||
go.opentelemetry.io/otel/sdk/log v0.10.0/go.mod h1:A+V1UTWREhWAittaQEG4bYm4gAZa6xnvVu+xKrIRkzo=
 | 
			
		||||
go.opentelemetry.io/otel/sdk/metric v1.34.0 h1:5CeK9ujjbFVL5c1PhLuStg1wxA7vQv7ce1EK0Gyvahk=
 | 
			
		||||
go.opentelemetry.io/otel/sdk/metric v1.34.0/go.mod h1:jQ/r8Ze28zRKoNRdkjCZxfs6YvBTG1+YIqyFVFYec5w=
 | 
			
		||||
go.opentelemetry.io/otel/trace v1.34.0 h1:+ouXS2V8Rd4hp4580a8q23bg0azF2nI8cqLYnC8mh/k=
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,7 +8,7 @@ import (
 | 
			
		|||
	"strconv"
 | 
			
		||||
	"testing"
 | 
			
		||||
 | 
			
		||||
	"go.opentelemetry.io/contrib/config"
 | 
			
		||||
	config "go.opentelemetry.io/contrib/config/v0.3.0"
 | 
			
		||||
 | 
			
		||||
	"go.opentelemetry.io/collector/internal/testutil"
 | 
			
		||||
)
 | 
			
		||||
| 
						 | 
				
			
			@ -23,6 +23,9 @@ func GetAvailableLocalAddressPrometheus(tb testing.TB) *config.Prometheus {
 | 
			
		|||
 | 
			
		||||
func addrToPrometheus(address string) *config.Prometheus {
 | 
			
		||||
	host, port, err := net.SplitHostPort(address)
 | 
			
		||||
	if host == "::1" {
 | 
			
		||||
		host = "[::1]"
 | 
			
		||||
	}
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -33,5 +36,15 @@ func addrToPrometheus(address string) *config.Prometheus {
 | 
			
		|||
	return &config.Prometheus{
 | 
			
		||||
		Host:              &host,
 | 
			
		||||
		Port:              &portInt,
 | 
			
		||||
		WithoutScopeInfo:  ptr(true),
 | 
			
		||||
		WithoutUnits:      ptr(true),
 | 
			
		||||
		WithoutTypeSuffix: ptr(true),
 | 
			
		||||
		WithResourceConstantLabels: &config.IncludeExclude{
 | 
			
		||||
			Included: []string{},
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func ptr[T any](v T) *T {
 | 
			
		||||
	return &v
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,7 +11,7 @@ import (
 | 
			
		|||
	"fmt"
 | 
			
		||||
	"runtime"
 | 
			
		||||
 | 
			
		||||
	"go.opentelemetry.io/contrib/config"
 | 
			
		||||
	config "go.opentelemetry.io/contrib/config/v0.3.0"
 | 
			
		||||
	"go.opentelemetry.io/otel/log"
 | 
			
		||||
	"go.opentelemetry.io/otel/metric"
 | 
			
		||||
	sdkresource "go.opentelemetry.io/otel/sdk/resource"
 | 
			
		||||
| 
						 | 
				
			
			@ -28,6 +28,7 @@ import (
 | 
			
		|||
	"go.opentelemetry.io/collector/pdata/pcommon"
 | 
			
		||||
	"go.opentelemetry.io/collector/processor"
 | 
			
		||||
	"go.opentelemetry.io/collector/receiver"
 | 
			
		||||
	semconv118 "go.opentelemetry.io/collector/semconv/v1.18.0"
 | 
			
		||||
	semconv "go.opentelemetry.io/collector/semconv/v1.26.0"
 | 
			
		||||
	"go.opentelemetry.io/collector/service/extensions"
 | 
			
		||||
	"go.opentelemetry.io/collector/service/internal/builders"
 | 
			
		||||
| 
						 | 
				
			
			@ -47,6 +48,14 @@ var _ = featuregate.GlobalRegistry().MustRegister(
 | 
			
		|||
	featuregate.WithRegisterDescription("controls whether the collector supports extended OpenTelemetry"+
 | 
			
		||||
		"configuration for internal telemetry"))
 | 
			
		||||
 | 
			
		||||
// disableHighCardinalityMetricsFeatureGate is the feature gate that controls whether the collector should enable
 | 
			
		||||
// potentially high cardinality metrics. The gate will be removed when the collector allows for view configuration.
 | 
			
		||||
var disableHighCardinalityMetricsFeatureGate = featuregate.GlobalRegistry().MustRegister(
 | 
			
		||||
	"telemetry.disableHighCardinalityMetrics",
 | 
			
		||||
	featuregate.StageAlpha,
 | 
			
		||||
	featuregate.WithRegisterDescription("controls whether the collector should enable potentially high"+
 | 
			
		||||
		"cardinality metrics. The gate will be removed when the collector allows for view configuration."))
 | 
			
		||||
 | 
			
		||||
// Settings holds configuration for building a new Service.
 | 
			
		||||
type Settings struct {
 | 
			
		||||
	// BuildInfo provides collector start information.
 | 
			
		||||
| 
						 | 
				
			
			@ -120,9 +129,12 @@ func New(ctx context.Context, set Settings, cfg Config) (*Service, error) {
 | 
			
		|||
	pcommonRes := pdataFromSdk(res)
 | 
			
		||||
 | 
			
		||||
	sch := semconv.SchemaURL
 | 
			
		||||
	cfgRes := config.Resource{
 | 
			
		||||
		SchemaUrl:  &sch,
 | 
			
		||||
		Attributes: attributes(res, cfg.Telemetry),
 | 
			
		||||
 | 
			
		||||
	views := configureViews(cfg.Telemetry.Metrics.Level)
 | 
			
		||||
 | 
			
		||||
	readers := cfg.Telemetry.Metrics.Readers
 | 
			
		||||
	if cfg.Telemetry.Metrics.Level == configtelemetry.LevelNone {
 | 
			
		||||
		readers = []config.MetricReader{}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	sdk, err := config.NewSDK(
 | 
			
		||||
| 
						 | 
				
			
			@ -132,10 +144,17 @@ func New(ctx context.Context, set Settings, cfg Config) (*Service, error) {
 | 
			
		|||
				LoggerProvider: &config.LoggerProvider{
 | 
			
		||||
					Processors: cfg.Telemetry.Logs.Processors,
 | 
			
		||||
				},
 | 
			
		||||
				MeterProvider: &config.MeterProvider{
 | 
			
		||||
					Readers: readers,
 | 
			
		||||
					Views:   views,
 | 
			
		||||
				},
 | 
			
		||||
				TracerProvider: &config.TracerProvider{
 | 
			
		||||
					Processors: cfg.Telemetry.Traces.Processors,
 | 
			
		||||
				},
 | 
			
		||||
				Resource: &cfgRes,
 | 
			
		||||
				Resource: &config.Resource{
 | 
			
		||||
					SchemaUrl:  &sch,
 | 
			
		||||
					Attributes: attributes(res, cfg.Telemetry),
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
		),
 | 
			
		||||
	)
 | 
			
		||||
| 
						 | 
				
			
			@ -152,12 +171,14 @@ func New(ctx context.Context, set Settings, cfg Config) (*Service, error) {
 | 
			
		|||
 | 
			
		||||
	logger, lp, err := telFactory.CreateLogger(ctx, telset, &cfg.Telemetry)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		err = multierr.Append(err, sdk.Shutdown(ctx))
 | 
			
		||||
		return nil, fmt.Errorf("failed to create logger: %w", err)
 | 
			
		||||
	}
 | 
			
		||||
	srv.loggerProvider = lp
 | 
			
		||||
 | 
			
		||||
	tracerProvider, err := telFactory.CreateTracerProvider(ctx, telset, &cfg.Telemetry)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		err = multierr.Append(err, sdk.Shutdown(ctx))
 | 
			
		||||
		return nil, fmt.Errorf("failed to create tracer provider: %w", err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -165,6 +186,7 @@ func New(ctx context.Context, set Settings, cfg Config) (*Service, error) {
 | 
			
		|||
 | 
			
		||||
	mp, err := telFactory.CreateMeterProvider(ctx, telset, &cfg.Telemetry)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		err = multierr.Append(err, sdk.Shutdown(ctx))
 | 
			
		||||
		return nil, fmt.Errorf("failed to create meter provider: %w", err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -208,8 +230,7 @@ func logsAboutMeterProvider(logger *zap.Logger, cfg telemetry.MetricsConfig, mp
 | 
			
		|||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	//nolint:staticcheck
 | 
			
		||||
	if len(cfg.Address) != 0 {
 | 
			
		||||
	if len(cfg.Address) != 0 { // SA1019
 | 
			
		||||
		logger.Warn("service::telemetry::metrics::address is being deprecated in favor of service::telemetry::metrics::readers")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -362,3 +383,136 @@ func pdataFromSdk(res *sdkresource.Resource) pcommon.Resource {
 | 
			
		|||
	}
 | 
			
		||||
	return pcommonRes
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func dropViewOption(selector *config.ViewSelector) config.View {
 | 
			
		||||
	return config.View{
 | 
			
		||||
		Selector: selector,
 | 
			
		||||
		Stream: &config.ViewStream{
 | 
			
		||||
			Aggregation: &config.ViewStreamAggregation{
 | 
			
		||||
				Drop: config.ViewStreamAggregationDrop{},
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func configureViews(level configtelemetry.Level) []config.View {
 | 
			
		||||
	views := []config.View{}
 | 
			
		||||
 | 
			
		||||
	if disableHighCardinalityMetricsFeatureGate.IsEnabled() {
 | 
			
		||||
		views = append(views, []config.View{
 | 
			
		||||
			{
 | 
			
		||||
				Selector: &config.ViewSelector{
 | 
			
		||||
					MeterName: ptr("go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"),
 | 
			
		||||
				},
 | 
			
		||||
				Stream: &config.ViewStream{
 | 
			
		||||
					AttributeKeys: &config.IncludeExclude{
 | 
			
		||||
						Excluded: []string{
 | 
			
		||||
							semconv118.AttributeNetSockPeerAddr,
 | 
			
		||||
							semconv118.AttributeNetSockPeerPort,
 | 
			
		||||
							semconv118.AttributeNetSockPeerName,
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
				Selector: &config.ViewSelector{
 | 
			
		||||
					MeterName: ptr("go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"),
 | 
			
		||||
				},
 | 
			
		||||
				Stream: &config.ViewStream{
 | 
			
		||||
					AttributeKeys: &config.IncludeExclude{
 | 
			
		||||
						Excluded: []string{
 | 
			
		||||
							semconv118.AttributeNetHostName,
 | 
			
		||||
							semconv118.AttributeNetHostPort,
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
		}...)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if level < configtelemetry.LevelDetailed {
 | 
			
		||||
		// Drop all otelhttp and otelgrpc metrics if the level is not detailed.
 | 
			
		||||
		views = append(views,
 | 
			
		||||
			dropViewOption(&config.ViewSelector{
 | 
			
		||||
				MeterName: ptr("go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"),
 | 
			
		||||
			}),
 | 
			
		||||
			dropViewOption(&config.ViewSelector{
 | 
			
		||||
				MeterName: ptr("go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"),
 | 
			
		||||
			}),
 | 
			
		||||
		)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// otel-arrow library metrics
 | 
			
		||||
	// See https://github.com/open-telemetry/otel-arrow/blob/c39257/pkg/otel/arrow_record/consumer.go#L174-L176
 | 
			
		||||
	if level < configtelemetry.LevelNormal {
 | 
			
		||||
		scope := ptr("otel-arrow/pkg/otel/arrow_record")
 | 
			
		||||
		views = append(views,
 | 
			
		||||
			dropViewOption(&config.ViewSelector{
 | 
			
		||||
				MeterName:      scope,
 | 
			
		||||
				InstrumentName: ptr("arrow_batch_records"),
 | 
			
		||||
			}),
 | 
			
		||||
			dropViewOption(&config.ViewSelector{
 | 
			
		||||
				MeterName:      scope,
 | 
			
		||||
				InstrumentName: ptr("arrow_schema_resets"),
 | 
			
		||||
			}),
 | 
			
		||||
			dropViewOption(&config.ViewSelector{
 | 
			
		||||
				MeterName:      scope,
 | 
			
		||||
				InstrumentName: ptr("arrow_memory_inuse"),
 | 
			
		||||
			}),
 | 
			
		||||
		)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// contrib's internal/otelarrow/netstats metrics
 | 
			
		||||
	// See
 | 
			
		||||
	// - https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/a25f05/internal/otelarrow/netstats/netstats.go#L130
 | 
			
		||||
	// - https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/a25f05/internal/otelarrow/netstats/netstats.go#L165
 | 
			
		||||
	if level < configtelemetry.LevelDetailed {
 | 
			
		||||
		scope := ptr("github.com/open-telemetry/opentelemetry-collector-contrib/internal/otelarrow/netstats")
 | 
			
		||||
 | 
			
		||||
		views = append(views,
 | 
			
		||||
			// Compressed size metrics.
 | 
			
		||||
			dropViewOption(&config.ViewSelector{
 | 
			
		||||
				MeterName:      scope,
 | 
			
		||||
				InstrumentName: ptr("otelcol_*_compressed_size"),
 | 
			
		||||
			}),
 | 
			
		||||
			dropViewOption(&config.ViewSelector{
 | 
			
		||||
				MeterName:      scope,
 | 
			
		||||
				InstrumentName: ptr("otelcol_*_compressed_size"),
 | 
			
		||||
			}),
 | 
			
		||||
 | 
			
		||||
			// makeRecvMetrics for exporters.
 | 
			
		||||
			dropViewOption(&config.ViewSelector{
 | 
			
		||||
				MeterName:      scope,
 | 
			
		||||
				InstrumentName: ptr("otelcol_exporter_recv"),
 | 
			
		||||
			}),
 | 
			
		||||
			dropViewOption(&config.ViewSelector{
 | 
			
		||||
				MeterName:      scope,
 | 
			
		||||
				InstrumentName: ptr("otelcol_exporter_recv_wire"),
 | 
			
		||||
			}),
 | 
			
		||||
 | 
			
		||||
			// makeSentMetrics for receivers.
 | 
			
		||||
			dropViewOption(&config.ViewSelector{
 | 
			
		||||
				MeterName:      scope,
 | 
			
		||||
				InstrumentName: ptr("otelcol_receiver_sent"),
 | 
			
		||||
			}),
 | 
			
		||||
			dropViewOption(&config.ViewSelector{
 | 
			
		||||
				MeterName:      scope,
 | 
			
		||||
				InstrumentName: ptr("otelcol_receiver_sent_wire"),
 | 
			
		||||
			}),
 | 
			
		||||
		)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Batch processor metrics
 | 
			
		||||
	if level < configtelemetry.LevelDetailed {
 | 
			
		||||
		scope := ptr("go.opentelemetry.io/collector/processor/batchprocessor")
 | 
			
		||||
		views = append(views, dropViewOption(&config.ViewSelector{
 | 
			
		||||
			MeterName:      scope,
 | 
			
		||||
			InstrumentName: ptr("otelcol_processor_batch_batch_send_size_bytes"),
 | 
			
		||||
		}))
 | 
			
		||||
	}
 | 
			
		||||
	return views
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func ptr[T any](v T) *T {
 | 
			
		||||
	return &v
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,7 +17,7 @@ import (
 | 
			
		|||
	"github.com/prometheus/common/expfmt"
 | 
			
		||||
	"github.com/stretchr/testify/assert"
 | 
			
		||||
	"github.com/stretchr/testify/require"
 | 
			
		||||
	"go.opentelemetry.io/contrib/config"
 | 
			
		||||
	config "go.opentelemetry.io/contrib/config/v0.3.0"
 | 
			
		||||
	"go.uber.org/zap"
 | 
			
		||||
	"go.uber.org/zap/zapcore"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -318,7 +318,7 @@ func testCollectorStartHelperWithReaders(t *testing.T, tc ownMetricsTestCase, ne
 | 
			
		|||
	cfg.Telemetry.Metrics.Readers = []config.MetricReader{
 | 
			
		||||
		{
 | 
			
		||||
			Pull: &config.PullMetricReader{
 | 
			
		||||
				Exporter: config.MetricExporter{
 | 
			
		||||
				Exporter: config.PullMetricExporter{
 | 
			
		||||
					Prometheus: metricsAddr,
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
| 
						 | 
				
			
			@ -497,7 +497,7 @@ func TestServiceInvalidTelemetryConfiguration(t *testing.T) {
 | 
			
		|||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			wantErr: errors.New("unsupported protocol \"\""),
 | 
			
		||||
			wantErr: errors.New("no valid log exporter"),
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
	for _, tt := range tests {
 | 
			
		||||
| 
						 | 
				
			
			@ -556,12 +556,16 @@ func assertMetrics(t *testing.T, metricsAddr string, expectedLabels map[string]l
 | 
			
		|||
		"otelcol_process_runtime_heap_alloc_bytes":       false,
 | 
			
		||||
		"otelcol_process_runtime_total_alloc_bytes":      false,
 | 
			
		||||
		"otelcol_process_uptime":                         false,
 | 
			
		||||
		"promhttp_metric_handler_errors_total":           false,
 | 
			
		||||
	}
 | 
			
		||||
	for metricName, metricFamily := range parsed {
 | 
			
		||||
		if _, ok := expectedMetrics[metricName]; !ok {
 | 
			
		||||
			require.True(t, ok, "unexpected metric: %s", metricName)
 | 
			
		||||
		}
 | 
			
		||||
		expectedMetrics[metricName] = true
 | 
			
		||||
		if metricName == "promhttp_metric_handler_errors_total" {
 | 
			
		||||
			continue
 | 
			
		||||
		}
 | 
			
		||||
		if metricName != "target_info" {
 | 
			
		||||
			// require is used here so test fails with a single message.
 | 
			
		||||
			require.True(
 | 
			
		||||
| 
						 | 
				
			
			@ -691,7 +695,7 @@ func newNopConfigPipelineConfigs(pipelineCfgs pipelines.Config) Config {
 | 
			
		|||
				Level: configtelemetry.LevelBasic,
 | 
			
		||||
				Readers: []config.MetricReader{
 | 
			
		||||
					{
 | 
			
		||||
						Pull: &config.PullMetricReader{Exporter: config.MetricExporter{Prometheus: &config.Prometheus{
 | 
			
		||||
						Pull: &config.PullMetricReader{Exporter: config.PullMetricExporter{Prometheus: &config.Prometheus{
 | 
			
		||||
							Host: newPtr("localhost"),
 | 
			
		||||
							Port: newPtr(8888),
 | 
			
		||||
						}}},
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,14 +8,13 @@ import (
 | 
			
		|||
	"fmt"
 | 
			
		||||
	"net"
 | 
			
		||||
	"strconv"
 | 
			
		||||
	"time"
 | 
			
		||||
 | 
			
		||||
	"go.opentelemetry.io/contrib/config"
 | 
			
		||||
	"go.uber.org/zap/zapcore"
 | 
			
		||||
	config "go.opentelemetry.io/contrib/config/v0.3.0"
 | 
			
		||||
 | 
			
		||||
	"go.opentelemetry.io/collector/config/configtelemetry"
 | 
			
		||||
	"go.opentelemetry.io/collector/confmap"
 | 
			
		||||
	"go.opentelemetry.io/collector/featuregate"
 | 
			
		||||
	"go.opentelemetry.io/collector/service/telemetry/internal/migration"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
var _ confmap.Unmarshaler = (*Config)(nil)
 | 
			
		||||
| 
						 | 
				
			
			@ -43,123 +42,20 @@ type Config struct {
 | 
			
		|||
// LogsConfig defines the configurable settings for service telemetry logs.
 | 
			
		||||
// This MUST be compatible with zap.Config. Cannot use directly zap.Config because
 | 
			
		||||
// the collector uses mapstructure and not yaml tags.
 | 
			
		||||
type LogsConfig struct {
 | 
			
		||||
	// Level is the minimum enabled logging level.
 | 
			
		||||
	// (default = "INFO")
 | 
			
		||||
	Level zapcore.Level `mapstructure:"level"`
 | 
			
		||||
 | 
			
		||||
	// Development puts the logger in development mode, which changes the
 | 
			
		||||
	// behavior of DPanicLevel and takes stacktraces more liberally.
 | 
			
		||||
	// (default = false)
 | 
			
		||||
	Development bool `mapstructure:"development"`
 | 
			
		||||
 | 
			
		||||
	// Encoding sets the logger's encoding.
 | 
			
		||||
	// Example values are "json", "console".
 | 
			
		||||
	Encoding string `mapstructure:"encoding"`
 | 
			
		||||
 | 
			
		||||
	// DisableCaller stops annotating logs with the calling function's file
 | 
			
		||||
	// name and line number. By default, all logs are annotated.
 | 
			
		||||
	// (default = false)
 | 
			
		||||
	DisableCaller bool `mapstructure:"disable_caller"`
 | 
			
		||||
 | 
			
		||||
	// DisableStacktrace completely disables automatic stacktrace capturing. By
 | 
			
		||||
	// default, stacktraces are captured for WarnLevel and above logs in
 | 
			
		||||
	// development and ErrorLevel and above in production.
 | 
			
		||||
	// (default = false)
 | 
			
		||||
	DisableStacktrace bool `mapstructure:"disable_stacktrace"`
 | 
			
		||||
 | 
			
		||||
	// Sampling sets a sampling policy.
 | 
			
		||||
	// Default:
 | 
			
		||||
	// 		sampling:
 | 
			
		||||
	//	   		enabled: true
 | 
			
		||||
	//	   		tick: 10s
 | 
			
		||||
	//	   		initial: 10
 | 
			
		||||
	//	   		thereafter: 100
 | 
			
		||||
	// Sampling can be disabled by setting 'enabled' to false
 | 
			
		||||
	Sampling *LogsSamplingConfig `mapstructure:"sampling"`
 | 
			
		||||
 | 
			
		||||
	// OutputPaths is a list of URLs or file paths to write logging output to.
 | 
			
		||||
	// The URLs could only be with "file" schema or without schema.
 | 
			
		||||
	// The URLs with "file" schema must be an absolute path.
 | 
			
		||||
	// The URLs without schema are treated as local file paths.
 | 
			
		||||
	// "stdout" and "stderr" are interpreted as os.Stdout and os.Stderr.
 | 
			
		||||
	// see details at Open in zap/writer.go.
 | 
			
		||||
	// (default = ["stderr"])
 | 
			
		||||
	OutputPaths []string `mapstructure:"output_paths"`
 | 
			
		||||
 | 
			
		||||
	// ErrorOutputPaths is a list of URLs or file paths to write zap internal logger errors to.
 | 
			
		||||
	// The URLs could only be with "file" schema or without schema.
 | 
			
		||||
	// The URLs with "file" schema must use absolute paths.
 | 
			
		||||
	// The URLs without schema are treated as local file paths.
 | 
			
		||||
	// "stdout" and "stderr" are interpreted as os.Stdout and os.Stderr.
 | 
			
		||||
	// see details at Open in zap/writer.go.
 | 
			
		||||
	//
 | 
			
		||||
	// Note that this setting only affects the zap internal logger errors.
 | 
			
		||||
	// (default = ["stderr"])
 | 
			
		||||
	ErrorOutputPaths []string `mapstructure:"error_output_paths"`
 | 
			
		||||
 | 
			
		||||
	// InitialFields is a collection of fields to add to the root logger.
 | 
			
		||||
	// Example:
 | 
			
		||||
	//
 | 
			
		||||
	// 		initial_fields:
 | 
			
		||||
	//	   		foo: "bar"
 | 
			
		||||
	//
 | 
			
		||||
	// By default, there is no initial field.
 | 
			
		||||
	InitialFields map[string]any `mapstructure:"initial_fields"`
 | 
			
		||||
 | 
			
		||||
	// Processors allow configuration of log record processors to emit logs to
 | 
			
		||||
	// any number of suported backends.
 | 
			
		||||
	Processors []config.LogRecordProcessor `mapstructure:"processors"`
 | 
			
		||||
}
 | 
			
		||||
type LogsConfig = migration.LogsConfigV030
 | 
			
		||||
 | 
			
		||||
// LogsSamplingConfig sets a sampling strategy for the logger. Sampling caps the
 | 
			
		||||
// global CPU and I/O load that logging puts on your process while attempting
 | 
			
		||||
// to preserve a representative subset of your logs.
 | 
			
		||||
type LogsSamplingConfig struct {
 | 
			
		||||
	// Enabled enable sampling logging
 | 
			
		||||
	Enabled bool `mapstructure:"enabled"`
 | 
			
		||||
	// Tick represents the interval in seconds that the logger apply each sampling.
 | 
			
		||||
	Tick time.Duration `mapstructure:"tick"`
 | 
			
		||||
	// Initial represents the first M messages logged each Tick.
 | 
			
		||||
	Initial int `mapstructure:"initial"`
 | 
			
		||||
	// Thereafter represents the sampling rate, every Nth message will be sampled after Initial messages are logged during each Tick.
 | 
			
		||||
	// If Thereafter is zero, the logger will drop all the messages after the Initial each Tick.
 | 
			
		||||
	Thereafter int `mapstructure:"thereafter"`
 | 
			
		||||
}
 | 
			
		||||
type LogsSamplingConfig = migration.LogsSamplingConfig
 | 
			
		||||
 | 
			
		||||
// MetricsConfig exposes the common Telemetry configuration for one component.
 | 
			
		||||
// Experimental: *NOTE* this structure is subject to change or removal in the future.
 | 
			
		||||
type MetricsConfig struct {
 | 
			
		||||
	// Level is the level of telemetry metrics, the possible values are:
 | 
			
		||||
	//  - "none" indicates that no telemetry data should be collected;
 | 
			
		||||
	//  - "basic" is the recommended and covers the basics of the service telemetry.
 | 
			
		||||
	//  - "normal" adds some other indicators on top of basic.
 | 
			
		||||
	//  - "detailed" adds dimensions and views to the previous levels.
 | 
			
		||||
	Level configtelemetry.Level `mapstructure:"level"`
 | 
			
		||||
 | 
			
		||||
	// Deprecated: [v0.111.0] use readers configuration.
 | 
			
		||||
	Address string `mapstructure:"address"`
 | 
			
		||||
 | 
			
		||||
	// Readers allow configuration of metric readers to emit metrics to
 | 
			
		||||
	// any number of supported backends.
 | 
			
		||||
	Readers []config.MetricReader `mapstructure:"readers"`
 | 
			
		||||
}
 | 
			
		||||
type MetricsConfig = migration.MetricsConfigV030
 | 
			
		||||
 | 
			
		||||
// TracesConfig exposes the common Telemetry configuration for collector's internal spans.
 | 
			
		||||
// Experimental: *NOTE* this structure is subject to change or removal in the future.
 | 
			
		||||
type TracesConfig struct {
 | 
			
		||||
	// Level configures whether spans are emitted or not, the possible values are:
 | 
			
		||||
	//  - "none" indicates that no tracing data should be collected;
 | 
			
		||||
	//  - "basic" is the recommended and covers the basics of the service telemetry.
 | 
			
		||||
	Level configtelemetry.Level `mapstructure:"level"`
 | 
			
		||||
	// Propagators is a list of TextMapPropagators from the supported propagators list. Currently,
 | 
			
		||||
	// tracecontext and  b3 are supported. By default, the value is set to empty list and
 | 
			
		||||
	// context propagation is disabled.
 | 
			
		||||
	Propagators []string `mapstructure:"propagators"`
 | 
			
		||||
	// Processors allow configuration of span processors to emit spans to
 | 
			
		||||
	// any number of supported backends.
 | 
			
		||||
	Processors []config.SpanProcessor `mapstructure:"processors"`
 | 
			
		||||
}
 | 
			
		||||
type TracesConfig = migration.TracesConfigV030
 | 
			
		||||
 | 
			
		||||
func (c *Config) Unmarshal(conf *confmap.Conf) error {
 | 
			
		||||
	if err := conf.Unmarshal(c); err != nil {
 | 
			
		||||
| 
						 | 
				
			
			@ -172,14 +68,14 @@ func (c *Config) Unmarshal(conf *confmap.Conf) error {
 | 
			
		|||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if len(c.Metrics.Address) != 0 {
 | 
			
		||||
		host, port, err := net.SplitHostPort(c.Metrics.Address)
 | 
			
		||||
	if len(c.Metrics.Address) != 0 { //nolint:staticcheck // SA1019
 | 
			
		||||
		host, port, err := net.SplitHostPort(c.Metrics.Address) //nolint:staticcheck // SA1019
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return fmt.Errorf("failing to parse metrics address %q: %w", c.Metrics.Address, err)
 | 
			
		||||
			return fmt.Errorf("failing to parse metrics address %q: %w", c.Metrics.Address, err) //nolint:staticcheck // SA1019
 | 
			
		||||
		}
 | 
			
		||||
		portInt, err := strconv.Atoi(port)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return fmt.Errorf("failing to extract the port from the metrics address %q: %w", c.Metrics.Address, err)
 | 
			
		||||
			return fmt.Errorf("failing to extract the port from the metrics address %q: %w", c.Metrics.Address, err) //nolint:staticcheck // SA1019
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// User did not overwrite readers, so we will remove the default configured reader.
 | 
			
		||||
| 
						 | 
				
			
			@ -189,10 +85,16 @@ func (c *Config) Unmarshal(conf *confmap.Conf) error {
 | 
			
		|||
 | 
			
		||||
		c.Metrics.Readers = append(c.Metrics.Readers, config.MetricReader{
 | 
			
		||||
			Pull: &config.PullMetricReader{
 | 
			
		||||
				Exporter: config.MetricExporter{
 | 
			
		||||
				Exporter: config.PullMetricExporter{
 | 
			
		||||
					Prometheus: &config.Prometheus{
 | 
			
		||||
						Host:              &host,
 | 
			
		||||
						Port:              &portInt,
 | 
			
		||||
						WithoutScopeInfo:  newPtr(true),
 | 
			
		||||
						WithoutUnits:      newPtr(true),
 | 
			
		||||
						WithoutTypeSuffix: newPtr(true),
 | 
			
		||||
						WithResourceConstantLabels: &config.IncludeExclude{
 | 
			
		||||
							Included: []string{},
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,7 +9,7 @@ import (
 | 
			
		|||
 | 
			
		||||
	"github.com/stretchr/testify/assert"
 | 
			
		||||
	"github.com/stretchr/testify/require"
 | 
			
		||||
	"go.opentelemetry.io/contrib/config"
 | 
			
		||||
	config "go.opentelemetry.io/contrib/config/v0.3.0"
 | 
			
		||||
 | 
			
		||||
	"go.opentelemetry.io/collector/component/componenttest"
 | 
			
		||||
	"go.opentelemetry.io/collector/config/configtelemetry"
 | 
			
		||||
| 
						 | 
				
			
			@ -119,7 +119,7 @@ func TestConfigValidate(t *testing.T) {
 | 
			
		|||
					Level: configtelemetry.LevelBasic,
 | 
			
		||||
					Readers: []config.MetricReader{
 | 
			
		||||
						{
 | 
			
		||||
							Pull: &config.PullMetricReader{Exporter: config.MetricExporter{Prometheus: &config.Prometheus{
 | 
			
		||||
							Pull: &config.PullMetricReader{Exporter: config.PullMetricExporter{Prometheus: &config.Prometheus{
 | 
			
		||||
								Host: newPtr("127.0.0.1"),
 | 
			
		||||
								Port: newPtr(3333),
 | 
			
		||||
							}}},
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,7 +7,7 @@ import (
 | 
			
		|||
	"context"
 | 
			
		||||
	"time"
 | 
			
		||||
 | 
			
		||||
	"go.opentelemetry.io/contrib/config"
 | 
			
		||||
	config "go.opentelemetry.io/contrib/config/v0.3.0"
 | 
			
		||||
	"go.opentelemetry.io/otel/log"
 | 
			
		||||
	"go.opentelemetry.io/otel/metric"
 | 
			
		||||
	"go.opentelemetry.io/otel/trace"
 | 
			
		||||
| 
						 | 
				
			
			@ -17,7 +17,6 @@ import (
 | 
			
		|||
	"go.opentelemetry.io/collector/component"
 | 
			
		||||
	"go.opentelemetry.io/collector/config/configtelemetry"
 | 
			
		||||
	"go.opentelemetry.io/collector/featuregate"
 | 
			
		||||
	"go.opentelemetry.io/collector/service/internal/resource"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
var useLocalHostAsDefaultMetricsAddressFeatureGate = featuregate.GlobalRegistry().MustRegister(
 | 
			
		||||
| 
						 | 
				
			
			@ -27,14 +26,6 @@ var useLocalHostAsDefaultMetricsAddressFeatureGate = featuregate.GlobalRegistry(
 | 
			
		|||
	featuregate.WithRegisterDescription("controls whether default Prometheus metrics server use localhost as the default host for their endpoints"),
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// disableHighCardinalityMetricsFeatureGate is the feature gate that controls whether the collector should enable
 | 
			
		||||
// potentially high cardinality metrics. The gate will be removed when the collector allows for view configuration.
 | 
			
		||||
var disableHighCardinalityMetricsFeatureGate = featuregate.GlobalRegistry().MustRegister(
 | 
			
		||||
	"telemetry.disableHighCardinalityMetrics",
 | 
			
		||||
	featuregate.StageAlpha,
 | 
			
		||||
	featuregate.WithRegisterDescription("controls whether the collector should enable potentially high"+
 | 
			
		||||
		"cardinality metrics. The gate will be removed when the collector allows for view configuration."))
 | 
			
		||||
 | 
			
		||||
// Settings holds configuration for building Telemetry.
 | 
			
		||||
type Settings struct {
 | 
			
		||||
	BuildInfo         component.BuildInfo
 | 
			
		||||
| 
						 | 
				
			
			@ -77,15 +68,7 @@ func NewFactory() Factory {
 | 
			
		|||
		}),
 | 
			
		||||
		withMeterProvider(func(_ context.Context, set Settings, cfg component.Config) (metric.MeterProvider, error) {
 | 
			
		||||
			c := *cfg.(*Config)
 | 
			
		||||
			disableHighCard := disableHighCardinalityMetricsFeatureGate.IsEnabled()
 | 
			
		||||
			return newMeterProvider(
 | 
			
		||||
				meterProviderSettings{
 | 
			
		||||
					res:               resource.New(set.BuildInfo, c.Resource),
 | 
			
		||||
					cfg:               c.Metrics,
 | 
			
		||||
					asyncErrorChannel: set.AsyncErrorChannel,
 | 
			
		||||
				},
 | 
			
		||||
				disableHighCard,
 | 
			
		||||
			)
 | 
			
		||||
			return newMeterProvider(set, c)
 | 
			
		||||
		}),
 | 
			
		||||
	)
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -117,9 +100,15 @@ func createDefaultConfig() component.Config {
 | 
			
		|||
			Level: configtelemetry.LevelNormal,
 | 
			
		||||
			Readers: []config.MetricReader{
 | 
			
		||||
				{
 | 
			
		||||
					Pull: &config.PullMetricReader{Exporter: config.MetricExporter{Prometheus: &config.Prometheus{
 | 
			
		||||
					Pull: &config.PullMetricReader{Exporter: config.PullMetricExporter{Prometheus: &config.Prometheus{
 | 
			
		||||
						WithoutScopeInfo:  newPtr(true),
 | 
			
		||||
						WithoutUnits:      newPtr(true),
 | 
			
		||||
						WithoutTypeSuffix: newPtr(true),
 | 
			
		||||
						Host:              &metricsHost,
 | 
			
		||||
						Port:              newPtr(8888),
 | 
			
		||||
						WithResourceConstantLabels: &config.IncludeExclude{
 | 
			
		||||
							Included: []string{},
 | 
			
		||||
						},
 | 
			
		||||
					}}},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
| 
						 | 
				
			
			@ -127,6 +116,6 @@ func createDefaultConfig() component.Config {
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func newPtr[T int | string](str T) *T {
 | 
			
		||||
func newPtr[T int | string | bool](str T) *T {
 | 
			
		||||
	return &str
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,7 +11,7 @@ import (
 | 
			
		|||
 | 
			
		||||
	"github.com/stretchr/testify/assert"
 | 
			
		||||
	"github.com/stretchr/testify/require"
 | 
			
		||||
	"go.opentelemetry.io/contrib/config"
 | 
			
		||||
	config "go.opentelemetry.io/contrib/config/v0.3.0"
 | 
			
		||||
	"go.uber.org/zap"
 | 
			
		||||
	"go.uber.org/zap/zapcore"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -67,7 +67,7 @@ func TestTelemetryConfiguration(t *testing.T) {
 | 
			
		|||
					Level: configtelemetry.LevelBasic,
 | 
			
		||||
					Readers: []config.MetricReader{
 | 
			
		||||
						{
 | 
			
		||||
							Pull: &config.PullMetricReader{Exporter: config.MetricExporter{Prometheus: &config.Prometheus{
 | 
			
		||||
							Pull: &config.PullMetricReader{Exporter: config.PullMetricExporter{Prometheus: &config.Prometheus{
 | 
			
		||||
								Host: newPtr("127.0.0.1"),
 | 
			
		||||
								Port: newPtr(3333),
 | 
			
		||||
							}}},
 | 
			
		||||
| 
						 | 
				
			
			@ -87,7 +87,7 @@ func TestTelemetryConfiguration(t *testing.T) {
 | 
			
		|||
					Level: configtelemetry.LevelBasic,
 | 
			
		||||
					Readers: []config.MetricReader{
 | 
			
		||||
						{
 | 
			
		||||
							Pull: &config.PullMetricReader{Exporter: config.MetricExporter{Prometheus: &config.Prometheus{
 | 
			
		||||
							Pull: &config.PullMetricReader{Exporter: config.PullMetricExporter{Prometheus: &config.Prometheus{
 | 
			
		||||
								Host: newPtr("127.0.0.1"),
 | 
			
		||||
								Port: newPtr(3333),
 | 
			
		||||
							}}},
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,12 @@
 | 
			
		|||
level: "info"
 | 
			
		||||
processors:
 | 
			
		||||
  - batch:
 | 
			
		||||
      exporter:
 | 
			
		||||
        otlp:
 | 
			
		||||
          protocol: http/protobuf
 | 
			
		||||
          endpoint: 127.0.0.1:4317
 | 
			
		||||
          headers:
 | 
			
		||||
            "key1": "value1"
 | 
			
		||||
  - simple:
 | 
			
		||||
      exporter:
 | 
			
		||||
        console: {}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,14 @@
 | 
			
		|||
level: detailed
 | 
			
		||||
readers:
 | 
			
		||||
  - periodic:
 | 
			
		||||
      exporter:
 | 
			
		||||
        otlp:
 | 
			
		||||
          protocol: http/protobuf
 | 
			
		||||
          endpoint: 127.0.0.1:4317
 | 
			
		||||
          headers:
 | 
			
		||||
            "key1": "value1"
 | 
			
		||||
  - pull:
 | 
			
		||||
      exporter:
 | 
			
		||||
        prometheus:
 | 
			
		||||
          host: 127.0.0.1
 | 
			
		||||
          port: 8902
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,12 @@
 | 
			
		|||
level: "none"
 | 
			
		||||
processors:
 | 
			
		||||
  - batch:
 | 
			
		||||
      exporter:
 | 
			
		||||
        otlp:
 | 
			
		||||
          protocol: http/protobuf
 | 
			
		||||
          endpoint: 127.0.0.1:4317
 | 
			
		||||
          headers:
 | 
			
		||||
            "key1": "value1"
 | 
			
		||||
  - simple:
 | 
			
		||||
      exporter:
 | 
			
		||||
        console: {}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,13 @@
 | 
			
		|||
level: "info"
 | 
			
		||||
processors:
 | 
			
		||||
  - batch:
 | 
			
		||||
      exporter:
 | 
			
		||||
        otlp:
 | 
			
		||||
          protocol: http/protobuf
 | 
			
		||||
          endpoint: 127.0.0.1:4317
 | 
			
		||||
          headers:
 | 
			
		||||
          - name: "key1"
 | 
			
		||||
            value: "value1"
 | 
			
		||||
  - simple:
 | 
			
		||||
      exporter:
 | 
			
		||||
        console: {}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,15 @@
 | 
			
		|||
level: detailed
 | 
			
		||||
readers:
 | 
			
		||||
  - periodic:
 | 
			
		||||
      exporter:
 | 
			
		||||
        otlp:
 | 
			
		||||
          protocol: http/protobuf
 | 
			
		||||
          endpoint: 127.0.0.1:4317
 | 
			
		||||
          headers:
 | 
			
		||||
          - name: "key1"
 | 
			
		||||
            value: "value1"
 | 
			
		||||
  - pull:
 | 
			
		||||
      exporter:
 | 
			
		||||
        prometheus:
 | 
			
		||||
          host: 127.0.0.1
 | 
			
		||||
          port: 8902
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,13 @@
 | 
			
		|||
level: "none"
 | 
			
		||||
processors:
 | 
			
		||||
  - batch:
 | 
			
		||||
      exporter:
 | 
			
		||||
        otlp:
 | 
			
		||||
          protocol: http/protobuf
 | 
			
		||||
          endpoint: 127.0.0.1:4317
 | 
			
		||||
          headers:
 | 
			
		||||
          - name: "key1"
 | 
			
		||||
            value: "value1"
 | 
			
		||||
  - simple:
 | 
			
		||||
      exporter:
 | 
			
		||||
        console: {}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,214 @@
 | 
			
		|||
// Copyright The OpenTelemetry Authors
 | 
			
		||||
// SPDX-License-Identifier: Apache-2.0
 | 
			
		||||
 | 
			
		||||
package migration // import "go.opentelemetry.io/collector/service/telemetry/internal/migration"
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	configv02 "go.opentelemetry.io/contrib/config/v0.2.0"
 | 
			
		||||
	config "go.opentelemetry.io/contrib/config/v0.3.0"
 | 
			
		||||
	"go.uber.org/zap/zapcore"
 | 
			
		||||
 | 
			
		||||
	"go.opentelemetry.io/collector/config/configtelemetry"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type tracesConfigV020 struct {
 | 
			
		||||
	Level       configtelemetry.Level     `mapstructure:"level"`
 | 
			
		||||
	Propagators []string                  `mapstructure:"propagators"`
 | 
			
		||||
	Processors  []configv02.SpanProcessor `mapstructure:"processors"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type metricsConfigV020 struct {
 | 
			
		||||
	Level   configtelemetry.Level    `mapstructure:"level"`
 | 
			
		||||
	Address string                   `mapstructure:"address"`
 | 
			
		||||
	Readers []configv02.MetricReader `mapstructure:"readers"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type logsConfigV020 struct {
 | 
			
		||||
	Level             zapcore.Level                  `mapstructure:"level"`
 | 
			
		||||
	Development       bool                           `mapstructure:"development"`
 | 
			
		||||
	Encoding          string                         `mapstructure:"encoding"`
 | 
			
		||||
	DisableCaller     bool                           `mapstructure:"disable_caller"`
 | 
			
		||||
	DisableStacktrace bool                           `mapstructure:"disable_stacktrace"`
 | 
			
		||||
	Sampling          *LogsSamplingConfig            `mapstructure:"sampling"`
 | 
			
		||||
	OutputPaths       []string                       `mapstructure:"output_paths"`
 | 
			
		||||
	ErrorOutputPaths  []string                       `mapstructure:"error_output_paths"`
 | 
			
		||||
	InitialFields     map[string]any                 `mapstructure:"initial_fields"`
 | 
			
		||||
	Processors        []configv02.LogRecordProcessor `mapstructure:"processors"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func headersV02ToV03(in configv02.Headers) []config.NameStringValuePair {
 | 
			
		||||
	headers := make([]config.NameStringValuePair, len(in))
 | 
			
		||||
	idx := 0
 | 
			
		||||
	for k, v := range in {
 | 
			
		||||
		headers[idx] = config.NameStringValuePair{
 | 
			
		||||
			Name:  k,
 | 
			
		||||
			Value: &v,
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return headers
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func otlpV02ToV03(in *configv02.OTLP) *config.OTLP {
 | 
			
		||||
	if in == nil {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
	return &config.OTLP{
 | 
			
		||||
		Certificate:       in.Certificate,
 | 
			
		||||
		ClientCertificate: in.ClientCertificate,
 | 
			
		||||
		ClientKey:         in.ClientKey,
 | 
			
		||||
		Compression:       in.Compression,
 | 
			
		||||
		Endpoint:          &in.Endpoint,
 | 
			
		||||
		Insecure:          in.Insecure,
 | 
			
		||||
		Protocol:          &in.Protocol,
 | 
			
		||||
		Timeout:           in.Timeout,
 | 
			
		||||
		Headers:           headersV02ToV03(in.Headers),
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func otlpMetricV02ToV03(in *configv02.OTLPMetric) *config.OTLPMetric {
 | 
			
		||||
	if in == nil {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
	return &config.OTLPMetric{
 | 
			
		||||
		Certificate:       in.Certificate,
 | 
			
		||||
		ClientCertificate: in.ClientCertificate,
 | 
			
		||||
		ClientKey:         in.ClientKey,
 | 
			
		||||
		Compression:       in.Compression,
 | 
			
		||||
		Endpoint:          &in.Endpoint,
 | 
			
		||||
		Insecure:          in.Insecure,
 | 
			
		||||
		Protocol:          &in.Protocol,
 | 
			
		||||
		Timeout:           in.Timeout,
 | 
			
		||||
		Headers:           headersV02ToV03(in.Headers),
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func zipkinV02ToV03(in *configv02.Zipkin) *config.Zipkin {
 | 
			
		||||
	if in == nil {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
	return &config.Zipkin{
 | 
			
		||||
		Endpoint: &in.Endpoint,
 | 
			
		||||
		Timeout:  in.Timeout,
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func tracesConfigV02ToV03(v2 tracesConfigV020, v3 *TracesConfigV030) error {
 | 
			
		||||
	processors := make([]config.SpanProcessor, len(v2.Processors))
 | 
			
		||||
	for idx, p := range v2.Processors {
 | 
			
		||||
		processors[idx] = config.SpanProcessor{}
 | 
			
		||||
		if p.Batch != nil {
 | 
			
		||||
			processors[idx].Batch = &config.BatchSpanProcessor{
 | 
			
		||||
				ExportTimeout:      p.Batch.ExportTimeout,
 | 
			
		||||
				MaxExportBatchSize: p.Batch.MaxExportBatchSize,
 | 
			
		||||
				MaxQueueSize:       p.Batch.MaxQueueSize,
 | 
			
		||||
				ScheduleDelay:      p.Batch.ScheduleDelay,
 | 
			
		||||
				Exporter: config.SpanExporter{
 | 
			
		||||
					Console:              config.Console(p.Batch.Exporter.Console),
 | 
			
		||||
					OTLP:                 otlpV02ToV03(p.Batch.Exporter.OTLP),
 | 
			
		||||
					Zipkin:               zipkinV02ToV03(p.Batch.Exporter.Zipkin),
 | 
			
		||||
					AdditionalProperties: p.Batch.Exporter.AdditionalProperties,
 | 
			
		||||
				},
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		if p.Simple != nil {
 | 
			
		||||
			processors[idx].Simple = &config.SimpleSpanProcessor{
 | 
			
		||||
				Exporter: config.SpanExporter{
 | 
			
		||||
					Console:              config.Console(p.Simple.Exporter.Console),
 | 
			
		||||
					OTLP:                 otlpV02ToV03(p.Simple.Exporter.OTLP),
 | 
			
		||||
					Zipkin:               zipkinV02ToV03(p.Simple.Exporter.Zipkin),
 | 
			
		||||
					AdditionalProperties: p.Simple.Exporter.AdditionalProperties,
 | 
			
		||||
				},
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		processors[idx].AdditionalProperties = p.AdditionalProperties
 | 
			
		||||
	}
 | 
			
		||||
	v3.Level = v2.Level
 | 
			
		||||
	v3.Propagators = v2.Propagators
 | 
			
		||||
	v3.Processors = processors
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func prometheusV02ToV03(in *configv02.Prometheus) *config.Prometheus {
 | 
			
		||||
	if in == nil {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
	return &config.Prometheus{
 | 
			
		||||
		Host:                       in.Host,
 | 
			
		||||
		Port:                       in.Port,
 | 
			
		||||
		WithoutScopeInfo:           in.WithoutScopeInfo,
 | 
			
		||||
		WithoutUnits:               in.WithoutUnits,
 | 
			
		||||
		WithoutTypeSuffix:          in.WithoutTypeSuffix,
 | 
			
		||||
		WithResourceConstantLabels: (*config.IncludeExclude)(in.WithResourceConstantLabels),
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func metricsConfigV02ToV03(v2 metricsConfigV020, v3 *MetricsConfigV030) error {
 | 
			
		||||
	readers := make([]config.MetricReader, len(v2.Readers))
 | 
			
		||||
	for idx, p := range v2.Readers {
 | 
			
		||||
		readers[idx] = config.MetricReader{}
 | 
			
		||||
		if p.Periodic != nil {
 | 
			
		||||
			readers[idx].Periodic = &config.PeriodicMetricReader{
 | 
			
		||||
				Interval: p.Periodic.Interval,
 | 
			
		||||
				Timeout:  p.Periodic.Timeout,
 | 
			
		||||
				Exporter: config.PushMetricExporter{
 | 
			
		||||
					Console:              config.Console(p.Periodic.Exporter.Console),
 | 
			
		||||
					OTLP:                 otlpMetricV02ToV03(p.Periodic.Exporter.OTLP),
 | 
			
		||||
					AdditionalProperties: p.Periodic.Exporter.AdditionalProperties,
 | 
			
		||||
				},
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		if p.Pull != nil {
 | 
			
		||||
			readers[idx].Pull = &config.PullMetricReader{
 | 
			
		||||
				Exporter: config.PullMetricExporter{
 | 
			
		||||
					Prometheus:           prometheusV02ToV03(p.Pull.Exporter.Prometheus),
 | 
			
		||||
					AdditionalProperties: p.Pull.Exporter.AdditionalProperties,
 | 
			
		||||
				},
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	v3.Level = v2.Level
 | 
			
		||||
	v3.Address = v2.Address
 | 
			
		||||
	v3.Readers = readers
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func logsConfigV02ToV03(v2 logsConfigV020, v3 *LogsConfigV030) error {
 | 
			
		||||
	processors := make([]config.LogRecordProcessor, len(v2.Processors))
 | 
			
		||||
	for idx, p := range v2.Processors {
 | 
			
		||||
		processors[idx] = config.LogRecordProcessor{}
 | 
			
		||||
		if p.Batch != nil {
 | 
			
		||||
			processors[idx].Batch = &config.BatchLogRecordProcessor{
 | 
			
		||||
				ExportTimeout:      p.Batch.ExportTimeout,
 | 
			
		||||
				MaxExportBatchSize: p.Batch.MaxExportBatchSize,
 | 
			
		||||
				MaxQueueSize:       p.Batch.MaxQueueSize,
 | 
			
		||||
				ScheduleDelay:      p.Batch.ScheduleDelay,
 | 
			
		||||
				Exporter: config.LogRecordExporter{
 | 
			
		||||
					Console:              config.Console(p.Batch.Exporter.Console),
 | 
			
		||||
					OTLP:                 otlpV02ToV03(p.Batch.Exporter.OTLP),
 | 
			
		||||
					AdditionalProperties: p.Batch.Exporter.AdditionalProperties,
 | 
			
		||||
				},
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		if p.Simple != nil {
 | 
			
		||||
			processors[idx].Simple = &config.SimpleLogRecordProcessor{
 | 
			
		||||
				Exporter: config.LogRecordExporter{
 | 
			
		||||
					Console:              config.Console(p.Simple.Exporter.Console),
 | 
			
		||||
					OTLP:                 otlpV02ToV03(p.Simple.Exporter.OTLP),
 | 
			
		||||
					AdditionalProperties: p.Simple.Exporter.AdditionalProperties,
 | 
			
		||||
				},
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		processors[idx].AdditionalProperties = p.AdditionalProperties
 | 
			
		||||
	}
 | 
			
		||||
	v3.Level = v2.Level
 | 
			
		||||
	v3.Development = v2.Development
 | 
			
		||||
	v3.Encoding = v2.Encoding
 | 
			
		||||
	v3.DisableCaller = v2.DisableCaller
 | 
			
		||||
	v3.DisableStacktrace = v2.DisableStacktrace
 | 
			
		||||
	v3.Sampling = v2.Sampling
 | 
			
		||||
	v3.OutputPaths = v2.OutputPaths
 | 
			
		||||
	v3.ErrorOutputPaths = v2.ErrorOutputPaths
 | 
			
		||||
	v3.InitialFields = v2.InitialFields
 | 
			
		||||
	v3.Processors = processors
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,40 @@
 | 
			
		|||
// Copyright The OpenTelemetry Authors
 | 
			
		||||
// SPDX-License-Identifier: Apache-2.0
 | 
			
		||||
 | 
			
		||||
package migration
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"path/filepath"
 | 
			
		||||
	"testing"
 | 
			
		||||
 | 
			
		||||
	"github.com/stretchr/testify/require"
 | 
			
		||||
 | 
			
		||||
	"go.opentelemetry.io/collector/confmap/confmaptest"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func TestUnmarshalLogsConfigV020(t *testing.T) {
 | 
			
		||||
	cm, err := confmaptest.LoadConf(filepath.Join("testdata", "v0.2.0_logs.yaml"))
 | 
			
		||||
	require.NoError(t, err)
 | 
			
		||||
 | 
			
		||||
	cfg := LogsConfigV030{}
 | 
			
		||||
	require.NoError(t, cm.Unmarshal(&cfg))
 | 
			
		||||
	require.Len(t, cfg.Processors, 2)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestUnmarshalTracesConfigV020(t *testing.T) {
 | 
			
		||||
	cm, err := confmaptest.LoadConf(filepath.Join("testdata", "v0.2.0_traces.yaml"))
 | 
			
		||||
	require.NoError(t, err)
 | 
			
		||||
 | 
			
		||||
	cfg := TracesConfigV030{}
 | 
			
		||||
	require.NoError(t, cm.Unmarshal(&cfg))
 | 
			
		||||
	require.Len(t, cfg.Processors, 2)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestUnmarshalMetricsConfigV020(t *testing.T) {
 | 
			
		||||
	cm, err := confmaptest.LoadConf(filepath.Join("testdata", "v0.2.0_metrics.yaml"))
 | 
			
		||||
	require.NoError(t, err)
 | 
			
		||||
 | 
			
		||||
	cfg := MetricsConfigV030{}
 | 
			
		||||
	require.NoError(t, cm.Unmarshal(&cfg))
 | 
			
		||||
	require.Len(t, cfg.Readers, 2)
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,174 @@
 | 
			
		|||
// Copyright The OpenTelemetry Authors
 | 
			
		||||
// SPDX-License-Identifier: Apache-2.0
 | 
			
		||||
 | 
			
		||||
package migration // import "go.opentelemetry.io/collector/service/telemetry/internal/migration"
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"time"
 | 
			
		||||
 | 
			
		||||
	config "go.opentelemetry.io/contrib/config/v0.3.0"
 | 
			
		||||
	"go.uber.org/zap/zapcore"
 | 
			
		||||
 | 
			
		||||
	"go.opentelemetry.io/collector/config/configtelemetry"
 | 
			
		||||
	"go.opentelemetry.io/collector/confmap"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type TracesConfigV030 struct {
 | 
			
		||||
	// Level configures whether spans are emitted or not, the possible values are:
 | 
			
		||||
	//  - "none" indicates that no tracing data should be collected;
 | 
			
		||||
	//  - "basic" is the recommended and covers the basics of the service telemetry.
 | 
			
		||||
	Level configtelemetry.Level `mapstructure:"level"`
 | 
			
		||||
	// Propagators is a list of TextMapPropagators from the supported propagators list. Currently,
 | 
			
		||||
	// tracecontext and  b3 are supported. By default, the value is set to empty list and
 | 
			
		||||
	// context propagation is disabled.
 | 
			
		||||
	Propagators []string `mapstructure:"propagators"`
 | 
			
		||||
	// Processors allow configuration of span processors to emit spans to
 | 
			
		||||
	// any number of supported backends.
 | 
			
		||||
	Processors []config.SpanProcessor `mapstructure:"processors"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (c *TracesConfigV030) Unmarshal(conf *confmap.Conf) error {
 | 
			
		||||
	if err := conf.Unmarshal(c); err != nil {
 | 
			
		||||
		var v2TracesConfig tracesConfigV020
 | 
			
		||||
		// try unmarshaling using v0.2.0 struct
 | 
			
		||||
		if e := conf.Unmarshal(&v2TracesConfig); e != nil {
 | 
			
		||||
			// error could not be resolved through backwards
 | 
			
		||||
			// compatibility attempts
 | 
			
		||||
			return err
 | 
			
		||||
		}
 | 
			
		||||
		// TODO: add a warning log to tell users to migrate their config
 | 
			
		||||
		return tracesConfigV02ToV03(v2TracesConfig, c)
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type MetricsConfigV030 struct {
 | 
			
		||||
	// Level is the level of telemetry metrics, the possible values are:
 | 
			
		||||
	//  - "none" indicates that no telemetry data should be collected;
 | 
			
		||||
	//  - "basic" is the recommended and covers the basics of the service telemetry.
 | 
			
		||||
	//  - "normal" adds some other indicators on top of basic.
 | 
			
		||||
	//  - "detailed" adds dimensions and views to the previous levels.
 | 
			
		||||
	Level configtelemetry.Level `mapstructure:"level"`
 | 
			
		||||
 | 
			
		||||
	// Deprecated: [v0.111.0] use readers configuration.
 | 
			
		||||
	Address string `mapstructure:"address"`
 | 
			
		||||
 | 
			
		||||
	// Readers allow configuration of metric readers to emit metrics to
 | 
			
		||||
	// any number of supported backends.
 | 
			
		||||
	Readers []config.MetricReader `mapstructure:"readers"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (c *MetricsConfigV030) Unmarshal(conf *confmap.Conf) error {
 | 
			
		||||
	if err := conf.Unmarshal(c); err != nil {
 | 
			
		||||
		var v02 metricsConfigV020
 | 
			
		||||
		// try unmarshaling using v0.2.0 struct
 | 
			
		||||
		if e := conf.Unmarshal(&v02); e != nil {
 | 
			
		||||
			// error could not be resolved through backwards
 | 
			
		||||
			// compatibility attempts
 | 
			
		||||
			return err
 | 
			
		||||
		}
 | 
			
		||||
		// TODO: add a warning log to tell users to migrate their config
 | 
			
		||||
		return metricsConfigV02ToV03(v02, c)
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type LogsConfigV030 struct {
 | 
			
		||||
	// Level is the minimum enabled logging level.
 | 
			
		||||
	// (default = "INFO")
 | 
			
		||||
	Level zapcore.Level `mapstructure:"level"`
 | 
			
		||||
 | 
			
		||||
	// Development puts the logger in development mode, which changes the
 | 
			
		||||
	// behavior of DPanicLevel and takes stacktraces more liberally.
 | 
			
		||||
	// (default = false)
 | 
			
		||||
	Development bool `mapstructure:"development"`
 | 
			
		||||
 | 
			
		||||
	// Encoding sets the logger's encoding.
 | 
			
		||||
	// Example values are "json", "console".
 | 
			
		||||
	Encoding string `mapstructure:"encoding"`
 | 
			
		||||
 | 
			
		||||
	// DisableCaller stops annotating logs with the calling function's file
 | 
			
		||||
	// name and line number. By default, all logs are annotated.
 | 
			
		||||
	// (default = false)
 | 
			
		||||
	DisableCaller bool `mapstructure:"disable_caller"`
 | 
			
		||||
 | 
			
		||||
	// DisableStacktrace completely disables automatic stacktrace capturing. By
 | 
			
		||||
	// default, stacktraces are captured for WarnLevel and above logs in
 | 
			
		||||
	// development and ErrorLevel and above in production.
 | 
			
		||||
	// (default = false)
 | 
			
		||||
	DisableStacktrace bool `mapstructure:"disable_stacktrace"`
 | 
			
		||||
 | 
			
		||||
	// Sampling sets a sampling policy.
 | 
			
		||||
	// Default:
 | 
			
		||||
	// 		sampling:
 | 
			
		||||
	//	   		enabled: true
 | 
			
		||||
	//	   		tick: 10s
 | 
			
		||||
	//	   		initial: 10
 | 
			
		||||
	//	   		thereafter: 100
 | 
			
		||||
	// Sampling can be disabled by setting 'enabled' to false
 | 
			
		||||
	Sampling *LogsSamplingConfig `mapstructure:"sampling"`
 | 
			
		||||
 | 
			
		||||
	// OutputPaths is a list of URLs or file paths to write logging output to.
 | 
			
		||||
	// The URLs could only be with "file" schema or without schema.
 | 
			
		||||
	// The URLs with "file" schema must be an absolute path.
 | 
			
		||||
	// The URLs without schema are treated as local file paths.
 | 
			
		||||
	// "stdout" and "stderr" are interpreted as os.Stdout and os.Stderr.
 | 
			
		||||
	// see details at Open in zap/writer.go.
 | 
			
		||||
	// (default = ["stderr"])
 | 
			
		||||
	OutputPaths []string `mapstructure:"output_paths"`
 | 
			
		||||
 | 
			
		||||
	// ErrorOutputPaths is a list of URLs or file paths to write zap internal logger errors to.
 | 
			
		||||
	// The URLs could only be with "file" schema or without schema.
 | 
			
		||||
	// The URLs with "file" schema must use absolute paths.
 | 
			
		||||
	// The URLs without schema are treated as local file paths.
 | 
			
		||||
	// "stdout" and "stderr" are interpreted as os.Stdout and os.Stderr.
 | 
			
		||||
	// see details at Open in zap/writer.go.
 | 
			
		||||
	//
 | 
			
		||||
	// Note that this setting only affects the zap internal logger errors.
 | 
			
		||||
	// (default = ["stderr"])
 | 
			
		||||
	ErrorOutputPaths []string `mapstructure:"error_output_paths"`
 | 
			
		||||
 | 
			
		||||
	// InitialFields is a collection of fields to add to the root logger.
 | 
			
		||||
	// Example:
 | 
			
		||||
	//
 | 
			
		||||
	// 		initial_fields:
 | 
			
		||||
	//	   		foo: "bar"
 | 
			
		||||
	//
 | 
			
		||||
	// By default, there is no initial field.
 | 
			
		||||
	InitialFields map[string]any `mapstructure:"initial_fields"`
 | 
			
		||||
 | 
			
		||||
	// Processors allow configuration of log record processors to emit logs to
 | 
			
		||||
	// any number of suported backends.
 | 
			
		||||
	Processors []config.LogRecordProcessor `mapstructure:"processors"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// LogsSamplingConfig sets a sampling strategy for the logger. Sampling caps the
 | 
			
		||||
// global CPU and I/O load that logging puts on your process while attempting
 | 
			
		||||
// to preserve a representative subset of your logs.
 | 
			
		||||
type LogsSamplingConfig struct {
 | 
			
		||||
	// Enabled enable sampling logging
 | 
			
		||||
	Enabled bool `mapstructure:"enabled"`
 | 
			
		||||
	// Tick represents the interval in seconds that the logger apply each sampling.
 | 
			
		||||
	Tick time.Duration `mapstructure:"tick"`
 | 
			
		||||
	// Initial represents the first M messages logged each Tick.
 | 
			
		||||
	Initial int `mapstructure:"initial"`
 | 
			
		||||
	// Thereafter represents the sampling rate, every Nth message will be sampled after Initial messages are logged during each Tick.
 | 
			
		||||
	// If Thereafter is zero, the logger will drop all the messages after the Initial each Tick.
 | 
			
		||||
	Thereafter int `mapstructure:"thereafter"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (c *LogsConfigV030) Unmarshal(conf *confmap.Conf) error {
 | 
			
		||||
	if err := conf.Unmarshal(c); err != nil {
 | 
			
		||||
		var v02 logsConfigV020
 | 
			
		||||
		// try unmarshaling using v0.2.0 struct
 | 
			
		||||
		if e := conf.Unmarshal(&v02); e != nil {
 | 
			
		||||
			// error could not be resolved through backwards
 | 
			
		||||
			// compatibility attempts
 | 
			
		||||
			return err
 | 
			
		||||
		}
 | 
			
		||||
		// TODO: add a warning log to tell users to migrate their config
 | 
			
		||||
		return logsConfigV02ToV03(v02, c)
 | 
			
		||||
	}
 | 
			
		||||
	//
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,40 @@
 | 
			
		|||
// Copyright The OpenTelemetry Authors
 | 
			
		||||
// SPDX-License-Identifier: Apache-2.0
 | 
			
		||||
 | 
			
		||||
package migration
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"path/filepath"
 | 
			
		||||
	"testing"
 | 
			
		||||
 | 
			
		||||
	"github.com/stretchr/testify/require"
 | 
			
		||||
 | 
			
		||||
	"go.opentelemetry.io/collector/confmap/confmaptest"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func TestUnmarshalLogsConfigV030(t *testing.T) {
 | 
			
		||||
	cm, err := confmaptest.LoadConf(filepath.Join("testdata", "v0.3.0_logs.yaml"))
 | 
			
		||||
	require.NoError(t, err)
 | 
			
		||||
 | 
			
		||||
	cfg := LogsConfigV030{}
 | 
			
		||||
	require.NoError(t, cm.Unmarshal(&cfg))
 | 
			
		||||
	require.Len(t, cfg.Processors, 2)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestUnmarshalTracesConfigV030(t *testing.T) {
 | 
			
		||||
	cm, err := confmaptest.LoadConf(filepath.Join("testdata", "v0.3.0_traces.yaml"))
 | 
			
		||||
	require.NoError(t, err)
 | 
			
		||||
 | 
			
		||||
	cfg := TracesConfigV030{}
 | 
			
		||||
	require.NoError(t, cm.Unmarshal(&cfg))
 | 
			
		||||
	require.Len(t, cfg.Processors, 2)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestUnmarshalMetricsConfigV030(t *testing.T) {
 | 
			
		||||
	cm, err := confmaptest.LoadConf(filepath.Join("testdata", "v0.3.0_metrics.yaml"))
 | 
			
		||||
	require.NoError(t, err)
 | 
			
		||||
 | 
			
		||||
	cfg := MetricsConfigV030{}
 | 
			
		||||
	require.NoError(t, cm.Unmarshal(&cfg))
 | 
			
		||||
	require.Len(t, cfg.Readers, 2)
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,341 +0,0 @@
 | 
			
		|||
// Copyright The OpenTelemetry Authors
 | 
			
		||||
// SPDX-License-Identifier: Apache-2.0
 | 
			
		||||
 | 
			
		||||
package otelinit // import "go.opentelemetry.io/collector/service/telemetry/internal/otelinit"
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"context"
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
	"errors"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"net"
 | 
			
		||||
	"net/http"
 | 
			
		||||
	"net/url"
 | 
			
		||||
	"os"
 | 
			
		||||
	"strconv"
 | 
			
		||||
	"strings"
 | 
			
		||||
	"sync"
 | 
			
		||||
	"time"
 | 
			
		||||
 | 
			
		||||
	"github.com/prometheus/client_golang/prometheus"
 | 
			
		||||
	"github.com/prometheus/client_golang/prometheus/promhttp"
 | 
			
		||||
	"go.opentelemetry.io/contrib/config"
 | 
			
		||||
	"go.opentelemetry.io/otel/attribute"
 | 
			
		||||
	"go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc"
 | 
			
		||||
	"go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp"
 | 
			
		||||
	otelprom "go.opentelemetry.io/otel/exporters/prometheus"
 | 
			
		||||
	"go.opentelemetry.io/otel/exporters/stdout/stdoutmetric"
 | 
			
		||||
	"go.opentelemetry.io/otel/sdk/instrumentation"
 | 
			
		||||
	sdkmetric "go.opentelemetry.io/otel/sdk/metric"
 | 
			
		||||
	"go.opentelemetry.io/otel/sdk/metric/metricdata"
 | 
			
		||||
	"go.opentelemetry.io/otel/sdk/resource"
 | 
			
		||||
	"google.golang.org/grpc/credentials"
 | 
			
		||||
 | 
			
		||||
	semconv "go.opentelemetry.io/collector/semconv/v1.18.0"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
 | 
			
		||||
	// gRPC Instrumentation Name
 | 
			
		||||
	GRPCInstrumentation = "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
 | 
			
		||||
 | 
			
		||||
	// http Instrumentation Name
 | 
			
		||||
	HTTPInstrumentation = "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
 | 
			
		||||
 | 
			
		||||
	// supported protocols
 | 
			
		||||
	protocolProtobufHTTP     = "http/protobuf"
 | 
			
		||||
	protocolProtobufGRPC     = "grpc/protobuf"
 | 
			
		||||
	defaultReadHeaderTimeout = 10 * time.Second
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
var (
 | 
			
		||||
	// GRPCUnacceptableKeyValues is a list of high cardinality grpc attributes that should be filtered out.
 | 
			
		||||
	GRPCUnacceptableKeyValues = attribute.NewSet(
 | 
			
		||||
		attribute.String(semconv.AttributeNetSockPeerAddr, ""),
 | 
			
		||||
		attribute.String(semconv.AttributeNetSockPeerPort, ""),
 | 
			
		||||
		attribute.String(semconv.AttributeNetSockPeerName, ""),
 | 
			
		||||
	)
 | 
			
		||||
 | 
			
		||||
	// HTTPUnacceptableKeyValues is a list of high cardinality http attributes that should be filtered out.
 | 
			
		||||
	HTTPUnacceptableKeyValues = attribute.NewSet(
 | 
			
		||||
		attribute.String(semconv.AttributeNetHostName, ""),
 | 
			
		||||
		attribute.String(semconv.AttributeNetHostPort, ""),
 | 
			
		||||
	)
 | 
			
		||||
 | 
			
		||||
	errNoValidMetricExporter = errors.New("no valid metric exporter")
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func InitMetricReader(ctx context.Context, reader config.MetricReader, asyncErrorChannel chan error, serverWG *sync.WaitGroup) (sdkmetric.Reader, *http.Server, error) {
 | 
			
		||||
	if reader.Pull != nil {
 | 
			
		||||
		return initPullExporter(reader.Pull.Exporter, asyncErrorChannel, serverWG)
 | 
			
		||||
	}
 | 
			
		||||
	if reader.Periodic != nil {
 | 
			
		||||
		var opts []sdkmetric.PeriodicReaderOption
 | 
			
		||||
		if reader.Periodic.Interval != nil {
 | 
			
		||||
			opts = append(opts, sdkmetric.WithInterval(time.Duration(*reader.Periodic.Interval)*time.Millisecond))
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if reader.Periodic.Timeout != nil {
 | 
			
		||||
			opts = append(opts, sdkmetric.WithTimeout(time.Duration(*reader.Periodic.Timeout)*time.Millisecond))
 | 
			
		||||
		}
 | 
			
		||||
		return initPeriodicExporter(ctx, reader.Periodic.Exporter, opts...)
 | 
			
		||||
	}
 | 
			
		||||
	return nil, nil, fmt.Errorf("unsupported metric reader type %v", reader)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func InitOpenTelemetry(res *resource.Resource, options []sdkmetric.Option, disableHighCardinality bool) (*sdkmetric.MeterProvider, error) {
 | 
			
		||||
	opts := []sdkmetric.Option{
 | 
			
		||||
		sdkmetric.WithResource(res),
 | 
			
		||||
		sdkmetric.WithView(disableHighCardinalityViews(disableHighCardinality)...),
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	opts = append(opts, options...)
 | 
			
		||||
	return sdkmetric.NewMeterProvider(
 | 
			
		||||
		opts...,
 | 
			
		||||
	), nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func InitPrometheusServer(registry *prometheus.Registry, address string, asyncErrorChannel chan error, serverWG *sync.WaitGroup) *http.Server {
 | 
			
		||||
	mux := http.NewServeMux()
 | 
			
		||||
	mux.Handle("/metrics", promhttp.HandlerFor(registry, promhttp.HandlerOpts{}))
 | 
			
		||||
	server := &http.Server{
 | 
			
		||||
		Addr:              address,
 | 
			
		||||
		Handler:           mux,
 | 
			
		||||
		ReadHeaderTimeout: defaultReadHeaderTimeout,
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	serverWG.Add(1)
 | 
			
		||||
	go func() {
 | 
			
		||||
		defer serverWG.Done()
 | 
			
		||||
		if serveErr := server.ListenAndServe(); serveErr != nil && !errors.Is(serveErr, http.ErrServerClosed) {
 | 
			
		||||
			select {
 | 
			
		||||
			case asyncErrorChannel <- serveErr:
 | 
			
		||||
			case <-time.After(1 * time.Second):
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}()
 | 
			
		||||
	return server
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func disableHighCardinalityViews(disableHighCardinality bool) []sdkmetric.View {
 | 
			
		||||
	if !disableHighCardinality {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
	return []sdkmetric.View{
 | 
			
		||||
		sdkmetric.NewView(
 | 
			
		||||
			sdkmetric.Instrument{Scope: instrumentation.Scope{Name: GRPCInstrumentation}},
 | 
			
		||||
			sdkmetric.Stream{
 | 
			
		||||
				AttributeFilter: cardinalityFilter(GRPCUnacceptableKeyValues),
 | 
			
		||||
			}),
 | 
			
		||||
		sdkmetric.NewView(
 | 
			
		||||
			sdkmetric.Instrument{Scope: instrumentation.Scope{Name: HTTPInstrumentation}},
 | 
			
		||||
			sdkmetric.Stream{
 | 
			
		||||
				AttributeFilter: cardinalityFilter(HTTPUnacceptableKeyValues),
 | 
			
		||||
			}),
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func cardinalityFilter(filter attribute.Set) attribute.Filter {
 | 
			
		||||
	return func(kv attribute.KeyValue) bool {
 | 
			
		||||
		return !filter.HasValue(kv.Key)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func initPrometheusExporter(prometheusConfig *config.Prometheus, asyncErrorChannel chan error, serverWG *sync.WaitGroup) (sdkmetric.Reader, *http.Server, error) {
 | 
			
		||||
	promRegistry := prometheus.NewRegistry()
 | 
			
		||||
	if prometheusConfig.Host == nil {
 | 
			
		||||
		return nil, nil, errors.New("host must be specified")
 | 
			
		||||
	}
 | 
			
		||||
	if prometheusConfig.Port == nil {
 | 
			
		||||
		return nil, nil, errors.New("port must be specified")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	opts := []otelprom.Option{
 | 
			
		||||
		otelprom.WithRegisterer(promRegistry),
 | 
			
		||||
		// https://github.com/open-telemetry/opentelemetry-collector/issues/8043
 | 
			
		||||
		otelprom.WithoutUnits(),
 | 
			
		||||
		// Disabled for the moment until this becomes stable, and we are ready to break backwards compatibility.
 | 
			
		||||
		otelprom.WithoutScopeInfo(),
 | 
			
		||||
		// This allows us to produce metrics that are backwards compatible w/ opencensus
 | 
			
		||||
		otelprom.WithoutCounterSuffixes(),
 | 
			
		||||
		otelprom.WithResourceAsConstantLabels(attribute.NewDenyKeysFilter()),
 | 
			
		||||
	}
 | 
			
		||||
	exporter, err := otelprom.New(opts...)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, nil, fmt.Errorf("error creating otel prometheus exporter: %w", err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return exporter, InitPrometheusServer(promRegistry, net.JoinHostPort(*prometheusConfig.Host, strconv.Itoa(*prometheusConfig.Port)), asyncErrorChannel, serverWG), nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func initPullExporter(exporter config.MetricExporter, asyncErrorChannel chan error, serverWG *sync.WaitGroup) (sdkmetric.Reader, *http.Server, error) {
 | 
			
		||||
	if exporter.Prometheus != nil {
 | 
			
		||||
		return initPrometheusExporter(exporter.Prometheus, asyncErrorChannel, serverWG)
 | 
			
		||||
	}
 | 
			
		||||
	return nil, nil, errNoValidMetricExporter
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func initPeriodicExporter(ctx context.Context, exporter config.MetricExporter, opts ...sdkmetric.PeriodicReaderOption) (sdkmetric.Reader, *http.Server, error) {
 | 
			
		||||
	if exporter.Console != nil {
 | 
			
		||||
		enc := json.NewEncoder(os.Stdout)
 | 
			
		||||
		enc.SetIndent("", "  ")
 | 
			
		||||
 | 
			
		||||
		exp, err := stdoutmetric.New(
 | 
			
		||||
			stdoutmetric.WithEncoder(enc),
 | 
			
		||||
		)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return nil, nil, err
 | 
			
		||||
		}
 | 
			
		||||
		return sdkmetric.NewPeriodicReader(exp, opts...), nil, nil
 | 
			
		||||
	}
 | 
			
		||||
	if exporter.OTLP != nil {
 | 
			
		||||
		var err error
 | 
			
		||||
		var exp sdkmetric.Exporter
 | 
			
		||||
		switch exporter.OTLP.Protocol {
 | 
			
		||||
		case protocolProtobufHTTP:
 | 
			
		||||
			exp, err = initOTLPHTTPExporter(ctx, exporter.OTLP)
 | 
			
		||||
		case protocolProtobufGRPC:
 | 
			
		||||
			exp, err = initOTLPgRPCExporter(ctx, exporter.OTLP)
 | 
			
		||||
		default:
 | 
			
		||||
			return nil, nil, fmt.Errorf("unsupported protocol %s", exporter.OTLP.Protocol)
 | 
			
		||||
		}
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return nil, nil, err
 | 
			
		||||
		}
 | 
			
		||||
		return sdkmetric.NewPeriodicReader(exp, opts...), nil, nil
 | 
			
		||||
	}
 | 
			
		||||
	return nil, nil, errNoValidMetricExporter
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func normalizeEndpoint(endpoint string) string {
 | 
			
		||||
	if !strings.HasPrefix(endpoint, "https://") && !strings.HasPrefix(endpoint, "http://") {
 | 
			
		||||
		return "http://" + endpoint
 | 
			
		||||
	}
 | 
			
		||||
	return endpoint
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func initOTLPgRPCExporter(ctx context.Context, otlpConfig *config.OTLPMetric) (sdkmetric.Exporter, error) {
 | 
			
		||||
	opts := []otlpmetricgrpc.Option{}
 | 
			
		||||
 | 
			
		||||
	if len(otlpConfig.Endpoint) > 0 {
 | 
			
		||||
		u, err := url.ParseRequestURI(normalizeEndpoint(otlpConfig.Endpoint))
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return nil, err
 | 
			
		||||
		}
 | 
			
		||||
		opts = append(opts, otlpmetricgrpc.WithEndpoint(u.Host))
 | 
			
		||||
		if u.Scheme == "http" {
 | 
			
		||||
			opts = append(opts, otlpmetricgrpc.WithInsecure())
 | 
			
		||||
		} else if otlpConfig.Certificate != nil {
 | 
			
		||||
			creds, err := credentials.NewClientTLSFromFile(*otlpConfig.Certificate, "")
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				return nil, fmt.Errorf("could not create client tls credentials: %w", err)
 | 
			
		||||
			}
 | 
			
		||||
			opts = append(opts, otlpmetricgrpc.WithTLSCredentials(creds))
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if otlpConfig.Compression != nil {
 | 
			
		||||
		switch *otlpConfig.Compression {
 | 
			
		||||
		case "gzip":
 | 
			
		||||
			opts = append(opts, otlpmetricgrpc.WithCompressor(*otlpConfig.Compression))
 | 
			
		||||
		case "none":
 | 
			
		||||
		default:
 | 
			
		||||
			return nil, fmt.Errorf("unsupported compression %q", *otlpConfig.Compression)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	if otlpConfig.Timeout != nil {
 | 
			
		||||
		opts = append(opts, otlpmetricgrpc.WithTimeout(time.Millisecond*time.Duration(*otlpConfig.Timeout)))
 | 
			
		||||
	}
 | 
			
		||||
	if len(otlpConfig.Headers) > 0 {
 | 
			
		||||
		opts = append(opts, otlpmetricgrpc.WithHeaders(otlpConfig.Headers))
 | 
			
		||||
	}
 | 
			
		||||
	if otlpConfig.TemporalityPreference != nil {
 | 
			
		||||
		switch *otlpConfig.TemporalityPreference {
 | 
			
		||||
		case "delta":
 | 
			
		||||
			opts = append(opts, otlpmetricgrpc.WithTemporalitySelector(temporalityPreferenceDelta))
 | 
			
		||||
		case "cumulative":
 | 
			
		||||
			opts = append(opts, otlpmetricgrpc.WithTemporalitySelector(temporalityPreferenceCumulative))
 | 
			
		||||
		case "lowmemory":
 | 
			
		||||
			opts = append(opts, otlpmetricgrpc.WithTemporalitySelector(temporalityPreferenceLowMemory))
 | 
			
		||||
		default:
 | 
			
		||||
			return nil, fmt.Errorf("unsupported temporality preference %q", *otlpConfig.TemporalityPreference)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return otlpmetricgrpc.New(ctx, opts...)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func initOTLPHTTPExporter(ctx context.Context, otlpConfig *config.OTLPMetric) (sdkmetric.Exporter, error) {
 | 
			
		||||
	opts := []otlpmetrichttp.Option{}
 | 
			
		||||
 | 
			
		||||
	if len(otlpConfig.Endpoint) > 0 {
 | 
			
		||||
		u, err := url.ParseRequestURI(normalizeEndpoint(otlpConfig.Endpoint))
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return nil, err
 | 
			
		||||
		}
 | 
			
		||||
		opts = append(opts, otlpmetrichttp.WithEndpoint(u.Host))
 | 
			
		||||
 | 
			
		||||
		if u.Scheme == "http" {
 | 
			
		||||
			opts = append(opts, otlpmetrichttp.WithInsecure())
 | 
			
		||||
		}
 | 
			
		||||
		if len(u.Path) > 0 {
 | 
			
		||||
			opts = append(opts, otlpmetrichttp.WithURLPath(u.Path))
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	if otlpConfig.Compression != nil {
 | 
			
		||||
		switch *otlpConfig.Compression {
 | 
			
		||||
		case "gzip":
 | 
			
		||||
			opts = append(opts, otlpmetrichttp.WithCompression(otlpmetrichttp.GzipCompression))
 | 
			
		||||
		case "none":
 | 
			
		||||
			opts = append(opts, otlpmetrichttp.WithCompression(otlpmetrichttp.NoCompression))
 | 
			
		||||
		default:
 | 
			
		||||
			return nil, fmt.Errorf("unsupported compression %q", *otlpConfig.Compression)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	if otlpConfig.Timeout != nil {
 | 
			
		||||
		opts = append(opts, otlpmetrichttp.WithTimeout(time.Millisecond*time.Duration(*otlpConfig.Timeout)))
 | 
			
		||||
	}
 | 
			
		||||
	if len(otlpConfig.Headers) > 0 {
 | 
			
		||||
		opts = append(opts, otlpmetrichttp.WithHeaders(otlpConfig.Headers))
 | 
			
		||||
	}
 | 
			
		||||
	if otlpConfig.TemporalityPreference != nil {
 | 
			
		||||
		switch *otlpConfig.TemporalityPreference {
 | 
			
		||||
		case "delta":
 | 
			
		||||
			opts = append(opts, otlpmetrichttp.WithTemporalitySelector(temporalityPreferenceDelta))
 | 
			
		||||
		case "cumulative":
 | 
			
		||||
			opts = append(opts, otlpmetrichttp.WithTemporalitySelector(temporalityPreferenceCumulative))
 | 
			
		||||
		case "lowmemory":
 | 
			
		||||
			opts = append(opts, otlpmetrichttp.WithTemporalitySelector(temporalityPreferenceLowMemory))
 | 
			
		||||
		default:
 | 
			
		||||
			return nil, fmt.Errorf("unsupported temporality preference %q", *otlpConfig.TemporalityPreference)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return otlpmetrichttp.New(ctx, opts...)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func temporalityPreferenceCumulative(_ sdkmetric.InstrumentKind) metricdata.Temporality {
 | 
			
		||||
	return metricdata.CumulativeTemporality
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func temporalityPreferenceDelta(ik sdkmetric.InstrumentKind) metricdata.Temporality {
 | 
			
		||||
	switch ik {
 | 
			
		||||
	case sdkmetric.InstrumentKindCounter, sdkmetric.InstrumentKindObservableCounter, sdkmetric.InstrumentKindHistogram:
 | 
			
		||||
		return metricdata.DeltaTemporality
 | 
			
		||||
	case sdkmetric.InstrumentKindObservableUpDownCounter, sdkmetric.InstrumentKindUpDownCounter:
 | 
			
		||||
		return metricdata.CumulativeTemporality
 | 
			
		||||
	default:
 | 
			
		||||
		return metricdata.DeltaTemporality
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func temporalityPreferenceLowMemory(ik sdkmetric.InstrumentKind) metricdata.Temporality {
 | 
			
		||||
	switch ik {
 | 
			
		||||
	case sdkmetric.InstrumentKindCounter, sdkmetric.InstrumentKindHistogram:
 | 
			
		||||
		return metricdata.DeltaTemporality
 | 
			
		||||
	case sdkmetric.InstrumentKindObservableCounter, sdkmetric.InstrumentKindObservableUpDownCounter, sdkmetric.InstrumentKindUpDownCounter:
 | 
			
		||||
		return metricdata.CumulativeTemporality
 | 
			
		||||
	default:
 | 
			
		||||
		return metricdata.DeltaTemporality
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,601 +0,0 @@
 | 
			
		|||
// Copyright The OpenTelemetry Authors
 | 
			
		||||
// SPDX-License-Identifier: Apache-2.0
 | 
			
		||||
 | 
			
		||||
package otelinit
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"context"
 | 
			
		||||
	"errors"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"net/url"
 | 
			
		||||
	"path/filepath"
 | 
			
		||||
	"reflect"
 | 
			
		||||
	"sync"
 | 
			
		||||
	"testing"
 | 
			
		||||
 | 
			
		||||
	"github.com/stretchr/testify/assert"
 | 
			
		||||
	"github.com/stretchr/testify/require"
 | 
			
		||||
	"go.opentelemetry.io/contrib/config"
 | 
			
		||||
	"go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc"
 | 
			
		||||
	"go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp"
 | 
			
		||||
	otelprom "go.opentelemetry.io/otel/exporters/prometheus"
 | 
			
		||||
	"go.opentelemetry.io/otel/exporters/stdout/stdoutmetric"
 | 
			
		||||
	sdkmetric "go.opentelemetry.io/otel/sdk/metric"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func strPtr(s string) *string {
 | 
			
		||||
	return &s
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func intPtr(i int) *int {
 | 
			
		||||
	return &i
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestMetricReader(t *testing.T) {
 | 
			
		||||
	consoleExporter, err := stdoutmetric.New(
 | 
			
		||||
		stdoutmetric.WithPrettyPrint(),
 | 
			
		||||
	)
 | 
			
		||||
	require.NoError(t, err)
 | 
			
		||||
	ctx := context.Background()
 | 
			
		||||
	otlpGRPCExporter, err := otlpmetricgrpc.New(ctx)
 | 
			
		||||
	require.NoError(t, err)
 | 
			
		||||
	otlpHTTPExporter, err := otlpmetrichttp.New(ctx)
 | 
			
		||||
	require.NoError(t, err)
 | 
			
		||||
	promExporter, err := otelprom.New()
 | 
			
		||||
	require.NoError(t, err)
 | 
			
		||||
 | 
			
		||||
	testCases := []struct {
 | 
			
		||||
		name       string
 | 
			
		||||
		reader     config.MetricReader
 | 
			
		||||
		args       any
 | 
			
		||||
		wantErr    error
 | 
			
		||||
		wantReader sdkmetric.Reader
 | 
			
		||||
	}{
 | 
			
		||||
		{
 | 
			
		||||
			name:    "noreader",
 | 
			
		||||
			wantErr: errors.New("unsupported metric reader type {<nil> <nil>}"),
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "pull prometheus invalid exporter",
 | 
			
		||||
			reader: config.MetricReader{
 | 
			
		||||
				Pull: &config.PullMetricReader{
 | 
			
		||||
					Exporter: config.MetricExporter{
 | 
			
		||||
						OTLP: &config.OTLPMetric{},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			wantErr: errNoValidMetricExporter,
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "pull/prometheus-invalid-config-no-host",
 | 
			
		||||
			reader: config.MetricReader{
 | 
			
		||||
				Pull: &config.PullMetricReader{
 | 
			
		||||
					Exporter: config.MetricExporter{
 | 
			
		||||
						Prometheus: &config.Prometheus{},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			wantErr: errors.New("host must be specified"),
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "pull/prometheus-invalid-config-no-port",
 | 
			
		||||
			reader: config.MetricReader{
 | 
			
		||||
				Pull: &config.PullMetricReader{
 | 
			
		||||
					Exporter: config.MetricExporter{
 | 
			
		||||
						Prometheus: &config.Prometheus{
 | 
			
		||||
							Host: strPtr("localhost"),
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			wantErr: errors.New("port must be specified"),
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "pull/prometheus-valid",
 | 
			
		||||
			reader: config.MetricReader{
 | 
			
		||||
				Pull: &config.PullMetricReader{
 | 
			
		||||
					Exporter: config.MetricExporter{
 | 
			
		||||
						Prometheus: &config.Prometheus{
 | 
			
		||||
							Host: strPtr("localhost"),
 | 
			
		||||
							Port: intPtr(8080),
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			wantReader: promExporter,
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "periodic/invalid-exporter",
 | 
			
		||||
			reader: config.MetricReader{
 | 
			
		||||
				Periodic: &config.PeriodicMetricReader{
 | 
			
		||||
					Exporter: config.MetricExporter{
 | 
			
		||||
						Prometheus: &config.Prometheus{
 | 
			
		||||
							Host: strPtr("localhost"),
 | 
			
		||||
							Port: intPtr(8080),
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			wantErr: errNoValidMetricExporter,
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "periodic/no-exporter",
 | 
			
		||||
			reader: config.MetricReader{
 | 
			
		||||
				Periodic: &config.PeriodicMetricReader{},
 | 
			
		||||
			},
 | 
			
		||||
			wantErr: errNoValidMetricExporter,
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "periodic/console-exporter",
 | 
			
		||||
			reader: config.MetricReader{
 | 
			
		||||
				Periodic: &config.PeriodicMetricReader{
 | 
			
		||||
					Exporter: config.MetricExporter{
 | 
			
		||||
						Console: config.Console{},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			wantReader: sdkmetric.NewPeriodicReader(consoleExporter),
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "periodic/console-exporter-with-timeout-interval",
 | 
			
		||||
			reader: config.MetricReader{
 | 
			
		||||
				Periodic: &config.PeriodicMetricReader{
 | 
			
		||||
					Interval: intPtr(10),
 | 
			
		||||
					Timeout:  intPtr(5),
 | 
			
		||||
					Exporter: config.MetricExporter{
 | 
			
		||||
						Console: config.Console{},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			wantReader: sdkmetric.NewPeriodicReader(consoleExporter),
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "periodic/otlp-exporter-invalid-protocol",
 | 
			
		||||
			reader: config.MetricReader{
 | 
			
		||||
				Periodic: &config.PeriodicMetricReader{
 | 
			
		||||
					Exporter: config.MetricExporter{
 | 
			
		||||
						OTLP: &config.OTLPMetric{
 | 
			
		||||
							Protocol: *strPtr("http/invalid"),
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			wantErr: errors.New("unsupported protocol http/invalid"),
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "periodic/otlp-grpc-exporter-no-endpoint",
 | 
			
		||||
			reader: config.MetricReader{
 | 
			
		||||
				Periodic: &config.PeriodicMetricReader{
 | 
			
		||||
					Exporter: config.MetricExporter{
 | 
			
		||||
						OTLP: &config.OTLPMetric{
 | 
			
		||||
							Protocol:    "grpc/protobuf",
 | 
			
		||||
							Compression: strPtr("gzip"),
 | 
			
		||||
							Timeout:     intPtr(1000),
 | 
			
		||||
							Headers: map[string]string{
 | 
			
		||||
								"test": "test1",
 | 
			
		||||
							},
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			wantReader: sdkmetric.NewPeriodicReader(otlpGRPCExporter),
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "periodic/otlp-grpc-exporter",
 | 
			
		||||
			reader: config.MetricReader{
 | 
			
		||||
				Periodic: &config.PeriodicMetricReader{
 | 
			
		||||
					Exporter: config.MetricExporter{
 | 
			
		||||
						OTLP: &config.OTLPMetric{
 | 
			
		||||
							Protocol:    "grpc/protobuf",
 | 
			
		||||
							Endpoint:    "http://localhost:4317",
 | 
			
		||||
							Compression: strPtr("none"),
 | 
			
		||||
							Timeout:     intPtr(1000),
 | 
			
		||||
							Headers: map[string]string{
 | 
			
		||||
								"test": "test1",
 | 
			
		||||
							},
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			wantReader: sdkmetric.NewPeriodicReader(otlpGRPCExporter),
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "periodic/otlp-grpc-exporter-no-scheme",
 | 
			
		||||
			reader: config.MetricReader{
 | 
			
		||||
				Periodic: &config.PeriodicMetricReader{
 | 
			
		||||
					Exporter: config.MetricExporter{
 | 
			
		||||
						OTLP: &config.OTLPMetric{
 | 
			
		||||
							Protocol:    "grpc/protobuf",
 | 
			
		||||
							Endpoint:    "localhost:4317",
 | 
			
		||||
							Compression: strPtr("gzip"),
 | 
			
		||||
							Timeout:     intPtr(1000),
 | 
			
		||||
							Headers: map[string]string{
 | 
			
		||||
								"test": "test1",
 | 
			
		||||
							},
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			wantReader: sdkmetric.NewPeriodicReader(otlpGRPCExporter),
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "periodic/otlp-grpc-invalid-endpoint",
 | 
			
		||||
			reader: config.MetricReader{
 | 
			
		||||
				Periodic: &config.PeriodicMetricReader{
 | 
			
		||||
					Exporter: config.MetricExporter{
 | 
			
		||||
						OTLP: &config.OTLPMetric{
 | 
			
		||||
							Protocol:    "grpc/protobuf",
 | 
			
		||||
							Endpoint:    " ",
 | 
			
		||||
							Compression: strPtr("gzip"),
 | 
			
		||||
							Timeout:     intPtr(1000),
 | 
			
		||||
							Headers: map[string]string{
 | 
			
		||||
								"test": "test1",
 | 
			
		||||
							},
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			wantErr: &url.Error{Op: "parse", URL: "http:// ", Err: url.InvalidHostError(" ")},
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "periodic/otlp-grpc-invalid-compression",
 | 
			
		||||
			reader: config.MetricReader{
 | 
			
		||||
				Periodic: &config.PeriodicMetricReader{
 | 
			
		||||
					Exporter: config.MetricExporter{
 | 
			
		||||
						OTLP: &config.OTLPMetric{
 | 
			
		||||
							Protocol:    "grpc/protobuf",
 | 
			
		||||
							Endpoint:    "localhost:4317",
 | 
			
		||||
							Compression: strPtr("invalid"),
 | 
			
		||||
							Timeout:     intPtr(1000),
 | 
			
		||||
							Headers: map[string]string{
 | 
			
		||||
								"test": "test1",
 | 
			
		||||
							},
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			wantErr: errors.New("unsupported compression \"invalid\""),
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "periodic/otlp-grpc-delta-temporality",
 | 
			
		||||
			reader: config.MetricReader{
 | 
			
		||||
				Periodic: &config.PeriodicMetricReader{
 | 
			
		||||
					Exporter: config.MetricExporter{
 | 
			
		||||
						OTLP: &config.OTLPMetric{
 | 
			
		||||
							Protocol:    "grpc/protobuf",
 | 
			
		||||
							Endpoint:    "localhost:4318",
 | 
			
		||||
							Compression: strPtr("none"),
 | 
			
		||||
							Timeout:     intPtr(1000),
 | 
			
		||||
							Headers: map[string]string{
 | 
			
		||||
								"test": "test1",
 | 
			
		||||
							},
 | 
			
		||||
							TemporalityPreference: strPtr("delta"),
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			wantReader: sdkmetric.NewPeriodicReader(otlpGRPCExporter),
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "periodic/otlp-grpc-cumulative-temporality",
 | 
			
		||||
			reader: config.MetricReader{
 | 
			
		||||
				Periodic: &config.PeriodicMetricReader{
 | 
			
		||||
					Exporter: config.MetricExporter{
 | 
			
		||||
						OTLP: &config.OTLPMetric{
 | 
			
		||||
							Protocol:    "grpc/protobuf",
 | 
			
		||||
							Endpoint:    "localhost:4318",
 | 
			
		||||
							Compression: strPtr("none"),
 | 
			
		||||
							Timeout:     intPtr(1000),
 | 
			
		||||
							Headers: map[string]string{
 | 
			
		||||
								"test": "test1",
 | 
			
		||||
							},
 | 
			
		||||
							TemporalityPreference: strPtr("cumulative"),
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			wantReader: sdkmetric.NewPeriodicReader(otlpGRPCExporter),
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "periodic/otlp-grpc-lowmemory-temporality",
 | 
			
		||||
			reader: config.MetricReader{
 | 
			
		||||
				Periodic: &config.PeriodicMetricReader{
 | 
			
		||||
					Exporter: config.MetricExporter{
 | 
			
		||||
						OTLP: &config.OTLPMetric{
 | 
			
		||||
							Protocol:    "grpc/protobuf",
 | 
			
		||||
							Endpoint:    "localhost:4318",
 | 
			
		||||
							Compression: strPtr("none"),
 | 
			
		||||
							Timeout:     intPtr(1000),
 | 
			
		||||
							Headers: map[string]string{
 | 
			
		||||
								"test": "test1",
 | 
			
		||||
							},
 | 
			
		||||
							TemporalityPreference: strPtr("lowmemory"),
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			wantReader: sdkmetric.NewPeriodicReader(otlpGRPCExporter),
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "periodic/otlp-grpc-invalid-temporality",
 | 
			
		||||
			reader: config.MetricReader{
 | 
			
		||||
				Periodic: &config.PeriodicMetricReader{
 | 
			
		||||
					Exporter: config.MetricExporter{
 | 
			
		||||
						OTLP: &config.OTLPMetric{
 | 
			
		||||
							Protocol:    "grpc/protobuf",
 | 
			
		||||
							Endpoint:    "localhost:4318",
 | 
			
		||||
							Compression: strPtr("none"),
 | 
			
		||||
							Timeout:     intPtr(1000),
 | 
			
		||||
							Headers: map[string]string{
 | 
			
		||||
								"test": "test1",
 | 
			
		||||
							},
 | 
			
		||||
							TemporalityPreference: strPtr("invalid"),
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			wantErr: errors.New("unsupported temporality preference \"invalid\""),
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "periodic/otlp-http-exporter",
 | 
			
		||||
			reader: config.MetricReader{
 | 
			
		||||
				Periodic: &config.PeriodicMetricReader{
 | 
			
		||||
					Exporter: config.MetricExporter{
 | 
			
		||||
						OTLP: &config.OTLPMetric{
 | 
			
		||||
							Protocol:    "http/protobuf",
 | 
			
		||||
							Endpoint:    "http://localhost:4318",
 | 
			
		||||
							Compression: strPtr("gzip"),
 | 
			
		||||
							Timeout:     intPtr(1000),
 | 
			
		||||
							Headers: map[string]string{
 | 
			
		||||
								"test": "test1",
 | 
			
		||||
							},
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			wantReader: sdkmetric.NewPeriodicReader(otlpHTTPExporter),
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "periodic/otlp-http-exporter-with-path",
 | 
			
		||||
			reader: config.MetricReader{
 | 
			
		||||
				Periodic: &config.PeriodicMetricReader{
 | 
			
		||||
					Exporter: config.MetricExporter{
 | 
			
		||||
						OTLP: &config.OTLPMetric{
 | 
			
		||||
							Protocol:    "http/protobuf",
 | 
			
		||||
							Endpoint:    "http://localhost:4318/path/123",
 | 
			
		||||
							Compression: strPtr("none"),
 | 
			
		||||
							Timeout:     intPtr(1000),
 | 
			
		||||
							Headers: map[string]string{
 | 
			
		||||
								"test": "test1",
 | 
			
		||||
							},
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			wantReader: sdkmetric.NewPeriodicReader(otlpHTTPExporter),
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "periodic/otlp-http-exporter-no-endpoint",
 | 
			
		||||
			reader: config.MetricReader{
 | 
			
		||||
				Periodic: &config.PeriodicMetricReader{
 | 
			
		||||
					Exporter: config.MetricExporter{
 | 
			
		||||
						OTLP: &config.OTLPMetric{
 | 
			
		||||
							Protocol:    "http/protobuf",
 | 
			
		||||
							Compression: strPtr("gzip"),
 | 
			
		||||
							Timeout:     intPtr(1000),
 | 
			
		||||
							Headers: map[string]string{
 | 
			
		||||
								"test": "test1",
 | 
			
		||||
							},
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			wantReader: sdkmetric.NewPeriodicReader(otlpHTTPExporter),
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "periodic/otlp-http-exporter-no-scheme",
 | 
			
		||||
			reader: config.MetricReader{
 | 
			
		||||
				Periodic: &config.PeriodicMetricReader{
 | 
			
		||||
					Exporter: config.MetricExporter{
 | 
			
		||||
						OTLP: &config.OTLPMetric{
 | 
			
		||||
							Protocol:    "http/protobuf",
 | 
			
		||||
							Endpoint:    "localhost:4318",
 | 
			
		||||
							Compression: strPtr("gzip"),
 | 
			
		||||
							Timeout:     intPtr(1000),
 | 
			
		||||
							Headers: map[string]string{
 | 
			
		||||
								"test": "test1",
 | 
			
		||||
							},
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			wantReader: sdkmetric.NewPeriodicReader(otlpHTTPExporter),
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "periodic/otlp-http-invalid-endpoint",
 | 
			
		||||
			reader: config.MetricReader{
 | 
			
		||||
				Periodic: &config.PeriodicMetricReader{
 | 
			
		||||
					Exporter: config.MetricExporter{
 | 
			
		||||
						OTLP: &config.OTLPMetric{
 | 
			
		||||
							Protocol:    "http/protobuf",
 | 
			
		||||
							Endpoint:    " ",
 | 
			
		||||
							Compression: strPtr("gzip"),
 | 
			
		||||
							Timeout:     intPtr(1000),
 | 
			
		||||
							Headers: map[string]string{
 | 
			
		||||
								"test": "test1",
 | 
			
		||||
							},
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			wantErr: &url.Error{Op: "parse", URL: "http:// ", Err: url.InvalidHostError(" ")},
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "periodic/otlp-http-invalid-compression",
 | 
			
		||||
			reader: config.MetricReader{
 | 
			
		||||
				Periodic: &config.PeriodicMetricReader{
 | 
			
		||||
					Exporter: config.MetricExporter{
 | 
			
		||||
						OTLP: &config.OTLPMetric{
 | 
			
		||||
							Protocol:    "http/protobuf",
 | 
			
		||||
							Endpoint:    "localhost:4318",
 | 
			
		||||
							Compression: strPtr("invalid"),
 | 
			
		||||
							Timeout:     intPtr(1000),
 | 
			
		||||
							Headers: map[string]string{
 | 
			
		||||
								"test": "test1",
 | 
			
		||||
							},
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			wantErr: errors.New("unsupported compression \"invalid\""),
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "periodic/otlp-http-cumulative-temporality",
 | 
			
		||||
			reader: config.MetricReader{
 | 
			
		||||
				Periodic: &config.PeriodicMetricReader{
 | 
			
		||||
					Exporter: config.MetricExporter{
 | 
			
		||||
						OTLP: &config.OTLPMetric{
 | 
			
		||||
							Protocol:    "http/protobuf",
 | 
			
		||||
							Endpoint:    "localhost:4318",
 | 
			
		||||
							Compression: strPtr("none"),
 | 
			
		||||
							Timeout:     intPtr(1000),
 | 
			
		||||
							Headers: map[string]string{
 | 
			
		||||
								"test": "test1",
 | 
			
		||||
							},
 | 
			
		||||
							TemporalityPreference: strPtr("cumulative"),
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			wantReader: sdkmetric.NewPeriodicReader(otlpHTTPExporter),
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "periodic/otlp-http-lowmemory-temporality",
 | 
			
		||||
			reader: config.MetricReader{
 | 
			
		||||
				Periodic: &config.PeriodicMetricReader{
 | 
			
		||||
					Exporter: config.MetricExporter{
 | 
			
		||||
						OTLP: &config.OTLPMetric{
 | 
			
		||||
							Protocol:    "http/protobuf",
 | 
			
		||||
							Endpoint:    "localhost:4318",
 | 
			
		||||
							Compression: strPtr("none"),
 | 
			
		||||
							Timeout:     intPtr(1000),
 | 
			
		||||
							Headers: map[string]string{
 | 
			
		||||
								"test": "test1",
 | 
			
		||||
							},
 | 
			
		||||
							TemporalityPreference: strPtr("lowmemory"),
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			wantReader: sdkmetric.NewPeriodicReader(otlpHTTPExporter),
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "periodic/otlp-http-delta-temporality",
 | 
			
		||||
			reader: config.MetricReader{
 | 
			
		||||
				Periodic: &config.PeriodicMetricReader{
 | 
			
		||||
					Exporter: config.MetricExporter{
 | 
			
		||||
						OTLP: &config.OTLPMetric{
 | 
			
		||||
							Protocol:    "http/protobuf",
 | 
			
		||||
							Endpoint:    "localhost:4318",
 | 
			
		||||
							Compression: strPtr("none"),
 | 
			
		||||
							Timeout:     intPtr(1000),
 | 
			
		||||
							Headers: map[string]string{
 | 
			
		||||
								"test": "test1",
 | 
			
		||||
							},
 | 
			
		||||
							TemporalityPreference: strPtr("delta"),
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			wantReader: sdkmetric.NewPeriodicReader(otlpHTTPExporter),
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "periodic/otlp-http-invalid-temporality",
 | 
			
		||||
			reader: config.MetricReader{
 | 
			
		||||
				Periodic: &config.PeriodicMetricReader{
 | 
			
		||||
					Exporter: config.MetricExporter{
 | 
			
		||||
						OTLP: &config.OTLPMetric{
 | 
			
		||||
							Protocol:    "http/protobuf",
 | 
			
		||||
							Endpoint:    "localhost:4318",
 | 
			
		||||
							Compression: strPtr("none"),
 | 
			
		||||
							Timeout:     intPtr(1000),
 | 
			
		||||
							Headers: map[string]string{
 | 
			
		||||
								"test": "test1",
 | 
			
		||||
							},
 | 
			
		||||
							TemporalityPreference: strPtr("invalid"),
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			wantErr: errors.New("unsupported temporality preference \"invalid\""),
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "periodic/otlp-grpc-good-ca-certificate",
 | 
			
		||||
			reader: config.MetricReader{
 | 
			
		||||
				Periodic: &config.PeriodicMetricReader{
 | 
			
		||||
					Exporter: config.MetricExporter{
 | 
			
		||||
						OTLP: &config.OTLPMetric{
 | 
			
		||||
							Protocol:    "grpc/protobuf",
 | 
			
		||||
							Endpoint:    "https://localhost:4317",
 | 
			
		||||
							Compression: strPtr("gzip"),
 | 
			
		||||
							Timeout:     intPtr(1000),
 | 
			
		||||
							Certificate: strPtr(filepath.Join("testdata", "ca.crt")),
 | 
			
		||||
							Headers: map[string]string{
 | 
			
		||||
								"test": "test1",
 | 
			
		||||
							},
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			wantReader: sdkmetric.NewPeriodicReader(otlpGRPCExporter),
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "periodic/otlp-grpc-bad-ca-certificate",
 | 
			
		||||
			reader: config.MetricReader{
 | 
			
		||||
				Periodic: &config.PeriodicMetricReader{
 | 
			
		||||
					Exporter: config.MetricExporter{
 | 
			
		||||
						OTLP: &config.OTLPMetric{
 | 
			
		||||
							Protocol:    "grpc/protobuf",
 | 
			
		||||
							Endpoint:    "https://localhost:4317",
 | 
			
		||||
							Compression: strPtr("gzip"),
 | 
			
		||||
							Timeout:     intPtr(1000),
 | 
			
		||||
							Certificate: strPtr(filepath.Join("testdata", "bad_cert.crt")),
 | 
			
		||||
							Headers: map[string]string{
 | 
			
		||||
								"test": "test1",
 | 
			
		||||
							},
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			wantErr: fmt.Errorf("could not create client tls credentials: %w", errors.New("credentials: failed to append certificates")),
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
	for _, tt := range testCases {
 | 
			
		||||
		t.Run(tt.name, func(t *testing.T) {
 | 
			
		||||
			gotReader, server, err := InitMetricReader(context.Background(), tt.reader, make(chan error), &sync.WaitGroup{})
 | 
			
		||||
 | 
			
		||||
			defer func() {
 | 
			
		||||
				if gotReader != nil {
 | 
			
		||||
					require.NoError(t, gotReader.Shutdown(context.Background()))
 | 
			
		||||
				}
 | 
			
		||||
				if server != nil {
 | 
			
		||||
					assert.NoError(t, server.Shutdown(context.Background()))
 | 
			
		||||
				}
 | 
			
		||||
			}()
 | 
			
		||||
 | 
			
		||||
			assert.Equal(t, tt.wantErr, err)
 | 
			
		||||
 | 
			
		||||
			if tt.wantReader == nil {
 | 
			
		||||
				assert.Nil(t, gotReader)
 | 
			
		||||
			} else {
 | 
			
		||||
				assert.Equal(t, reflect.TypeOf(tt.wantReader), reflect.TypeOf(gotReader))
 | 
			
		||||
 | 
			
		||||
				if reflect.TypeOf(tt.wantReader).String() == "*metric.PeriodicReader" {
 | 
			
		||||
					wantExporterType := reflect.Indirect(reflect.ValueOf(tt.wantReader)).FieldByName("exporter").Elem().Type()
 | 
			
		||||
					gotExporterType := reflect.Indirect(reflect.ValueOf(gotReader)).FieldByName("exporter").Elem().Type()
 | 
			
		||||
					assert.Equal(t, wantExporterType, gotExporterType)
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -10,7 +10,7 @@ import (
 | 
			
		|||
	"testing"
 | 
			
		||||
 | 
			
		||||
	"github.com/stretchr/testify/require"
 | 
			
		||||
	"go.opentelemetry.io/contrib/config"
 | 
			
		||||
	config "go.opentelemetry.io/contrib/config/v0.3.0"
 | 
			
		||||
	"go.uber.org/zap/zapcore"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,179 +4,22 @@
 | 
			
		|||
package telemetry // import "go.opentelemetry.io/collector/service/telemetry"
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"context"
 | 
			
		||||
	"net/http"
 | 
			
		||||
	"sync"
 | 
			
		||||
	"errors"
 | 
			
		||||
 | 
			
		||||
	"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
 | 
			
		||||
	"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
 | 
			
		||||
	"go.opentelemetry.io/otel/metric"
 | 
			
		||||
	"go.opentelemetry.io/otel/metric/noop"
 | 
			
		||||
	"go.opentelemetry.io/otel/sdk/instrumentation"
 | 
			
		||||
	sdkmetric "go.opentelemetry.io/otel/sdk/metric"
 | 
			
		||||
	"go.opentelemetry.io/otel/sdk/resource"
 | 
			
		||||
	"go.uber.org/multierr"
 | 
			
		||||
	"go.uber.org/zap"
 | 
			
		||||
 | 
			
		||||
	"go.opentelemetry.io/collector/config/configtelemetry"
 | 
			
		||||
	"go.opentelemetry.io/collector/service/telemetry/internal/otelinit"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	zapKeyTelemetryAddress = "address"
 | 
			
		||||
	zapKeyTelemetryLevel   = "metrics level"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type meterProvider struct {
 | 
			
		||||
	*sdkmetric.MeterProvider
 | 
			
		||||
	servers  []*http.Server
 | 
			
		||||
	serverWG sync.WaitGroup
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type meterProviderSettings struct {
 | 
			
		||||
	res               *resource.Resource
 | 
			
		||||
	cfg               MetricsConfig
 | 
			
		||||
	asyncErrorChannel chan error
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func dropViewOption(instrument sdkmetric.Instrument) sdkmetric.Option {
 | 
			
		||||
	return sdkmetric.WithView(sdkmetric.NewView(
 | 
			
		||||
		instrument,
 | 
			
		||||
		sdkmetric.Stream{
 | 
			
		||||
			Aggregation: sdkmetric.AggregationDrop{},
 | 
			
		||||
		},
 | 
			
		||||
	))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// newMeterProvider creates a new MeterProvider from Config.
 | 
			
		||||
func newMeterProvider(set meterProviderSettings, disableHighCardinality bool) (metric.MeterProvider, error) {
 | 
			
		||||
	if set.cfg.Level == configtelemetry.LevelNone || len(set.cfg.Readers) == 0 {
 | 
			
		||||
func newMeterProvider(set Settings, cfg Config) (metric.MeterProvider, error) {
 | 
			
		||||
	if cfg.Metrics.Level == configtelemetry.LevelNone || len(cfg.Metrics.Readers) == 0 {
 | 
			
		||||
		return noop.NewMeterProvider(), nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	mp := &meterProvider{}
 | 
			
		||||
	var opts []sdkmetric.Option
 | 
			
		||||
	for _, reader := range set.cfg.Readers {
 | 
			
		||||
		// https://github.com/open-telemetry/opentelemetry-collector/issues/8045
 | 
			
		||||
		r, server, err := otelinit.InitMetricReader(context.Background(), reader, set.asyncErrorChannel, &mp.serverWG)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return nil, err
 | 
			
		||||
	if set.SDK != nil {
 | 
			
		||||
		return set.SDK.MeterProvider(), nil
 | 
			
		||||
	}
 | 
			
		||||
		if server != nil {
 | 
			
		||||
			mp.servers = append(mp.servers, server)
 | 
			
		||||
		}
 | 
			
		||||
		opts = append(opts, sdkmetric.WithReader(r))
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if set.cfg.Level < configtelemetry.LevelDetailed {
 | 
			
		||||
		// Drop all otelhttp and otelgrpc metrics if the level is not detailed.
 | 
			
		||||
		opts = append(opts,
 | 
			
		||||
			dropViewOption(sdkmetric.Instrument{
 | 
			
		||||
				Scope: instrumentation.Scope{Name: otelhttp.ScopeName},
 | 
			
		||||
			}),
 | 
			
		||||
			dropViewOption(sdkmetric.Instrument{
 | 
			
		||||
				Scope: instrumentation.Scope{Name: otelgrpc.ScopeName},
 | 
			
		||||
			}),
 | 
			
		||||
		)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// otel-arrow library metrics
 | 
			
		||||
	// See https://github.com/open-telemetry/otel-arrow/blob/c39257/pkg/otel/arrow_record/consumer.go#L174-L176
 | 
			
		||||
	if set.cfg.Level < configtelemetry.LevelNormal {
 | 
			
		||||
		scope := instrumentation.Scope{Name: "otel-arrow/pkg/otel/arrow_record"}
 | 
			
		||||
		opts = append(opts,
 | 
			
		||||
			dropViewOption(sdkmetric.Instrument{
 | 
			
		||||
				Name:  "arrow_batch_records",
 | 
			
		||||
				Scope: scope,
 | 
			
		||||
			}),
 | 
			
		||||
			dropViewOption(sdkmetric.Instrument{
 | 
			
		||||
				Name:  "arrow_schema_resets",
 | 
			
		||||
				Scope: scope,
 | 
			
		||||
			}),
 | 
			
		||||
			dropViewOption(sdkmetric.Instrument{
 | 
			
		||||
				Name:  "arrow_memory_inuse",
 | 
			
		||||
				Scope: scope,
 | 
			
		||||
			}),
 | 
			
		||||
		)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// contrib's internal/otelarrow/netstats metrics
 | 
			
		||||
	// See
 | 
			
		||||
	// - https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/a25f05/internal/otelarrow/netstats/netstats.go#L130
 | 
			
		||||
	// - https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/a25f05/internal/otelarrow/netstats/netstats.go#L165
 | 
			
		||||
	if set.cfg.Level < configtelemetry.LevelDetailed {
 | 
			
		||||
		scope := instrumentation.Scope{Name: "github.com/open-telemetry/opentelemetry-collector-contrib/internal/otelarrow/netstats"}
 | 
			
		||||
		// Compressed size metrics.
 | 
			
		||||
		opts = append(opts, dropViewOption(sdkmetric.Instrument{
 | 
			
		||||
			Name:  "otelcol_*_compressed_size",
 | 
			
		||||
			Scope: scope,
 | 
			
		||||
		}))
 | 
			
		||||
 | 
			
		||||
		opts = append(opts, dropViewOption(sdkmetric.Instrument{
 | 
			
		||||
			Name:  "otelcol_*_compressed_size",
 | 
			
		||||
			Scope: scope,
 | 
			
		||||
		}))
 | 
			
		||||
 | 
			
		||||
		// makeRecvMetrics for exporters.
 | 
			
		||||
		opts = append(opts, dropViewOption(sdkmetric.Instrument{
 | 
			
		||||
			Name:  "otelcol_exporter_recv",
 | 
			
		||||
			Scope: scope,
 | 
			
		||||
		}))
 | 
			
		||||
		opts = append(opts, dropViewOption(sdkmetric.Instrument{
 | 
			
		||||
			Name:  "otelcol_exporter_recv_wire",
 | 
			
		||||
			Scope: scope,
 | 
			
		||||
		}))
 | 
			
		||||
 | 
			
		||||
		// makeSentMetrics for receivers.
 | 
			
		||||
		opts = append(opts, dropViewOption(sdkmetric.Instrument{
 | 
			
		||||
			Name:  "otelcol_receiver_sent",
 | 
			
		||||
			Scope: scope,
 | 
			
		||||
		}))
 | 
			
		||||
		opts = append(opts, dropViewOption(sdkmetric.Instrument{
 | 
			
		||||
			Name:  "otelcol_receiver_sent_wire",
 | 
			
		||||
			Scope: scope,
 | 
			
		||||
		}))
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Batch processor metrics
 | 
			
		||||
	if set.cfg.Level < configtelemetry.LevelDetailed {
 | 
			
		||||
		scope := instrumentation.Scope{Name: "go.opentelemetry.io/collector/processor/batchprocessor"}
 | 
			
		||||
		opts = append(opts, dropViewOption(sdkmetric.Instrument{
 | 
			
		||||
			Name:  "otelcol_processor_batch_batch_send_size_bytes",
 | 
			
		||||
			Scope: scope,
 | 
			
		||||
		}))
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	var err error
 | 
			
		||||
	mp.MeterProvider, err = otelinit.InitOpenTelemetry(set.res, opts, disableHighCardinality)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	return mp, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// LogAboutServers logs about the servers that are serving metrics.
 | 
			
		||||
func (mp *meterProvider) LogAboutServers(logger *zap.Logger, cfg MetricsConfig) {
 | 
			
		||||
	for _, server := range mp.servers {
 | 
			
		||||
		logger.Info(
 | 
			
		||||
			"Serving metrics",
 | 
			
		||||
			zap.String(zapKeyTelemetryAddress, server.Addr),
 | 
			
		||||
			zap.Stringer(zapKeyTelemetryLevel, cfg.Level),
 | 
			
		||||
		)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Shutdown the meter provider and all the associated resources.
 | 
			
		||||
// The type signature of this method matches that of the sdkmetric.MeterProvider.
 | 
			
		||||
func (mp *meterProvider) Shutdown(ctx context.Context) error {
 | 
			
		||||
	var errs error
 | 
			
		||||
	for _, server := range mp.servers {
 | 
			
		||||
		if server != nil {
 | 
			
		||||
			errs = multierr.Append(errs, server.Close())
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	errs = multierr.Append(errs, mp.MeterProvider.Shutdown(ctx))
 | 
			
		||||
	mp.serverWG.Wait()
 | 
			
		||||
 | 
			
		||||
	return errs
 | 
			
		||||
	return nil, errors.New("no sdk set")
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -14,16 +14,13 @@ import (
 | 
			
		|||
	"github.com/prometheus/common/expfmt"
 | 
			
		||||
	"github.com/stretchr/testify/assert"
 | 
			
		||||
	"github.com/stretchr/testify/require"
 | 
			
		||||
	"go.opentelemetry.io/contrib/config"
 | 
			
		||||
	config "go.opentelemetry.io/contrib/config/v0.3.0"
 | 
			
		||||
	"go.opentelemetry.io/otel/attribute"
 | 
			
		||||
	"go.opentelemetry.io/otel/metric"
 | 
			
		||||
	sdkresource "go.opentelemetry.io/otel/sdk/resource"
 | 
			
		||||
 | 
			
		||||
	"go.opentelemetry.io/collector/component"
 | 
			
		||||
	"go.opentelemetry.io/collector/config/configtelemetry"
 | 
			
		||||
	semconv "go.opentelemetry.io/collector/semconv/v1.18.0"
 | 
			
		||||
	"go.opentelemetry.io/collector/service/internal/promtest"
 | 
			
		||||
	"go.opentelemetry.io/collector/service/internal/resource"
 | 
			
		||||
	"go.opentelemetry.io/collector/service/telemetry/internal/otelinit"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
| 
						 | 
				
			
			@ -44,7 +41,6 @@ func TestTelemetryInit(t *testing.T) {
 | 
			
		|||
 | 
			
		||||
	for _, tt := range []struct {
 | 
			
		||||
		name            string
 | 
			
		||||
		disableHighCard bool
 | 
			
		||||
		expectedMetrics map[string]metricValue
 | 
			
		||||
	}{
 | 
			
		||||
		{
 | 
			
		||||
| 
						 | 
				
			
			@ -87,42 +83,10 @@ func TestTelemetryInit(t *testing.T) {
 | 
			
		|||
						"service_instance_id": testInstanceID,
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name:            "DisableHighCardinalityWithOtel",
 | 
			
		||||
			disableHighCard: true,
 | 
			
		||||
			expectedMetrics: map[string]metricValue{
 | 
			
		||||
				metricPrefix + otelPrefix + counterName: {
 | 
			
		||||
					value: 13,
 | 
			
		||||
					labels: map[string]string{
 | 
			
		||||
						"service_name":        "otelcol",
 | 
			
		||||
						"service_version":     "latest",
 | 
			
		||||
						"service_instance_id": testInstanceID,
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
				metricPrefix + grpcPrefix + counterName: {
 | 
			
		||||
					value: 11,
 | 
			
		||||
					labels: map[string]string{
 | 
			
		||||
						"service_name":        "otelcol",
 | 
			
		||||
						"service_version":     "latest",
 | 
			
		||||
						"service_instance_id": testInstanceID,
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
				metricPrefix + httpPrefix + counterName: {
 | 
			
		||||
					value: 10,
 | 
			
		||||
					labels: map[string]string{
 | 
			
		||||
						"service_name":        "otelcol",
 | 
			
		||||
						"service_version":     "latest",
 | 
			
		||||
						"service_instance_id": testInstanceID,
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
				"target_info": {
 | 
			
		||||
				"promhttp_metric_handler_errors_total": {
 | 
			
		||||
					value: 0,
 | 
			
		||||
					labels: map[string]string{
 | 
			
		||||
						"service_name":        "otelcol",
 | 
			
		||||
						"service_version":     "latest",
 | 
			
		||||
						"service_instance_id": testInstanceID,
 | 
			
		||||
						"cause": "encoding",
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
| 
						 | 
				
			
			@ -130,35 +94,36 @@ func TestTelemetryInit(t *testing.T) {
 | 
			
		|||
	} {
 | 
			
		||||
		prom := promtest.GetAvailableLocalAddressPrometheus(t)
 | 
			
		||||
		endpoint := fmt.Sprintf("http://%s:%d/metrics", *prom.Host, *prom.Port)
 | 
			
		||||
		t.Run(tt.name, func(t *testing.T) {
 | 
			
		||||
			cfg := &Config{
 | 
			
		||||
		cfg := Config{
 | 
			
		||||
			Metrics: MetricsConfig{
 | 
			
		||||
				Level: configtelemetry.LevelDetailed,
 | 
			
		||||
				Readers: []config.MetricReader{{
 | 
			
		||||
						Pull: &config.PullMetricReader{Exporter: config.MetricExporter{Prometheus: prom}},
 | 
			
		||||
					Pull: &config.PullMetricReader{
 | 
			
		||||
						Exporter: config.PullMetricExporter{Prometheus: prom},
 | 
			
		||||
					},
 | 
			
		||||
				}},
 | 
			
		||||
			},
 | 
			
		||||
				Traces: TracesConfig{
 | 
			
		||||
					Processors: []config.SpanProcessor{
 | 
			
		||||
						{
 | 
			
		||||
							Batch: &config.BatchSpanProcessor{
 | 
			
		||||
								Exporter: config.SpanExporter{
 | 
			
		||||
									Console: config.Console{},
 | 
			
		||||
								},
 | 
			
		||||
							},
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
				Resource: map[string]*string{
 | 
			
		||||
					semconv.AttributeServiceInstanceID: &testInstanceID,
 | 
			
		||||
				},
 | 
			
		||||
		}
 | 
			
		||||
			set := meterProviderSettings{
 | 
			
		||||
				res:               resource.New(component.NewDefaultBuildInfo(), cfg.Resource),
 | 
			
		||||
				cfg:               cfg.Metrics,
 | 
			
		||||
				asyncErrorChannel: make(chan error),
 | 
			
		||||
			}
 | 
			
		||||
			mp, err := newMeterProvider(set, tt.disableHighCard)
 | 
			
		||||
		t.Run(tt.name, func(t *testing.T) {
 | 
			
		||||
			sdk, err := config.NewSDK(
 | 
			
		||||
				config.WithContext(context.Background()),
 | 
			
		||||
				config.WithOpenTelemetryConfiguration(config.OpenTelemetryConfiguration{
 | 
			
		||||
					MeterProvider: &config.MeterProvider{
 | 
			
		||||
						Readers: cfg.Metrics.Readers,
 | 
			
		||||
					},
 | 
			
		||||
					Resource: &config.Resource{
 | 
			
		||||
						SchemaUrl: ptr(""),
 | 
			
		||||
						Attributes: []config.AttributeNameValue{
 | 
			
		||||
							{Name: semconv.AttributeServiceInstanceID, Value: testInstanceID},
 | 
			
		||||
							{Name: semconv.AttributeServiceName, Value: "otelcol"},
 | 
			
		||||
							{Name: semconv.AttributeServiceVersion, Value: "latest"},
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
				}),
 | 
			
		||||
			)
 | 
			
		||||
			require.NoError(t, err)
 | 
			
		||||
 | 
			
		||||
			mp, err := newMeterProvider(Settings{SDK: &sdk}, cfg)
 | 
			
		||||
			require.NoError(t, err)
 | 
			
		||||
			defer func() {
 | 
			
		||||
				if prov, ok := mp.(interface{ Shutdown(context.Context) error }); ok {
 | 
			
		||||
| 
						 | 
				
			
			@ -169,11 +134,14 @@ func TestTelemetryInit(t *testing.T) {
 | 
			
		|||
			createTestMetrics(t, mp)
 | 
			
		||||
 | 
			
		||||
			metrics := getMetricsFromPrometheus(t, endpoint)
 | 
			
		||||
			require.Equal(t, len(tt.expectedMetrics), len(metrics))
 | 
			
		||||
			require.Len(t, metrics, len(tt.expectedMetrics))
 | 
			
		||||
 | 
			
		||||
			for metricName, metricValue := range tt.expectedMetrics {
 | 
			
		||||
				mf, present := metrics[metricName]
 | 
			
		||||
				require.True(t, present, "expected metric %q was not present", metricName)
 | 
			
		||||
				if metricName == "promhttp_metric_handler_errors_total" {
 | 
			
		||||
					continue
 | 
			
		||||
				}
 | 
			
		||||
				require.Len(t, mf.Metric, 1, "only one measure should exist for metric %q", metricName)
 | 
			
		||||
 | 
			
		||||
				labels := make(map[string]string)
 | 
			
		||||
| 
						 | 
				
			
			@ -194,13 +162,20 @@ func createTestMetrics(t *testing.T, mp metric.MeterProvider) {
 | 
			
		|||
	require.NoError(t, err)
 | 
			
		||||
	counter.Add(context.Background(), 13)
 | 
			
		||||
 | 
			
		||||
	grpcExampleCounter, err := mp.Meter(otelinit.GRPCInstrumentation).Int64Counter(metricPrefix + grpcPrefix + counterName)
 | 
			
		||||
	grpcExampleCounter, err := mp.Meter("go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc").Int64Counter(metricPrefix + grpcPrefix + counterName)
 | 
			
		||||
	require.NoError(t, err)
 | 
			
		||||
	grpcExampleCounter.Add(context.Background(), 11, metric.WithAttributeSet(otelinit.GRPCUnacceptableKeyValues))
 | 
			
		||||
	grpcExampleCounter.Add(context.Background(), 11, metric.WithAttributeSet(attribute.NewSet(
 | 
			
		||||
		attribute.String(semconv.AttributeNetSockPeerAddr, ""),
 | 
			
		||||
		attribute.String(semconv.AttributeNetSockPeerPort, ""),
 | 
			
		||||
		attribute.String(semconv.AttributeNetSockPeerName, ""),
 | 
			
		||||
	)))
 | 
			
		||||
 | 
			
		||||
	httpExampleCounter, err := mp.Meter(otelinit.HTTPInstrumentation).Int64Counter(metricPrefix + httpPrefix + counterName)
 | 
			
		||||
	httpExampleCounter, err := mp.Meter("go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp").Int64Counter(metricPrefix + httpPrefix + counterName)
 | 
			
		||||
	require.NoError(t, err)
 | 
			
		||||
	httpExampleCounter.Add(context.Background(), 10, metric.WithAttributeSet(otelinit.HTTPUnacceptableKeyValues))
 | 
			
		||||
	httpExampleCounter.Add(context.Background(), 10, metric.WithAttributeSet(attribute.NewSet(
 | 
			
		||||
		attribute.String(semconv.AttributeNetHostName, ""),
 | 
			
		||||
		attribute.String(semconv.AttributeNetHostPort, ""),
 | 
			
		||||
	)))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func getMetricsFromPrometheus(t *testing.T, endpoint string) map[string]*io_prometheus_client.MetricFamily {
 | 
			
		||||
| 
						 | 
				
			
			@ -239,17 +214,32 @@ func getMetricsFromPrometheus(t *testing.T, endpoint string) map[string]*io_prom
 | 
			
		|||
// See https://pkg.go.dev/go.opentelemetry.io/otel/sdk/metric/internal/x#readme-instrument-enabled.
 | 
			
		||||
func TestInstrumentEnabled(t *testing.T) {
 | 
			
		||||
	prom := promtest.GetAvailableLocalAddressPrometheus(t)
 | 
			
		||||
	set := meterProviderSettings{
 | 
			
		||||
		res: sdkresource.Default(),
 | 
			
		||||
		cfg: MetricsConfig{
 | 
			
		||||
	cfg := Config{
 | 
			
		||||
		Metrics: MetricsConfig{
 | 
			
		||||
			Level: configtelemetry.LevelDetailed,
 | 
			
		||||
			Readers: []config.MetricReader{{
 | 
			
		||||
				Pull: &config.PullMetricReader{Exporter: config.MetricExporter{Prometheus: prom}},
 | 
			
		||||
				Pull: &config.PullMetricReader{Exporter: config.PullMetricExporter{Prometheus: prom}},
 | 
			
		||||
			}},
 | 
			
		||||
		},
 | 
			
		||||
		asyncErrorChannel: make(chan error),
 | 
			
		||||
	}
 | 
			
		||||
	meterProvider, err := newMeterProvider(set, false)
 | 
			
		||||
	sdk, err := config.NewSDK(
 | 
			
		||||
		config.WithContext(context.Background()),
 | 
			
		||||
		config.WithOpenTelemetryConfiguration(config.OpenTelemetryConfiguration{
 | 
			
		||||
			MeterProvider: &config.MeterProvider{
 | 
			
		||||
				Readers: cfg.Metrics.Readers,
 | 
			
		||||
			},
 | 
			
		||||
			Resource: &config.Resource{
 | 
			
		||||
				SchemaUrl: ptr(""),
 | 
			
		||||
				Attributes: []config.AttributeNameValue{
 | 
			
		||||
					{Name: semconv.AttributeServiceInstanceID, Value: testInstanceID},
 | 
			
		||||
					{Name: semconv.AttributeServiceName, Value: "otelcol"},
 | 
			
		||||
					{Name: semconv.AttributeServiceVersion, Value: "latest"},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
		}),
 | 
			
		||||
	)
 | 
			
		||||
	require.NoError(t, err)
 | 
			
		||||
	meterProvider, err := newMeterProvider(Settings{SDK: &sdk}, cfg)
 | 
			
		||||
	defer func() {
 | 
			
		||||
		if prov, ok := meterProvider.(interface{ Shutdown(context.Context) error }); ok {
 | 
			
		||||
			require.NoError(t, prov.Shutdown(context.Background()))
 | 
			
		||||
| 
						 | 
				
			
			@ -301,3 +291,7 @@ func TestInstrumentEnabled(t *testing.T) {
 | 
			
		|||
	_, ok = floatGauge.(enabledInstrument)
 | 
			
		||||
	assert.True(t, ok, "Float64Gauge does not implement the experimental 'Enabled' method")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func ptr[T any](v T) *T {
 | 
			
		||||
	return &v
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,7 +7,7 @@ import (
 | 
			
		|||
	"testing"
 | 
			
		||||
 | 
			
		||||
	"github.com/stretchr/testify/require"
 | 
			
		||||
	"go.opentelemetry.io/contrib/config"
 | 
			
		||||
	config "go.opentelemetry.io/contrib/config/v0.3.0"
 | 
			
		||||
	sdktrace "go.opentelemetry.io/otel/sdk/trace"
 | 
			
		||||
 | 
			
		||||
	"go.opentelemetry.io/collector/config/configtelemetry"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue