Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix trace agent #603

Merged
merged 1 commit into from
Aug 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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