-
Notifications
You must be signed in to change notification settings - Fork 835
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1464 from adriangonz/integration-tests-tracing
Integration tests tracing
- Loading branch information
Showing
10 changed files
with
293 additions
and
47 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
{ | ||
"apiVersion": "machinelearning.seldon.io/v1alpha2", | ||
"kind": "SeldonDeployment", | ||
"metadata": { | ||
"labels": { | ||
"app": "seldon" | ||
}, | ||
"name": "mymodel" | ||
}, | ||
"spec": { | ||
"name": "mymodel", | ||
"oauth_key": "oauth-key", | ||
"oauth_secret": "oauth-secret", | ||
"predictors": [ | ||
{ | ||
"svcOrchSpec": { | ||
"env": [ | ||
{ | ||
"name": "SELDON_LOG_LEVEL", | ||
"value": "DEBUG" | ||
}, | ||
{ | ||
"name": "TRACING", | ||
"value": "1" | ||
}, | ||
{ | ||
"name": "JAEGER_AGENT_HOST", | ||
"value": "jaeger-agent.seldon" | ||
}, | ||
{ | ||
"name": "JAEGER_AGENT_PORT", | ||
"value": "5775" | ||
}, | ||
{ | ||
"name": "JAEGER_SAMPLER_TYPE", | ||
"value": "const" | ||
}, | ||
{ | ||
"name": "JAEGER_SAMPLER_PARAM", | ||
"value": "1" | ||
} | ||
] | ||
}, | ||
"componentSpecs": [ | ||
{ | ||
"spec": { | ||
"containers": [ | ||
{ | ||
"image": "seldonio/fixed-model:0.1", | ||
"imagePullPolicy": "IfNotPresent", | ||
"env": [ | ||
{ "name": "TRACING", "value": "1" }, | ||
{ | ||
"name": "JAEGER_AGENT_HOST", | ||
"value": "jaeger-agent.seldon" | ||
}, | ||
{ | ||
"name": "JAEGER_AGENT_PORT", | ||
"value": "5775" | ||
}, | ||
{ | ||
"name": "JAEGER_SAMPLER_TYPE", | ||
"value": "const" | ||
}, | ||
{ | ||
"name": "JAEGER_SAMPLER_PARAM", | ||
"value": "1" | ||
} | ||
], | ||
"name": "complex-model", | ||
"resources": { | ||
"requests": { | ||
"memory": "1Mi" | ||
} | ||
} | ||
} | ||
], | ||
"terminationGracePeriodSeconds": 1 | ||
} | ||
} | ||
], | ||
"graph": { | ||
"children": [], | ||
"name": "complex-model", | ||
"endpoint": { | ||
"type": "REST" | ||
}, | ||
"type": "MODEL" | ||
}, | ||
"name": "mymodel", | ||
"replicas": 1 | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
apiVersion: jaegertracing.io/v1 | ||
kind: Jaeger | ||
metadata: | ||
name: jaeger | ||
spec: | ||
strategy: allInOne | ||
allInOne: | ||
options: | ||
query: | ||
base-path: /jaeger | ||
--- | ||
apiVersion: getambassador.io/v1 | ||
kind: Mapping | ||
metadata: | ||
name: jaeger | ||
spec: | ||
prefix: /jaeger | ||
service: jaeger-query.seldon:16686 | ||
# Jaeger will expect the `/jaeger` prefix, so we can't rewrite it | ||
rewrite: "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
kind: Cluster | ||
apiVersion: kind.sigs.k8s.io/v1alpha3 | ||
nodes: | ||
- role: control-plane | ||
- role: worker | ||
extraPortMappings: | ||
- containerPort: 30080 | ||
hostPort: 8003 | ||
- containerPort: 31280 | ||
hostPort: 8004 | ||
kubeadmConfigPatches: | ||
- | | ||
apiVersion: kubelet.config.k8s.io/v1beta1 | ||
kind: KubeletConfiguration | ||
metadata: | ||
name: config | ||
kubeReserved: | ||
cpu: "300m" | ||
memory: "300Mi" | ||
ephemeral-storage: "1Gi" | ||
kubeReservedCgroup: "/kube-reserved" | ||
systemReserved: | ||
cpu: "300m" | ||
memory: "300Mi" | ||
ephemeral-storage: "1Gi" | ||
evictionHard: | ||
memory.available: "200Mi" | ||
nodefs.available: "10%" | ||
featureGates: | ||
DynamicKubeletConfig: true | ||
RotateKubeletServerCertificate: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import requests | ||
from tenacity import retry, stop_after_attempt, wait_exponential, retry_if_result | ||
|
||
from seldon_e2e_utils import API_AMBASSADOR | ||
|
||
JAEGER_QUERY_URL = f"http://{API_AMBASSADOR}/jaeger" | ||
|
||
|
||
def _is_empty(result): | ||
return result is None or len(result) == 0 | ||
|
||
|
||
@retry( | ||
stop=stop_after_attempt(5), | ||
wait=wait_exponential(max=5), | ||
retry=retry_if_result(_is_empty), | ||
) | ||
def get_traces(pod_name, service, operation): | ||
""" | ||
Fetch traces for a given pod, service and operation. | ||
We use Jaeger's [**internal** REST | ||
API](https://www.jaegertracing.io/docs/1.13/apis/#http-json-internal). | ||
Therefore, it may stop working at some point! | ||
Note that this method will get retried 5 times (with an exponentially | ||
growing waiting time) if the traces are empty. | ||
This is to give time to Jaeger to collect and process the trace, which is | ||
performed asynchronously. | ||
Parameters | ||
--- | ||
pod_name : str | ||
We currently don't have access to the PUID (see | ||
https://github.com/SeldonIO/seldon-core/issues/1460). | ||
As a workaround, we filter the traces using the Pod name. | ||
service : str | ||
Service sending the traces. | ||
This will usually be the `'executor'`, since it's the one which creates | ||
the trace. | ||
operation : str | ||
Operation which was traced (e.g. `'predictions'`). | ||
Returns | ||
--- | ||
traces : list | ||
List of traces, where each trace contains spans, processes, etc. | ||
""" | ||
endpoint = f"{JAEGER_QUERY_URL}/api/traces" | ||
params = {"service": service, "operation": operation, "tag": f"hostname:{pod_name}"} | ||
response = requests.get(endpoint, params=params) | ||
payload = response.json() | ||
traces = payload["data"] | ||
return traces |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.