Skip to content

Commit

Permalink
fix: fix trace agent
Browse files Browse the repository at this point in the history
  • Loading branch information
sanhuan.sw committed Aug 15, 2023
1 parent abcb9d5 commit 606643a
Showing 1 changed file with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import io.holoinsight.server.home.biz.common.MetaDictType;
import io.holoinsight.server.home.biz.common.MetaDictUtil;
import io.holoinsight.server.home.biz.service.ApiKeyService;
import io.holoinsight.server.home.biz.service.TenantInitService;
import io.holoinsight.server.home.common.util.scope.RequestContext;
import io.holoinsight.server.home.dal.model.ApiKey;
import io.holoinsight.server.home.web.common.AesUtil;
Expand Down Expand Up @@ -39,6 +40,10 @@ public class TraceAgentFacadeImpl extends BaseFacade {
@Autowired
private ApiKeyService apiKeyService;

@Autowired
private TenantInitService tenantInitService;


@Autowired
private TraceAuthEncryptConfiguration traceAuthEncryptConfiguration;

Expand All @@ -55,10 +60,7 @@ public JsonResult<Map<String, Object>> traceAgent(
final JsonResult<Map<String, Object>> result = new JsonResult<>();
try {
String tenant = RequestContext.getContext().ms.getTenant();
Map<String, Object> conditions = new HashMap<>();
conditions.put("tenant", tenant);
conditions.put("status", true);
List<ApiKey> apiKeys = apiKeyService.listByMap(conditions);
List<ApiKey> apiKeys = apiKeyService.listByMap(apikeyConditions(tenant, extendInfo));

Map<String, Object> sysMap = new HashMap<>();
String apikey = "";
Expand Down Expand Up @@ -98,6 +100,13 @@ public JsonResult<Map<String, Object>> traceAgent(
return result;
}

public Map<String, Object> apikeyConditions(String tenant, Map<String, String> extendInfo) {
Map<String, Object> conditions = new HashMap<>();
conditions.put("tenant", tenantInitService.getTsdbTenant(tenant));
conditions.put("status", true);
return conditions;
}

public String getCollectorAddress(Map<String, String> extendInfo) {
return MetaDictUtil.getStringValue(MetaDictType.TRACE_AGENT_CONFIG, MetaDictKey.COLLECTOR_HOST);
}
Expand Down

0 comments on commit 606643a

Please sign in to comment.