@@ -148,7 +148,13 @@ func TestWithResourceAttributes(t *testing.T) {
148148 attr2 := semconv .K8SPodName ("test_pod_name" )
149149 attr3 := semconv .K8SNamespaceName ("test_namespace_name" )
150150
151- c , err := newInstConfig (context .Background (), []InstrumentationOption {WithResourceAttributes (attr1 , attr2 ), WithResourceAttributes (attr3 )})
151+ c , err := newInstConfig (
152+ context .Background (),
153+ []InstrumentationOption {
154+ WithResourceAttributes (attr1 , attr2 ),
155+ WithResourceAttributes (attr3 ),
156+ },
157+ )
152158 require .NoError (t , err )
153159 assert .Equal (t , []attribute.KeyValue {attr1 , attr2 , attr3 }, c .additionalResAttrs )
154160 })
@@ -159,7 +165,15 @@ func TestWithResourceAttributes(t *testing.T) {
159165 attr3 := semconv .K8SNamespaceName ("test_namespace_name" )
160166
161167 mockEnv (t , map [string ]string {
162- "OTEL_RESOURCE_ATTRIBUTES" : fmt .Sprintf ("%s=%s,%s=%s,%s=%s" , nameAttr .Key , nameAttr .Value .AsString (), attr2 .Key , attr2 .Value .AsString (), attr3 .Key , attr3 .Value .AsString ()),
168+ "OTEL_RESOURCE_ATTRIBUTES" : fmt .Sprintf (
169+ "%s=%s,%s=%s,%s=%s" ,
170+ nameAttr .Key ,
171+ nameAttr .Value .AsString (),
172+ attr2 .Key ,
173+ attr2 .Value .AsString (),
174+ attr3 .Key ,
175+ attr3 .Value .AsString (),
176+ ),
163177 })
164178
165179 c , err := newInstConfig (context .Background (), []InstrumentationOption {WithEnv ()})
@@ -174,11 +188,20 @@ func TestWithResourceAttributes(t *testing.T) {
174188 attr3 := semconv .K8SNamespaceName ("test_namespace_name" )
175189
176190 mockEnv (t , map [string ]string {
177- "OTEL_RESOURCE_ATTRIBUTES" : fmt .Sprintf ("%s=%s,%s=%s" , nameAttr .Key , nameAttr .Value .AsString (), attr2 .Key , attr2 .Value .AsString ()),
191+ "OTEL_RESOURCE_ATTRIBUTES" : fmt .Sprintf (
192+ "%s=%s,%s=%s" ,
193+ nameAttr .Key ,
194+ nameAttr .Value .AsString (),
195+ attr2 .Key ,
196+ attr2 .Value .AsString (),
197+ ),
178198 })
179199
180200 // Use WithResourceAttributes to config the additional resource attributes
181- c , err := newInstConfig (context .Background (), []InstrumentationOption {WithEnv (), WithResourceAttributes (attr3 )})
201+ c , err := newInstConfig (
202+ context .Background (),
203+ []InstrumentationOption {WithEnv (), WithResourceAttributes (attr3 )},
204+ )
182205 require .NoError (t , err )
183206 assert .Equal (t , nameAttr .Value .AsString (), c .serviceName )
184207 assert .Equal (t , []attribute.KeyValue {attr2 , attr3 }, c .additionalResAttrs )
0 commit comments