@@ -19,7 +19,7 @@ import (
1919 "github.com/open-telemetry/opentelemetry-collector-contrib/extension/headerssetterextension/internal/source"
2020)
2121
22- type Header struct {
22+ type header struct {
2323 action action.Action
2424 source source.Source
2525}
@@ -34,7 +34,7 @@ type headerSetterExtension struct {
3434 component.StartFunc
3535 component.ShutdownFunc
3636
37- headers []Header
37+ headers []header
3838}
3939
4040// PerRPCCredentials implements extensionauth.GRPCClient.
@@ -55,50 +55,50 @@ func newHeadersSetterExtension(cfg *Config, logger *zap.Logger) (*headerSetterEx
5555 return nil , errors .New ("extension configuration is not provided" )
5656 }
5757
58- headers := make ([]Header , 0 , len (cfg .HeadersConfig ))
59- for _ , header := range cfg .HeadersConfig {
58+ headers := make ([]header , 0 , len (cfg .HeadersConfig ))
59+ for _ , h := range cfg .HeadersConfig {
6060 var s source.Source
6161 switch {
62- case header .Value != nil :
62+ case h .Value != nil :
6363 s = & source.StaticSource {
64- Value : * header .Value ,
64+ Value : * h .Value ,
6565 }
66- case header .FromAttribute != nil :
66+ case h .FromAttribute != nil :
6767 defaultValue := ""
68- if header .DefaultValue != nil {
69- defaultValue = string (* header .DefaultValue )
68+ if h .DefaultValue != nil {
69+ defaultValue = string (* h .DefaultValue )
7070 }
7171 s = & source.AttributeSource {
72- Key : * header .FromAttribute ,
72+ Key : * h .FromAttribute ,
7373 DefaultValue : defaultValue ,
7474 }
75- case header .FromContext != nil :
75+ case h .FromContext != nil :
7676 defaultValue := ""
77- if header .DefaultValue != nil {
78- defaultValue = string (* header .DefaultValue )
77+ if h .DefaultValue != nil {
78+ defaultValue = string (* h .DefaultValue )
7979 }
8080 s = & source.ContextSource {
81- Key : * header .FromContext ,
81+ Key : * h .FromContext ,
8282 DefaultValue : defaultValue ,
8383 }
8484 }
8585
8686 var a action.Action
87- switch header .Action {
87+ switch h .Action {
8888 case INSERT :
89- a = action.Insert {Key : * header .Key }
89+ a = action.Insert {Key : * h .Key }
9090 case UPSERT :
91- a = action.Upsert {Key : * header .Key }
91+ a = action.Upsert {Key : * h .Key }
9292 case UPDATE :
93- a = action.Update {Key : * header .Key }
93+ a = action.Update {Key : * h .Key }
9494 case DELETE :
95- a = action.Delete {Key : * header .Key }
95+ a = action.Delete {Key : * h .Key }
9696 default :
97- a = action.Upsert {Key : * header .Key }
97+ a = action.Upsert {Key : * h .Key }
9898 logger .Warn ("The action was not provided, using 'upsert'." +
9999 " In future versions, we'll require this to be explicitly set" )
100100 }
101- headers = append (headers , Header {action : a , source : s })
101+ headers = append (headers , header {action : a , source : s })
102102 }
103103
104104 return & headerSetterExtension {headers : headers }, nil
@@ -107,7 +107,7 @@ func newHeadersSetterExtension(cfg *Config, logger *zap.Logger) (*headerSetterEx
107107// headersPerRPC is a gRPC credentials.PerRPCCredentials implementation sets
108108// headers with values extracted from provided sources.
109109type headersPerRPC struct {
110- headers []Header
110+ headers []header
111111}
112112
113113// GetRequestMetadata returns the request metadata to be used with the RPC.
@@ -137,7 +137,7 @@ func (h *headersPerRPC) RequireTransportSecurity() bool {
137137// values extracted from configured sources.
138138type headersRoundTripper struct {
139139 base http.RoundTripper
140- headers []Header
140+ headers []header
141141}
142142
143143// RoundTrip copies the original request and sets headers of the new requests
0 commit comments