@@ -95,6 +95,59 @@ def __init__(self, **kwds: Dict[str, Any]) -> None:
9595 if not isinstance (self .agent_port , int ):
9696 self .agent_port = int (self .agent_port )
9797
98+ def set_secrets (self , secrets : Dict [str , Any ]) -> None :
99+ """
100+ Set the secret option from the agent config.
101+ @param secrets: dictionary of secrets
102+ @return: None
103+ """
104+ self .secrets_matcher = secrets ["matcher" ]
105+ self .secrets_list = secrets ["list" ]
106+
107+ def set_extra_headers (self , extra_headers : Dict [str , Any ]) -> None :
108+ """
109+ Set the extra headers option from the agent config, which uses the legacy configuration setting.
110+ @param extra_headers: dictionary of headers
111+ @return: None
112+ """
113+ if self .extra_http_headers is None :
114+ self .extra_http_headers = extra_headers
115+ else :
116+ self .extra_http_headers .extend (extra_headers )
117+ logger .info (
118+ f"Will also capture these custom headers: { self .extra_http_headers } "
119+ )
120+
121+ def set_tracing (self , tracing : Dict [str , Any ]) -> None :
122+ """
123+ Set tracing options from the agent config.
124+ @param tracing: tracing configuration dictionary
125+ @return: None
126+ """
127+ if (
128+ "ignore-endpoints" in tracing
129+ and "INSTANA_IGNORE_ENDPOINTS" not in os .environ
130+ and "tracing" not in config
131+ ):
132+ self .ignore_endpoints = parse_ignored_endpoints (tracing ["ignore-endpoints" ])
133+ if "extra-http-headers" in tracing :
134+ self .extra_http_headers = tracing ["extra-http-headers" ]
135+
136+ def set_from (self , res_data : Dict [str , Any ]) -> None :
137+ """
138+ Set the source identifiers given to use by the Instana Host agent.
139+ @param res_data: source identifiers provided as announce response
140+ @return: None
141+ """
142+ if "secrets" in res_data :
143+ self .set_secrets (res_data ["secrets" ])
144+
145+ if "tracing" in res_data :
146+ self .set_tracing (res_data ["tracing" ])
147+ else :
148+ if "extraHeaders" in res_data :
149+ self .set_extra_headers (res_data ["extraHeaders" ])
150+
98151
99152class ServerlessOptions (BaseOptions ):
100153 """Base class for serverless environments. Holds settings common to all serverless environments."""
0 commit comments