Removes dependency on pod information for elastic search download
This commit is contained in:
parent
2b463d060d
commit
3f8699a59b
|
@ -46,17 +46,22 @@ namespace ContinuousTests
|
||||||
|
|
||||||
private string CreateQueryTemplate(RunningContainer container, DateTime startUtc, DateTime endUtc)
|
private string CreateQueryTemplate(RunningContainer container, DateTime startUtc, DateTime endUtc)
|
||||||
{
|
{
|
||||||
var workflow = tools.CreateWorkflow();
|
|
||||||
var podInfo = workflow.GetPodInfo(container);
|
|
||||||
var podName = podInfo.Name;
|
|
||||||
var start = startUtc.ToString("o");
|
var start = startUtc.ToString("o");
|
||||||
var end = endUtc.ToString("o");
|
var end = endUtc.ToString("o");
|
||||||
|
|
||||||
var source = "{ \"sort\": [ { \"@timestamp\": { \"order\": \"asc\" } } ], \"fields\": [ { \"field\": \"@timestamp\", \"format\": \"strict_date_optional_time\" }, { \"field\": \"pod_name\" }, { \"field\": \"message\" } ], \"size\": <SIZE>, <SEARCHAFTER> \"_source\": false, \"query\": { \"bool\": { \"must\": [], \"filter\": [ { \"range\": { \"@timestamp\": { \"format\": \"strict_date_optional_time\", \"gte\": \"<STARTTIME>\", \"lte\": \"<ENDTIME>\" } } }, { \"match_phrase\": { \"pod_name\": \"<PODNAME>\" } } ] } } }";
|
var containerName = container.RunningContainers.StartResult.Deployment.Name;
|
||||||
|
var namespaceName = container.RunningContainers.StartResult.Cluster.Configuration.KubernetesNamespace;
|
||||||
|
|
||||||
|
//container_name : codex3-5 - deploymentName as stored in pod
|
||||||
|
// pod_namespace : codex - continuous - nolimits - tests - 1
|
||||||
|
|
||||||
|
//var source = "{ \"sort\": [ { \"@timestamp\": { \"order\": \"asc\" } } ], \"fields\": [ { \"field\": \"@timestamp\", \"format\": \"strict_date_optional_time\" }, { \"field\": \"pod_name\" }, { \"field\": \"message\" } ], \"size\": <SIZE>, <SEARCHAFTER> \"_source\": false, \"query\": { \"bool\": { \"must\": [], \"filter\": [ { \"range\": { \"@timestamp\": { \"format\": \"strict_date_optional_time\", \"gte\": \"<STARTTIME>\", \"lte\": \"<ENDTIME>\" } } }, { \"match_phrase\": { \"pod_name\": \"<PODNAME>\" } } ] } } }";
|
||||||
|
var source = "{ \"sort\": [ { \"@timestamp\": { \"order\": \"asc\" } } ], \"fields\": [ { \"field\": \"@timestamp\", \"format\": \"strict_date_optional_time\" }, { \"field\": \"message\" } ], \"size\": <SIZE>, <SEARCHAFTER> \"_source\": false, \"query\": { \"bool\": { \"must\": [], \"filter\": [ { \"range\": { \"@timestamp\": { \"format\": \"strict_date_optional_time\", \"gte\": \"<STARTTIME>\", \"lte\": \"<ENDTIME>\" } } }, { \"match_phrase\": { \"container_name\": \"<CONTAINERNAME>\" } }, { \"match_phrase\": { \"pod_namespace\": \"<NAMESPACENAME>\" } } ] } } }";
|
||||||
return source
|
return source
|
||||||
.Replace("<STARTTIME>", start)
|
.Replace("<STARTTIME>", start)
|
||||||
.Replace("<ENDTIME>", end)
|
.Replace("<ENDTIME>", end)
|
||||||
.Replace("<PODNAME>", podName);
|
.Replace("<CONTAINERNAME>", containerName)
|
||||||
|
.Replace("<NAMESPACENAME>", namespaceName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IHttp CreateElasticSearchHttp()
|
private IHttp CreateElasticSearchHttp()
|
||||||
|
|
|
@ -111,11 +111,12 @@ namespace ContinuousTests
|
||||||
var effectiveEnd = DateTime.UtcNow;
|
var effectiveEnd = DateTime.UtcNow;
|
||||||
var elasticSearchLogDownloader = new ElasticSearchLogDownloader(entryPoint.Tools, fixtureLog);
|
var elasticSearchLogDownloader = new ElasticSearchLogDownloader(entryPoint.Tools, fixtureLog);
|
||||||
|
|
||||||
var workflow = entryPoint.Tools.CreateWorkflow();
|
|
||||||
foreach (var node in nodes)
|
foreach (var node in nodes)
|
||||||
{
|
{
|
||||||
var podInfo = workflow.GetPodInfo(node.Container);
|
var container = node.Container;
|
||||||
var openingLine = $"{podInfo.Name} = {node.Container.Name} = {node.GetDebugInfo().id}";
|
var deploymentName = container.RunningContainers.StartResult.Deployment.Name;
|
||||||
|
var namespaceName = container.RunningContainers.StartResult.Cluster.Configuration.KubernetesNamespace;
|
||||||
|
var openingLine = $"{namespaceName} - {deploymentName} = {node.Container.Name} = {node.GetDebugInfo().id}";
|
||||||
elasticSearchLogDownloader.Download(fixtureLog.CreateSubfile(), node.Container, effectiveStart, effectiveEnd, openingLine);
|
elasticSearchLogDownloader.Download(fixtureLog.CreateSubfile(), node.Container, effectiveStart, effectiveEnd, openingLine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,8 @@ namespace ContinuousTests
|
||||||
{
|
{
|
||||||
var podInfo = workflow.GetPodInfo(container);
|
var podInfo = workflow.GetPodInfo(container);
|
||||||
log.Log($"Codex environment variables for '{container.Name}':");
|
log.Log($"Codex environment variables for '{container.Name}':");
|
||||||
log.Log($"Pod name: {podInfo.Name} - Deployment name: {instance.Containers.StartResult.Deployment.Name}");
|
log.Log($"Namespace: {container.RunningContainers.StartResult.Cluster.Configuration.KubernetesNamespace} - " +
|
||||||
|
$"Pod name: {podInfo.Name} - Deployment name: {instance.Containers.StartResult.Deployment.Name}");
|
||||||
var codexVars = container.Recipe.EnvVars;
|
var codexVars = container.Recipe.EnvVars;
|
||||||
foreach (var vars in codexVars) log.Log(vars.ToString());
|
foreach (var vars in codexVars) log.Log(vars.ToString());
|
||||||
log.Log("");
|
log.Log("");
|
||||||
|
|
Loading…
Reference in New Issue