datahub/assets/js/a5983460.e10b9ebd.js
2025-08-22 14:09:31 +00:00

1 line
25 KiB
JavaScript

"use strict";(self.webpackChunkdocs_website=self.webpackChunkdocs_website||[]).push([[70377],{7653:(e,n,t)=>{t.d(n,{A:()=>a});const a={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm127.98 274.82h-.04l-.08.06L512 466.75 384.14 338.88c-.04-.05-.06-.06-.08-.06a.12.12 0 00-.07 0c-.03 0-.05.01-.09.05l-45.02 45.02a.2.2 0 00-.05.09.12.12 0 000 .07v.02a.27.27 0 00.06.06L466.75 512 338.88 639.86c-.05.04-.06.06-.06.08a.12.12 0 000 .07c0 .03.01.05.05.09l45.02 45.02a.2.2 0 00.09.05.12.12 0 00.07 0c.02 0 .04-.01.08-.05L512 557.25l127.86 127.87c.04.04.06.05.08.05a.12.12 0 00.07 0c.03 0 .05-.01.09-.05l45.02-45.02a.2.2 0 00.05-.09.12.12 0 000-.07v-.02a.27.27 0 00-.05-.06L557.25 512l127.87-127.86c.04-.04.05-.06.05-.08a.12.12 0 000-.07c0-.03-.01-.05-.05-.09l-45.02-45.02a.2.2 0 00-.09-.05.12.12 0 00-.07 0z"}}]},name:"close-circle",theme:"filled"}},4732:(e,n,t)=>{t.d(n,{A:()=>l});var a=t(89379),i=t(96540),s=t(7653),r=t(89990),o=function(e,n){return i.createElement(r.A,(0,a.A)((0,a.A)({},e),{},{ref:n,icon:s.A}))};const l=i.forwardRef(o)},15680:(e,n,t)=>{t.d(n,{xA:()=>d,yg:()=>y});var a=t(96540);function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function s(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function r(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?s(Object(t),!0).forEach((function(n){i(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):s(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function o(e,n){if(null==e)return{};var t,a,i=function(e,n){if(null==e)return{};var t,a,i={},s=Object.keys(e);for(a=0;a<s.length;a++)t=s[a],n.indexOf(t)>=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a<s.length;a++)t=s[a],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var l=a.createContext({}),c=function(e){var n=a.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):r(r({},n),e)),t},d=function(e){var n=c(e.components);return a.createElement(l.Provider,{value:n},e.children)},u="mdxType",p={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},g=a.forwardRef((function(e,n){var t=e.components,i=e.mdxType,s=e.originalType,l=e.parentName,d=o(e,["components","mdxType","originalType","parentName"]),u=c(t),g=i,y=u["".concat(l,".").concat(g)]||u[g]||p[g]||s;return t?a.createElement(y,r(r({ref:n},d),{},{components:t})):a.createElement(y,r({ref:n},d))}));function y(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var s=t.length,r=new Array(s);r[0]=g;var o={};for(var l in n)hasOwnProperty.call(n,l)&&(o[l]=n[l]);o.originalType=e,o[u]="string"==typeof e?e:i,r[1]=o;for(var c=2;c<s;c++)r[c]=t[c];return a.createElement.apply(null,r)}return a.createElement.apply(null,t)}g.displayName="MDXCreateElement"},43655:(e,n,t)=>{t.d(n,{A:()=>v});var a=t(96540),i=t(20053);const s="availabilityCard_P5od",r="managedIcon_AxXO",o="platform_wqXv",l="platformAvailable_Y8lN";var c=t(4732),d=t(89379);const u={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 01-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z"}}]},name:"check-circle",theme:"filled"};var p=t(89990),g=function(e,n){return a.createElement(p.A,(0,d.A)((0,d.A)({},e),{},{ref:n,icon:u}))};const y=a.forwardRef(g);const h={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M811.4 418.7C765.6 297.9 648.9 212 512.2 212S258.8 297.8 213 418.6C127.3 441.1 64 519.1 64 612c0 110.5 89.5 200 199.9 200h496.2C870.5 812 960 722.5 960 612c0-92.7-63.1-170.7-148.6-193.3zm36.3 281a123.07 123.07 0 01-87.6 36.3H263.9c-33.1 0-64.2-12.9-87.6-36.3A123.3 123.3 0 01140 612c0-28 9.1-54.3 26.2-76.3a125.7 125.7 0 0166.1-43.7l37.9-9.9 13.9-36.6c8.6-22.8 20.6-44.1 35.7-63.4a245.6 245.6 0 0152.4-49.9c41.1-28.9 89.5-44.2 140-44.2s98.9 15.3 140 44.2c19.9 14 37.5 30.8 52.4 49.9 15.1 19.3 27.1 40.7 35.7 63.4l13.8 36.5 37.8 10c54.3 14.5 92.1 63.8 92.1 120 0 33.1-12.9 64.3-36.3 87.7z"}}]},name:"cloud",theme:"outlined"};var m=function(e,n){return a.createElement(p.A,(0,d.A)((0,d.A)({},e),{},{ref:n,icon:h}))};const f=a.forwardRef(m),v=({saasOnly:e,ossOnly:n})=>a.createElement("div",{className:(0,i.A)(s,"card")},a.createElement("strong",null,"Feature Availability"),a.createElement("div",null,a.createElement("span",{className:(0,i.A)(o,!e&&l)},"Self-Hosted DataHub ",e?a.createElement(c.A,null):a.createElement(y,null))),a.createElement("div",null,a.createElement(f,{className:r}),a.createElement("span",{className:(0,i.A)(o,!n&&l)},"DataHub Cloud ",n?a.createElement(c.A,null):a.createElement(y,null))))},57137:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>u,contentTitle:()=>c,default:()=>h,frontMatter:()=>l,metadata:()=>d,toc:()=>p});t(96540);var a=t(15680),i=t(43655);function s(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(e,n){return n=null!=n?n:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):function(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})),e}function o(e,n){if(null==e)return{};var t,a,i=function(e,n){if(null==e)return{};var t,a,i={},s=Object.keys(e);for(a=0;a<s.length;a++)t=s[a],n.indexOf(t)>=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a<s.length;a++)t=s[a],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}const l={description:"This page provides an overview of working with the DataHub Incidents API.",title:"Incidents",slug:"/incidents/incidents",custom_edit_url:"https://github.com/datahub-project/datahub/blob/master/docs/incidents/incidents.md"},c="Incidents",d={unversionedId:"docs/incidents/incidents",id:"version-1.1.0/docs/incidents/incidents",title:"Incidents",description:"This page provides an overview of working with the DataHub Incidents API.",source:"@site/versioned_docs/version-1.1.0/docs/incidents/incidents.md",sourceDirName:"docs/incidents",slug:"/incidents/incidents",permalink:"/docs/1.1.0/incidents/incidents",draft:!1,editUrl:"https://github.com/datahub-project/datahub/blob/master/docs/incidents/incidents.md",tags:[],version:"1.1.0",frontMatter:{description:"This page provides an overview of working with the DataHub Incidents API.",title:"Incidents",slug:"/incidents/incidents",custom_edit_url:"https://github.com/datahub-project/datahub/blob/master/docs/incidents/incidents.md"},sidebar:"overviewSidebar",previous:{title:"Domains",permalink:"/docs/1.1.0/domains"},next:{title:"UI Based Ingestion / Managed Ingestion",permalink:"/docs/1.1.0/ui-ingestion"}},u={},p=[{value:"Introduction",id:"introduction",level:2},{value:"Creating an Incident",id:"creating-an-incident",level:2},{value:"Resolving an Incident",id:"resolving-an-incident",level:2},{value:"Finding Assets with Active Incidents",id:"finding-assets-with-active-incidents",level:2},{value:"Creating an Incident via API",id:"creating-an-incident-via-api",level:2},{value:"Examples",id:"examples",level:3},{value:"CURL",id:"curl",level:4},{value:"Python",id:"python",level:4},{value:"Retrieving Active Incidents",id:"retrieving-active-incidents",level:2},{value:"Examples",id:"examples-1",level:3},{value:"CURL",id:"curl-1",level:4},{value:"Resolving an Incident via API",id:"resolving-an-incident-via-api",level:2},{value:"Examples",id:"examples-2",level:3},{value:"CURL",id:"curl-2",level:4},{value:"Tips",id:"tips",level:2},{value:"Enabling Slack Notifications (DataHub Cloud Only)",id:"enabling-slack-notifications-datahub-cloud-only",level:2}],g={toc:p},y="wrapper";function h(e){var{components:n}=e,t=o(e,["components"]);return(0,a.yg)(y,r(function(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},a=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(a=a.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),a.forEach((function(n){s(e,n,t[n])}))}return e}({},g,t),{components:n,mdxType:"MDXLayout"}),(0,a.yg)("h1",{id:"incidents"},"Incidents"),(0,a.yg)(i.A,{mdxType:"FeatureAvailability"}),(0,a.yg)("h2",{id:"introduction"},"Introduction"),(0,a.yg)("p",null,(0,a.yg)("strong",{parentName:"p"},"Incidents")," are a concept used to flag particular Data Assets as being in an unhealthy state. Each incident has an independent lifecycle and details including a state (active, resolved), a title, a description, & more."),(0,a.yg)("p",null,"A couple scenarios in which incidents can be useful are"),(0,a.yg)("ol",null,(0,a.yg)("li",{parentName:"ol"},(0,a.yg)("strong",{parentName:"li"},"Communicating Assets with Ongoing Issues"),": You can mark a known-bad data asset as under an ongoing incident so consumers and stakeholders can be informed about the health status of a data asset via the DataHub UI. Moreover, they can follow the incident as it progresses toward resolution."),(0,a.yg)("li",{parentName:"ol"},(0,a.yg)("strong",{parentName:"li"},"Pipeline Circuit Breaking (advanced):")," You can use Incidents as a basis for orchestrating and blocking data pipelines that have inputs with active issues to avoid propagating bad data downstream.")),(0,a.yg)("p",null,"In the next section, we'll walk through how to"),(0,a.yg)("ol",null,(0,a.yg)("li",{parentName:"ol"},"Create a new incident"),(0,a.yg)("li",{parentName:"ol"},"Fetch all incidents for a data asset"),(0,a.yg)("li",{parentName:"ol"},"Resolve an incident")),(0,a.yg)("p",null,"for ",(0,a.yg)("strong",{parentName:"p"},"Datasets"),", ",(0,a.yg)("strong",{parentName:"p"},"Dashboards"),", ",(0,a.yg)("strong",{parentName:"p"},"Charts"),", ",(0,a.yg)("strong",{parentName:"p"},"Data Pipelines")," (Data Flows), and ",(0,a.yg)("strong",{parentName:"p"},"Data Tasks")," (Data Jobs) using the DataHub UI or ",(0,a.yg)("a",{parentName:"p",href:"/docs/1.1.0/api/graphql/overview"},"GraphQL API"),"."),(0,a.yg)("p",null,"Let's get started!"),(0,a.yg)("h2",{id:"creating-an-incident"},"Creating an Incident"),(0,a.yg)("p",null,"To create an incident, simply navigate to the profile page for the asset of interest, click\nthe 3-dot menu icon on the right side of the header, and click ",(0,a.yg)("strong",{parentName:"p"},"Raise Incident"),"."),(0,a.yg)("p",null,"Choose an existing type, or define your own, and then author a title and description of the issue. Finally,\nclick ",(0,a.yg)("inlineCode",{parentName:"p"},"Add")," to create the new issue. This will mark the asset with a health status badge indicating that it\nis possibly unfit for use due to an ongoing issue."),(0,a.yg)("h2",{id:"resolving-an-incident"},"Resolving an Incident"),(0,a.yg)("p",null,"To resolve an incident, simply naviagte to the profile page for the asset of interest, click\nthe ",(0,a.yg)("strong",{parentName:"p"},"Incidents")," tab, and then click the ",(0,a.yg)("strong",{parentName:"p"},"Resolve")," button for the incident of interest.\nThis will resolve the incident from the list of active incidents for the asset, removing it from the\nasset's health status."),(0,a.yg)("h2",{id:"finding-assets-with-active-incidents"},"Finding Assets with Active Incidents"),(0,a.yg)("p",null,"To view all assets with active incidents, simply apply the ",(0,a.yg)("inlineCode",{parentName:"p"},"Has Active Incidents")," filter on the search results page of DataHub.\nTo view all assets first, click ",(0,a.yg)("strong",{parentName:"p"},"Explore all")," on the DataHub homepage."),(0,a.yg)("h2",{id:"creating-an-incident-via-api"},"Creating an Incident via API"),(0,a.yg)("p",null,"Oftentimes it is desirable to raise and resolve incidents for particular data assets in automated fashion using the DataHub API, e.g. as part of an\norchestration pipeline."),(0,a.yg)("p",null,"To create (i.e. raise) a new incident for a data asset, simply create a GraphQL request using the ",(0,a.yg)("inlineCode",{parentName:"p"},"raiseIncident")," mutation."),(0,a.yg)("pre",null,(0,a.yg)("code",{parentName:"pre"},'type Mutation {\n """\n Raise a new incident for a data asset\n """\n raiseIncident(input: RaiseIncidentInput!): String! # Returns new Incident URN.\n}\n\ninput RaiseIncidentInput {\n """\n The type of incident, e.g. OPERATIONAL\n """\n type: IncidentType!\n\n """\n A custom type of incident. Present only if type is \'CUSTOM\'\n """\n customType: String\n\n """\n An optional title associated with the incident\n """\n title: String\n\n """\n An optional description associated with the incident\n """\n description: String\n\n """\n The resource (dataset, dashboard, chart, dataFlow, etc) that the incident is associated with.\n """\n resourceUrn: String!\n\n """\n The source of the incident, i.e. how it was generated\n """\n source: IncidentSourceInput\n}\n')),(0,a.yg)("h3",{id:"examples"},"Examples"),(0,a.yg)("p",null,"First, we'll create a demo GraphQL query, then show how to represent it via CURL & Python."),(0,a.yg)("p",null,"Imagine we want to raise a new incident on a Dataset with URN ",(0,a.yg)("inlineCode",{parentName:"p"},"urn:li:dataset:(abc)")," because it's failed automated quality checks. To do so, we could make the following GraphQL query:"),(0,a.yg)("p",null,(0,a.yg)("em",{parentName:"p"},"Request")),(0,a.yg)("pre",null,(0,a.yg)("code",{parentName:"pre"},'mutation raiseIncident {\n raiseIncident(input: {\n type: OPERATIONAL\n title: "Dataset Failed Quality Checks"\n description: "Dataset failed 2/6 Quality Checks for suite run id xy123mksj812pk23."\n resourceUrn: "urn:li:dataset:(urn:li:dataPlatform:kafka,SampleKafkaDataset,PROD)"\n })\n}\n')),(0,a.yg)("p",null,"After we make this query, we will get back a unique URN for the incident."),(0,a.yg)("p",null,(0,a.yg)("em",{parentName:"p"},"Response")),(0,a.yg)("pre",null,(0,a.yg)("code",{parentName:"pre"},'{\n "data": {\n "raiseIncident": "urn:li:incident:bfecab62-dc10-49a6-a305-78ce0cc6e5b1"\n }\n}\n')),(0,a.yg)("p",null,"Now we'll see how to issue this query using a CURL or Python."),(0,a.yg)("h4",{id:"curl"},"CURL"),(0,a.yg)("p",null,"To issue the above GraphQL as a CURL:"),(0,a.yg)("pre",null,(0,a.yg)("code",{parentName:"pre"},'curl --location --request POST \'https://your-account.acryl.io/api/graphql\' \\\n--header \'Authorization: Bearer your-access-token\' \\\n--header \'Content-Type: application/json\' \\\n--data-raw \'{"query":"mutation raiseIncident {\\n raiseIncident(input: {\\n type: OPERATIONAL\\n title: \\"Dataset Failed Quality Checks\\"\\n description: \\"Dataset failed 2/6 Quality Checks for suite run id xy123mksj812pk23.\\"\\n resourceUrn: \\"urn:li:dataset:(urn:li:dataPlatform:kafka,SampleKafkaDataset,PROD)\\"\\n })\\n}","variables":{}}\'\n')),(0,a.yg)("h4",{id:"python"},"Python"),(0,a.yg)("p",null,"To issue the above GraphQL query in Python (requests):"),(0,a.yg)("pre",null,(0,a.yg)("code",{parentName:"pre"},'import requests\n\ndatahub_session = requests.Session()\n\nheaders = {\n "Content-Type": "application/json",\n "Authorization": "Bearer your-personal-access-token",\n}\n\njson = {\n "query": """mutation raiseIncident {\\n\n raiseIncident(input: {\\n\n type: OPERATIONAL\\n\n resourceUrn: \\"urn:li:dataset:(urn:li:dataPlatform:kafka,SampleKafkaDataset,PROD)\\"\\n\n })}""",\n "variables": {},\n}\n\nresponse = datahub_session.post(f"https://your-account.acryl.io/api/graphql", headers=headers, json=json)\nresponse.raise_for_status()\nres_data = response.json() # Get result as JSON\n')),(0,a.yg)("h2",{id:"retrieving-active-incidents"},"Retrieving Active Incidents"),(0,a.yg)("p",null,"To fetch the the ongoing incidents for a data asset, we can use the ",(0,a.yg)("inlineCode",{parentName:"p"},"incidents")," GraphQL field on the entity of interest."),(0,a.yg)("p",null,"To retrieve all incidents for a Dataset with a particular ",(0,a.yg)("a",{parentName:"p",href:"/docs/1.1.0/what/urn"},"URN"),", you can reference the 'incidents' field of the Dataset type:"),(0,a.yg)("pre",null,(0,a.yg)("code",{parentName:"pre"},'type Dataset {\n ....\n """\n Incidents associated with the Dataset\n """\n incidents(\n """\n Optional incident state to filter by, defaults to any state.\n """\n state: IncidentState,\n """\n Optional start offset, defaults to 0.\n """\n start: Int,\n """\n Optional start offset, defaults to 20.\n """\n count: Int): EntityIncidentsResult # Returns a list of incidents.\n}\n')),(0,a.yg)("h3",{id:"examples-1"},"Examples"),(0,a.yg)("p",null,'Now that we\'ve raised an incident on it, imagine we want to fetch the first 10 "active" incidents for the Dataset with URN ',(0,a.yg)("inlineCode",{parentName:"p"},"urn:li:dataset:(abc"),"). To do so, we could issue the following request:"),(0,a.yg)("p",null,(0,a.yg)("em",{parentName:"p"},"Request")),(0,a.yg)("pre",null,(0,a.yg)("code",{parentName:"pre"},'query dataset {\n dataset(urn: "urn:li:dataset:(abc)") {\n incidents(state: ACTIVE, start: 0, count: 10) {\n total\n incidents {\n urn\n title\n description\n status {\n state\n }\n }\n }\n }\n}\n')),(0,a.yg)("p",null,"After we make this query, we will get back a unique URN for the incident."),(0,a.yg)("p",null,(0,a.yg)("em",{parentName:"p"},"Response")),(0,a.yg)("pre",null,(0,a.yg)("code",{parentName:"pre"},'{\n "data": {\n "dataset": {\n "incidents": {\n "total": 1,\n "incidents": [\n {\n "urn": "urn:li:incident:bfecab62-dc10-49a6-a305-78ce0cc6e5b1",\n "title": "Dataset Failed Quality Check",\n "description": "Dataset failed 2/6 Quality Checks for suite run id xy123mksj812pk23.",\n "status": {\n "state": "ACTIVE"\n }\n }\n ]\n }\n }\n }\n}\n')),(0,a.yg)("p",null,"Now we'll see how to issue this query using a CURL or Python."),(0,a.yg)("h4",{id:"curl-1"},"CURL"),(0,a.yg)("p",null,"To issue the above GraphQL as a CURL:"),(0,a.yg)("pre",null,(0,a.yg)("code",{parentName:"pre"},"curl --location --request POST 'https://your-account.acryl.io/api/graphql' \\\n--header 'Authorization: Bearer your-access-token' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\"query\":\"query dataset {\\n dataset(urn: \"urn:li:dataset:(abc)\") {\\n incidents(state: ACTIVE, start: 0, count: 10) {\\n total\\n incidents {\\n urn\\n title\\n description\\n status {\\n state\\n }\\n }\\n }\\n }\\n}\",\"variables\":{}}'Python\n")),(0,a.yg)("p",null,"To issue the above GraphQL query in Python (requests):"),(0,a.yg)("pre",null,(0,a.yg)("code",{parentName:"pre"},'import requests\n\ndatahub_session = requests.Session()\n\nheaders = {\n "Content-Type": "application/json",\n "Authorization": "Bearer your-personal-access-token",\n}\n\njson = {\n "query": """query dataset {\\n\n dataset(urn: "urn:li:dataset:(abc)") {\\n\n incidents(state: ACTIVE, start: 0, count: 10) {\\n\n total\\n\n incidents {\\n\n urn\\n\n title\\n\n description\\n\n status {\\n\n state\\n\n }\\n\n }\\n\n }\\n\n }\\n\n }""",\n "variables": {},\n}\n\nresponse = datahub_session.post(f"https://your-account.acryl.io/api/graphql", headers=headers, json=json)\nresponse.raise_for_status()\nres_data = response.json() # Get result as JSON\n')),(0,a.yg)("h2",{id:"resolving-an-incident-via-api"},"Resolving an Incident via API"),(0,a.yg)("p",null,"To resolve an incident for a data asset, simply create a GraphQL request using the ",(0,a.yg)("inlineCode",{parentName:"p"},"updateIncidentStatus")," mutation. To mark an incident as resolved, simply update its state to ",(0,a.yg)("inlineCode",{parentName:"p"},"RESOLVED"),"."),(0,a.yg)("pre",null,(0,a.yg)("code",{parentName:"pre"},'type Mutation {\n """\n Update an existing incident for a resource (asset)\n """\n updateIncidentStatus(\n """\n The urn for an existing incident\n """\n urn: String!\n\n """\n Input required to update the state of an existing incident\n """\n input: UpdateIncidentStatusInput!): String\n}\n\n"""\nInput required to update status of an existing incident\n"""\ninput UpdateIncidentStatusInput {\n """\n The new state of the incident\n """\n state: IncidentState!\n\n """\n An optional message associated with the new state\n """\n message: String\n}\n')),(0,a.yg)("h3",{id:"examples-2"},"Examples"),(0,a.yg)("p",null,"Imagine that we've fixed our Dataset with urn ",(0,a.yg)("inlineCode",{parentName:"p"},"urn:li:dataset:(abc)")," so that it's passing validation. Now we want to mark the Dataset as healthy, so stakeholders and downstream consumers know it's ready to use."),(0,a.yg)("p",null,"To do so, we need the URN of the Incident that we raised previously."),(0,a.yg)("p",null,(0,a.yg)("em",{parentName:"p"},"Request")),(0,a.yg)("pre",null,(0,a.yg)("code",{parentName:"pre"},'mutation updateIncidentStatus {\n updateIncidentStatus(urn: "urn:li:incident:bfecab62-dc10-49a6-a305-78ce0cc6e5b1",\n input: {\n state: RESOLVED\n message: "Dataset is now passing validations. Verified by John Joyce on Data Platform eng."\n })\n}\n')),(0,a.yg)("p",null,(0,a.yg)("em",{parentName:"p"},"Response")),(0,a.yg)("pre",null,(0,a.yg)("code",{parentName:"pre"},'{\n "data": {\n "updateIncidentStatus": "true"\n }\n}\n')),(0,a.yg)("p",null,"True is returned if the incident's was successfully marked as resolved."),(0,a.yg)("h4",{id:"curl-2"},"CURL"),(0,a.yg)("p",null,"To issue the above GraphQL as a CURL:"),(0,a.yg)("pre",null,(0,a.yg)("code",{parentName:"pre"},'curl --location --request POST \'https://your-account.acryl.io/api/graphql\' \\\n--header \'Authorization: Bearer your-access-token\' \\\n--header \'Content-Type: application/json\' \\\n--data-raw \'{"query":"mutation updateIncidentStatus {\\n updateIncidentStatus(urn: "urn:li:incident:bfecab62-dc10-49a6-a305-78ce0cc6e5b1", \\n input: {\\n state: RESOLVED\\n message: "Dataset is now passing validations. Verified by John Joyce on Data Platform eng."\\n })\\n}","variables":{}}\'Python\n')),(0,a.yg)("p",null,"To issue the above GraphQL query in Python (requests):"),(0,a.yg)("pre",null,(0,a.yg)("code",{parentName:"pre"},'import requests\n\ndatahub_session = requests.Session()\n\nheaders = {\n "Content-Type": "application/json",\n "Authorization": "Bearer your-personal-access-token",\n}\n\njson = {\n "query": """mutation updateIncidentStatus {\\n\n updateIncidentStatus(urn: \\"urn:li:incident:bfecab62-dc10-49a6-a305-78ce0cc6e5b1\\",\\n\n input: {\\n\n state: RESOLVED\\n\n message: \\"Dataset is now passing validations. Verified by John Joyce on Data Platform eng.\\"\\n\n })\\n\n }""",\n "variables": {},\n}\n\nresponse = datahub_session.post(f"https://your-account.acryl.io/api/graphql", headers=headers, json=json)\nresponse.raise_for_status()\nres_data = response.json() # Get result as JSON\n')),(0,a.yg)("h2",{id:"tips"},"Tips"),(0,a.yg)("admonition",{type:"info"},(0,a.yg)("p",{parentName:"admonition"},(0,a.yg)("strong",{parentName:"p"},"Authorization")),(0,a.yg)("p",{parentName:"admonition"},"Remember to always provide a DataHub Personal Access Token when calling the GraphQL API. To do so, just add the 'Authorization' header as follows:"),(0,a.yg)("pre",{parentName:"admonition"},(0,a.yg)("code",{parentName:"pre"},"Authorization: Bearer <personal-access-token>\n")),(0,a.yg)("p",{parentName:"admonition"},(0,a.yg)("strong",{parentName:"p"},"Exploring GraphQL API")),(0,a.yg)("p",{parentName:"admonition"},"Also, remember that you can play with an interactive version of the GraphQL API at ",(0,a.yg)("inlineCode",{parentName:"p"},"https://your-account-id.acryl.io/api/graphiql"))),(0,a.yg)("h2",{id:"enabling-slack-notifications-datahub-cloud-only"},"Enabling Slack Notifications (DataHub Cloud Only)"),(0,a.yg)("p",null,"In DataHub Cloud, you can configure your to send Slack notifications to a specific channel when incidents are raised or their status is changed."),(0,a.yg)("p",null,"These notifications are also able to tag the immediate asset's owners, along with the owners of downstream assets consuming it."),(0,a.yg)("p",{align:"center"},(0,a.yg)("img",{width:"70%",src:"https://raw.githubusercontent.com/datahub-project/static-assets/main/imgs/saas/Screen-Shot-2022-03-22-at-6.46.41-PM.png"})),(0,a.yg)("p",null,"To do so, simply follow the ",(0,a.yg)("a",{parentName:"p",href:"/docs/1.1.0/managed-datahub/slack/saas-slack-setup"},"Slack Integration Guide")," and contact your DataHub Cloud customer success team to enable the feature!"))}h.isMDXComponent=!0}}]);