-
Notifications
You must be signed in to change notification settings - Fork 186
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
Pythonic interface to profile data #389
Comments
Hi @wfjm, thanks for using our client.
Thanks for your suggestion, the client currently don’t have this type of interface. Is this something you might be willing to help with? Regards |
Hi @bednar , A few thoughts anyway: The current state is that one can enable profiling, and because the profile data only written to I'm currently looking into |
Hi @wfjm, thanks for your detail info. We are thinking about something like (pseudo code): from influxdb_client import InfluxDBClient, Point
from influxdb_client.client.flux_table import FluxRecord
from influxdb_client.client.query_api import QueryOptions
from influxdb_client.client.write_api import SYNCHRONOUS
with InfluxDBClient(url="http://localhost:8086", token="my-token", org="my-org", debug=True) as client:
write_api = client.write_api(write_options=SYNCHRONOUS)
"""
Prepare data
"""
_point1 = Point("my_measurement").tag("location", "Prague").field("temperature", 25.3)
_point2 = Point("my_measurement").tag("location", "New York").field("temperature", 24.3)
write_api.write(bucket="my-bucket", record=[_point1, _point2])
"""
Define callback to process profiler results.
"""
def profiler_callback(profiler_result: FluxRecord):
print(f'Custom processing of profiler result: {profiler_result}')
"""
Pass callback to QueryOptions
"""
query_api = client.query_api(
query_options=QueryOptions(profilers=["query", "operator"], profiler_callback=profiler_callback))
"""
Perform query
"""
tables = query_api.query('from(bucket:"my-bucket") |> range(start: -10m)')
for table in tables:
for record in table.records:
print(record.values) Is this suitable for your use case? Regards |
@bednar , |
Proposal:
Pythonic interface to profile data
Current behavior:
Seems write profile data always to
stdout
Desired behavior:
Access to profile data via suitable python structures.
Use case:
Automatize tests, generate specific and compact summaries.
I'm using
influxdb-client
mostly for testingFlux
queries.When I use profiling with
the profiling data is simply printed to
stdout
.I had a brief look into the code and found in
flux_csv_parser.py
I'd love to have a pythonic interface to the profile data, from which I could pick the parts of interest and build compact summaries.
It that available ?
The text was updated successfully, but these errors were encountered: