Undestanding concurrent use of shared resource

I’m logging usage of shared resource. Essentially different actors perform operations on the shared resources and log actions to influxdb, currently I provide as rich information as possible. Here are metrics generated by my actor using shared resource at the beginning and end of the action:

shared_resources,actor=actor1,shared_resource=resource1,action=action1,event=started action_uniq_id=id1,action_payload=p1 t1
shared_resources,actor=actor1,shared_resource=resource1,action=action1,event=ended time_started=t1,action_uniq_id=id1,action_payload=p2 t2

I’d like to be able to understand how I can get following metrics out of this data: How many concurrent operations were happening on shared resource at any point in time (graph concurrent operations)? How many concurrent operations of type action1 were happening on shared resource (graph concurrent operations over time)?

Here’s example of graph of three actions of two types happening in time:

I need to get two graphs out of it. One is concurrency of all actions happening on this resource:

and second is about concurrency of any single action (say a1):

@Nidd Wouldn’t they look something like this:

# Concurrency of all actions happening on this resource
SELECT count(action_uniq_id) FROM shared_resources WHERE shared_resource = "resource1" GROUP BY time(10s)

# Concurrency of any single action
SELECT count(action_uniq_id) FROM shared_resources WHERE shared_resource = "resource1" GROUP BY time(10s)