0

I want to create some metrics around step functions that we currently have. I was able to make that list using python but for some reason, we are limited to use java in our company.

I want to

List ALL statemachines which are defined in current region for given account. in python i was able to achieve this using

stepFunction = boto3.client('stepfunctions', region_name='eu-west-1')
stepFunction.list_state_machines()

Then from that, i want to list all Tasks for that given statemachine and get some metrics.

In Java, I am unable to find an API reference which will give me ALL statemachines. I was looking at http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/index.html?com/amazonaws/services/stepfunctions/model/ListStateMachinesRequest.html API but no help.

Em Ae
  • 8,167
  • 27
  • 95
  • 162

1 Answers1

0

To get the activity tasks for every state machine in your library, you will need to use the describeStateMachine call. Follow this pattern (please excuse the pseudocode):

state_machines = list_state_machines()
for each (state machine arn : state_machines) 
  sm = describe_statemachine(state_machine_arn)
  /*parse through the definition here and use regex pattern on the arns*/
  activityarns = sm.getDefinition().find(/regex/)

  metrics.add(sm.arn, activityarns)
endforeach

Hope this helps!

SunnyD
  • 270
  • 3
  • 11