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

API to fetch the details of HTTP 5XX count

Shruts
Participant

Hi,

I want to fetch the details and count of HTTP 5XX error count through the API. Please help me which specific API can give me the details? 

My use cases are:
I'm trying to integrate API with Jenkins deployment pipeline. If the 5xx error counts are more than previous build error count then new build deployment should not happen.

Kindly provide the specific API who can give me the 5xx error count details.

6 REPLIES 6

RazTN7
Dynatrace Champion
Dynatrace Champion

Hello @Shruts 

builtin service.errors.fivexx.count metric is available. Use the V2 API below to fetch the data.

RazTN7X_2-1700216596367.png

 

RazTN7X_4-1700216645438.png

Cheers!

RN

 
Have a nice day!

Hi,

I'm using the same API for the details but I need to get the understanding of response JSON. Can you please send the documentation for API response JSON? Provided swagger documentation is not sufficient to get the understanding.
So below is my request and response, Can you help me to get the Error count using that response. What all fields I need to use to fetch 5xx error count.
Request:

https://{environmentid}.live.dynatrace.com/api/v2/metrics/query?metricSelector=builtin%3Aservice.keyRequest.errors.fivexx.count&mzSelector=mzName%28%22Autofix-Openreach_APP11319%22%29

Response:
{ "totalCount": 5, "nextPageKey": null, "resolution": "1m", "result": [ { "metricId": "builtin:service.keyRequest.errors.fivexx.count", "dataPointCountRatio": 0.00003, "dimensionCountRatio": 0.00005, "data": [ { "dimensions": [ "SERVICE_METHOD-A479BD7918CBADBA" ], "dimensionMap": { "dt.entity.service_method": "SERVICE_METHOD-A479BD7918CBADBA" }, "timestamps": [ 1700207520000, 1700207580000, 1700207640000, 1700207700000, 1700207760000, 1700207820000, 1700207880000, 1700207940000, 1700208000000, 1700208060000, 1700208120000, 1700208180000, 1700208240000, 1700208300000, 1700208360000, 1700208420000, 1700208480000, 1700208540000, 1700208600000, 1700208660000, 1700208720000, 1700208780000, 1700208840000, 1700208900000, 1700208960000, 1700209020000, 1700209080000, 1700209140000, 1700209200000, 1700209260000, 1700209320000, 1700209380000, 1700209440000, 1700209500000, 1700209560000, 1700209620000, 1700209680000, 1700209740000, 1700209800000, 1700209860000, 1700209920000, 1700209980000, 1700210040000, 1700210100000, 1700210160000, 1700210220000, 1700210280000, 1700210340000, 1700210400000, 1700210460000, 1700210520000, 1700210580000, 1700210640000, 1700210700000, 1700210760000, 1700210820000, 1700210880000, 1700210940000, 1700211000000, 1700211060000, 1700211120000, 1700211180000, 1700211240000, 1700211300000, 1700211360000, 1700211420000, 1700211480000, 1700211540000, 1700211600000, 1700211660000, 1700211720000, 1700211780000, 1700211840000, 1700211900000, 1700211960000, 1700212020000, 1700212080000, 1700212140000, 1700212200000, 1700212260000, 1700212320000, 1700212380000, 1700212440000, 1700212500000, 1700212560000, 1700212620000, 1700212680000, 1700212740000, 1700212800000, 1700212860000, 1700212920000, 1700212980000, 1700213040000, 1700213100000, 1700213160000, 1700213220000, 1700213280000, 1700213340000, 1700213400000, 1700213460000, 1700213520000, 1700213580000, 1700213640000, 1700213700000, 1700213760000, 1700213820000, 1700213880000, 1700213940000, 1700214000000, 1700214060000, 1700214120000, 1700214180000, 1700214240000, 1700214300000, 1700214360000, 1700214420000, 1700214480000, 1700214540000, 1700214600000, 1700214660000 ], "values": [ null, 0, 0, 0, null, null, 0, 0, 0, null, null, 0, null, null, null, null, 0, 0, 0, null, null, null, null, 0, null, 0, null, 0, 0, 0, 0, null, null, 0, 0, null, 0, 0, null, null, 0, null, null, null, 0, 0, null, 0, null, 0, 0, null, 0, 0, null, null, null, null, null, null, null, 0, null, null, null, 0, 0, null, 0, null, null, 0, 0, null, 0, 0, 0, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, 0, null, null, 0, 0, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, 0, 0, null, null, null ] }, { "dimensions": [ "SERVICE_METHOD-B99B8DF74BCC6240" ], "dimensionMap": { "dt.entity.service_method": "SERVICE_METHOD-B99B8DF74BCC6240" }, "timestamps": [ 1700207520000, 1700207580000, 1700207640000, 1700207700000, 1700207760000, 1700207820000, 1700207880000, 1700207940000, 1700208000000, 1700208060000, 1700208120000, 1700208180000, 1700208240000, 1700208300000, 1700208360000, 1700208420000, 1700208480000, 1700208540000, 1700208600000, 1700208660000, 1700208720000, 1700208780000, 1700208840000, 1700208900000, 1700208960000, 1700209020000, 1700209080000, 1700209140000, 1700209200000, 1700209260000, 1700209320000, 1700209380000, 1700209440000, 1700209500000, 1700209560000, 1700209620000, 1700209680000, 1700209740000, 1700209800000, 1700209860000, 1700209920000, 1700209980000, 1700210040000, 1700210100000, 1700210160000, 1700210220000, 1700210280000, 1700210340000, 1700210400000, 1700210460000, 1700210520000, 1700210580000, 1700210640000, 1700210700000, 1700210760000, 1700210820000, 1700210880000, 1700210940000, 1700211000000, 1700211060000, 1700211120000, 1700211180000, 1700211240000, 1700211300000, 1700211360000, 1700211420000, 1700211480000, 1700211540000, 1700211600000, 1700211660000, 1700211720000, 1700211780000, 1700211840000, 1700211900000, 1700211960000, 1700212020000, 1700212080000, 1700212140000, 1700212200000, 1700212260000, 1700212320000, 1700212380000, 1700212440000, 1700212500000, 1700212560000, 1700212620000, 1700212680000, 1700212740000, 1700212800000, 1700212860000, 1700212920000, 1700212980000, 1700213040000, 1700213100000, 1700213160000, 1700213220000, 1700213280000, 1700213340000, 1700213400000, 1700213460000, 1700213520000, 1700213580000, 1700213640000, 1700213700000, 1700213760000, 1700213820000, 1700213880000, 1700213940000, 1700214000000, 1700214060000, 1700214120000, 1700214180000, 1700214240000, 1700214300000, 1700214360000, 1700214420000, 1700214480000, 1700214540000, 1700214600000, 1700214660000 ], "values": [ null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, 0, null, null, null, null, null, null, null, null, null, null, null, 0, null, 0, 0, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, 0, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ] }, { "dimensions": [ "SERVICE_METHOD-3BAA7DD64CC702B6" ], "dimensionMap": { "dt.entity.service_method": "SERVICE_METHOD-3BAA7DD64CC702B6" }, "timestamps": [ 1700207520000, 1700207580000, 1700207640000, 1700207700000, 1700207760000, 1700207820000, 1700207880000, 1700207940000, 1700208000000, 1700208060000, 1700208120000, 1700208180000, 1700208240000, 1700208300000, 1700208360000, 1700208420000, 1700208480000, 1700208540000, 1700208600000, 1700208660000, 1700208720000, 1700208780000, 1700208840000, 1700208900000, 1700208960000, 1700209020000, 1700209080000, 1700209140000, 1700209200000, 1700209260000, 1700209320000, 1700209380000, 1700209440000, 1700209500000, 1700209560000, 1700209620000, 1700209680000, 1700209740000, 1700209800000, 1700209860000, 1700209920000, 1700209980000, 1700210040000, 1700210100000, 1700210160000, 1700210220000, 1700210280000, 1700210340000, 1700210400000, 1700210460000, 1700210520000, 1700210580000, 1700210640000, 1700210700000, 1700210760000, 1700210820000, 1700210880000, 1700210940000, 1700211000000, 1700211060000, 1700211120000, 1700211180000, 1700211240000, 1700211300000, 1700211360000, 1700211420000, 1700211480000, 1700211540000, 1700211600000, 1700211660000, 1700211720000, 1700211780000, 1700211840000, 1700211900000, 1700211960000, 1700212020000, 1700212080000, 1700212140000, 1700212200000, 1700212260000, 1700212320000, 1700212380000, 1700212440000, 1700212500000, 1700212560000, 1700212620000, 1700212680000, 1700212740000, 1700212800000, 1700212860000, 1700212920000, 1700212980000, 1700213040000, 1700213100000, 1700213160000, 1700213220000, 1700213280000, 1700213340000, 1700213400000, 1700213460000, 1700213520000, 1700213580000, 1700213640000, 1700213700000, 1700213760000, 1700213820000, 1700213880000, 1700213940000, 1700214000000, 1700214060000, 1700214120000, 1700214180000, 1700214240000, 1700214300000, 1700214360000, 1700214420000, 1700214480000, 1700214540000, 1700214600000, 1700214660000 ], "values": [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, null, 0, 0, 0, 0, null, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, null, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] }, { "dimensions": [ "SERVICE_METHOD-0015D9BE1CFB8193" ], "dimensionMap": { "dt.entity.service_method": "SERVICE_METHOD-0015D9BE1CFB8193" }, "timestamps": [ 1700207520000, 1700207580000, 1700207640000, 1700207700000, 1700207760000, 1700207820000, 1700207880000, 1700207940000, 1700208000000, 1700208060000, 1700208120000, 1700208180000, 1700208240000, 1700208300000, 1700208360000, 1700208420000, 1700208480000, 1700208540000, 1700208600000, 1700208660000, 1700208720000, 1700208780000, 1700208840000, 1700208900000, 1700208960000, 1700209020000, 1700209080000, 1700209140000, 1700209200000, 1700209260000, 1700209320000, 1700209380000, 1700209440000, 1700209500000, 1700209560000, 1700209620000, 1700209680000, 1700209740000, 1700209800000, 1700209860000, 1700209920000, 1700209980000, 1700210040000, 1700210100000, 1700210160000, 1700210220000, 1700210280000, 1700210340000, 1700210400000, 1700210460000, 1700210520000, 1700210580000, 1700210640000, 1700210700000, 1700210760000, 1700210820000, 1700210880000, 1700210940000, 1700211000000, 1700211060000, 1700211120000, 1700211180000, 1700211240000, 1700211300000, 1700211360000, 1700211420000, 1700211480000, 1700211540000, 1700211600000, 1700211660000, 1700211720000, 1700211780000, 1700211840000, 1700211900000, 1700211960000, 1700212020000, 1700212080000, 1700212140000, 1700212200000, 1700212260000, 1700212320000, 1700212380000, 1700212440000, 1700212500000, 1700212560000, 1700212620000, 1700212680000, 1700212740000, 1700212800000, 1700212860000, 1700212920000, 1700212980000, 1700213040000, 1700213100000, 1700213160000, 1700213220000, 1700213280000, 1700213340000, 1700213400000, 1700213460000, 1700213520000, 1700213580000, 1700213640000, 1700213700000, 1700213760000, 1700213820000, 1700213880000, 1700213940000, 1700214000000, 1700214060000, 1700214120000, 1700214180000, 1700214240000, 1700214300000, 1700214360000, 1700214420000, 1700214480000, 1700214540000, 1700214600000, 1700214660000 ], "values": [ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, 0, null, null, null, null, 0, null, null, null, null, null, 0, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, 0, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, 0, null, null, null, null, null, null, null, null, 0, null, null, 0, null, null ] }, { "dimensions": [ "SERVICE_METHOD-5FD35804FF33CAC0" ], "dimensionMap": { "dt.entity.service_method": "SERVICE_METHOD-5FD35804FF33CAC0" }, "timestamps": [ 1700207520000, 1700207580000, 1700207640000, 1700207700000, 1700207760000, 1700207820000, 1700207880000, 1700207940000, 1700208000000, 1700208060000, 1700208120000, 1700208180000, 1700208240000, 1700208300000, 1700208360000, 1700208420000, 1700208480000, 1700208540000, 1700208600000, 1700208660000, 1700208720000, 1700208780000, 1700208840000, 1700208900000, 1700208960000, 1700209020000, 1700209080000, 1700209140000, 1700209200000, 1700209260000, 1700209320000, 1700209380000, 1700209440000, 1700209500000, 1700209560000, 1700209620000, 1700209680000, 1700209740000, 1700209800000, 1700209860000, 1700209920000, 1700209980000, 1700210040000, 1700210100000, 1700210160000, 1700210220000, 1700210280000, 1700210340000, 1700210400000, 1700210460000, 1700210520000, 1700210580000, 1700210640000, 1700210700000, 1700210760000, 1700210820000, 1700210880000, 1700210940000, 1700211000000, 1700211060000, 1700211120000, 1700211180000, 1700211240000, 1700211300000, 1700211360000, 1700211420000, 1700211480000, 1700211540000, 1700211600000, 1700211660000, 1700211720000, 1700211780000, 1700211840000, 1700211900000, 1700211960000, 1700212020000, 1700212080000, 1700212140000, 1700212200000, 1700212260000, 1700212320000, 1700212380000, 1700212440000, 1700212500000, 1700212560000, 1700212620000, 1700212680000, 1700212740000, 1700212800000, 1700212860000, 1700212920000, 1700212980000, 1700213040000, 1700213100000, 1700213160000, 1700213220000, 1700213280000, 1700213340000, 1700213400000, 1700213460000, 1700213520000, 1700213580000, 1700213640000, 1700213700000, 1700213760000, 1700213820000, 1700213880000, 1700213940000, 1700214000000, 1700214060000, 1700214120000, 1700214180000, 1700214240000, 1700214300000, 1700214360000, 1700214420000, 1700214480000, 1700214540000, 1700214600000, 1700214660000 ], "values": [ 0, 0, 0, 0, 0, null, 0, 0, 0, 0, 0, 0, 0, 0, null, 0, null, 0, null, 0, null, 0, 0, null, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, null, 0, 0, 0, 0, 0, 0, null, 0, 0, 0, null, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, null, null, 0, 0, 0, 0, 0, 0, null, 0, 0, null, 0, null, 0, 0, 0, 0, 0, 0, 0, null, 0, 0, 0, 0, 0, null, 0, null, 0, null, 0, 0, 0, 0, 0, null, 0, 0, 0, 0, 0, null, 0, 0, 0, 0, 0, 0, null, 0, 0, 0, 0 ] } ] } ] }

RazTN7
Dynatrace Champion
Dynatrace Champion

I see you are using keyRequest.errors.fivexx.count metric. From the response body I could see the count as 0 or null.

Can you try builtin:service.errors.fivexx.count

or

Create a calculate metric for your specific request with 5xx logic in it. And use the calc metric in API v2 Metric

 

 

Ref - https://docs.dynatrace.com/docs/dynatrace-api/environment-api/metric-v2/get-data-points

Have a nice day!

Hi,
I'm getting the response against dt.entity.servicefor example  "dt.entity.service": "SERVICE-D08B16288DB7A0C4"

How can I get the service name against each of the service Id ?

 

RazTN7
Dynatrace Champion
Dynatrace Champion

Hey

You can get service ID by clicking on any service then check the url.

RazTN7X_0-1700800041974.png

 

Next question could be "is there any way to get it through API?"

Yes. Its vice versa. If you know service name you could get ID. If you know ID you could get service name. 

api/v2/entities --> entitySelector

To get ID

type(SERVICE),entityName.equals(<SERVICE_NAME>)    OR  type(SERVICE),entityName.contains(<SERVICE_NAME>)

 

To get service name

type(SERVICE),entityId.equals(<SERVICE_ENTITY_ID>)

 

Cheers!

RN

Have a nice day!

jdport
Frequent Guest

Is there a way to filter this by a specific request or requests?    Other than creating a custom metric?

 

Featured Posts