File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
metrics-operator/controllers/common/providers/datadog Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,11 @@ func (d *KeptnDataDogProvider) EvaluateQuery(ctx context.Context, metric metrics
2626 ctx , cancel := context .WithTimeout (ctx , 20 * time .Second )
2727 defer cancel ()
2828
29+ apiKey , err := getDDSecret (ctx , provider , d .K8sClient )
30+ if err != nil {
31+ return "" , nil , err
32+ }
33+
2934 // TODO: get DD_API_KEY and DD_APP_KEY from kubernetes secret
3035 // TODO: patch the context with the keys
3136 // Ref: https://github.com/DataDog/datadog-api-client-go#getting-started
@@ -35,13 +40,19 @@ func (d *KeptnDataDogProvider) EvaluateQuery(ctx context.Context, metric metrics
3540 datadog .ContextAPIKeys ,
3641 map [string ]datadog.APIKey {
3742 "apiKeyAuth" : {
38- Key : "DD_API_KEY" ,
43+ Key : apiKey ,
3944 },
4045 "appKeyAuth" : {
41- Key : "DD_APP_KEY" ,
46+ Key : "value" , // TODO: get this value from kubernetes secret.
4247 },
4348 },
4449 )
50+ ctx = context .WithValue (ctx ,
51+ datadog .ContextServerVariables ,
52+ map [string ]string {
53+ "site" : provider .Spec .TargetServer ,
54+ },
55+ )
4556 fromTime := time .Now ().AddDate (0 , 0 , - 1 )
4657 queryTime := time .Now ()
4758
You can’t perform that action at this time.
0 commit comments