blob: 990b25b2e79fb6669f6d153e159658335842cf8c [file] [log] [blame]
{
"metadata": {
"name": "",
"signature": "sha256:07509ec03cc71263d49f2d8bb69f21bd039d5ddeeb3f3c81573002794049a1aa"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The `BareTrace` class lets you create a trace class that has been parsed outside of trappy. This lets you leverage trappy's and bart's facilities with any type of trace."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Let's assume that we have events available in a csv file. We can import them into a trace object by creating a `BareTrace` object and adding them using `add_parsed_event`."
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import pandas as pd\n",
"import trappy"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 1
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"First we import the parsed events into a pandas DataFrame"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"event = pd.DataFrame.from_csv(\"sample_trace.csv\")"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 2
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now we create an trappy trace object and add our event to it. "
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"trace = trappy.BareTrace()\n",
"trace.add_parsed_event(\"http_access\", event)"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 3
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We can add more events if we had collected them from different sources. Just call `.add_parsed_event()` for each of them"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"trappy.ILinePlot(trace, trace.http_access, column=[\"response_time\"]).view()"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": null
}
],
"metadata": {}
}
]
}