cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Synthetic data points through API?

AntonioSousa
DynaMight Leader
DynaMight Leader

I've experimented with https://www.dynatrace.com/support/help/extend-dynatrace/dynatrace-api/environment-api/synthetic/

to get the data from our synthetic measurements, but this doesn't give it.

Is there no way to extract the performance/availability data?


Antonio Sousa
8 REPLIES 8

jonathan_schull
Dynatrace Advisor
Dynatrace Advisor

Hi Antonio,

The Synthetics API is there to help configure the actual Synthetic Monitors themselves. You can use the Metric API to pull synthetic performance/availability data using the "builtin:synthetic..." metrics.

Here is the documentation on how to use the Metrics API: https://www.dynatrace.com/support/help/extend-dynatrace/dynatrace-api/environment-api/metric-v2/

Cheers,
Jonathan


I have tried that before, but it always gives:

{  "error": {    "code": 404,    "message": "Metric selector parse error: Encountered metric key that could not be resolved in the metric registry. Please check for spelling errors and ensure that the metric exists: builtin:synthetic.httpmonitor.availability.percent."  }
}



Antonio Sousa

When using the metric selector, you need to use the full name of the metric you are looking for. You cannot give the first few parent parts of the metric name, then get a response with all metrics with those parents.

What I do when searching for metrics, is hit the /api/v2/metrics endpoint to return all metrics, then search through that response for the metrics that I want. When you have gotten the correct metricId from this search, you can them use that full metricId in any Metrics API call you want to do afterward.

I am not able to find any metricId that starts "builtin:service.client_side_requests." but I am seeing metrics like "builtin:service.requestCount.client" that you may be interested in.


Synthetic doesn't seem to be available in v2 😞


Antonio Sousa

Sorry I should have been more specific on the /api/v2/metrics GET request. There are a lot of metrics that will be returned by this GET request, so the results are paginated.

You can add the "pageSize=1000" parameter to this request so it will return 1000 metrics, instead of the default 100. You will also notice that there is a "nextPageKey" element in the JSON response. If you do not find all the metrics you are looking for on the first page, you can add the "nextPageKey=<page key value from JSON>" parameter next to the pageSize parameter to move to the next 1000 metrics.

There should be synthetic metrics in there


Got a total of 1696 but no synthetic there...


Antonio Sousa

Because the ID you provided in your edited comment is a Timeseried ID and not a Metric ID, can you try this:

If you are looking to use the specific metric: "builtin:synthetic.httpmonitor.availability.percent" then you will need to use the Timeseries API, as this is a Timeseries ID not a Metric ID.

You would need to send a POST to this endpoint:

/api/v1/timeseries/com.dynatrace.builtin%3Asynthetic.httpmonitor.availability.percent

You will need to configure the JSON body of your request to return the specific scope you are looking for.

Here is the documentation on this endpoint: https://www.dynatrace.com/support/help/extend-dynatrace/dynatrace-api/environment-api/metric-v1/read...


The "builtin:service.client_side_requests." was just another test I did, and I edited the comment since.

I'm using "com.dynatrace.builtin:synthetic.httpmonitor.availability.percent", but it doesn't appear in the v2 metrics list...

If I try it in v1, I get:

{  "error": {    "code": 404,    "message": "The given timeseries id is not configured."  }
}



Antonio Sousa