Skip to main content

    Davis® AI - Predictive and Causal

    Overview

    This SDK allows you to interact with Davis® predictive and causal AI for customized AI/ML analysis.

    Refer to the service documentation to get familiar with the key concepts.

    npm install @dynatrace-sdk/client-davis-analyzers

    analyzersClient

    import { analyzersClient } from '@dynatrace-sdk/client-davis-analyzers';

    cancelAnalyzerExecution

    analyzersClient.cancelAnalyzerExecution(config): Promise<void | AnalyzerCancelResult>

    Stop a started analyzer execution.

    Required scope: davis:analyzers:execute

    Use the request token that was returned when starting an analyzer execution to cancel it.

    Parameters

    NameTypeDescription
    config.analyzerName*requiredstringThe name of the analyzer.
    config.requestToken*requiredstring

    The request token is returned when starting a long-running analyzer execution. It can be used to do follow-up operations like polling and cancelling.

    Returns

    Return typeStatus codeDescription
    AnalyzerCancelResult200The current analyzer execution status and an optional partial result.
    void202The cancel request was accepted and is being processed.

    Throws

    Error TypeError Message
    AnalyzerErrorEnvelopeErrorInvalid or malformed request. | Insufficient permissions. | No analyzer available with the requested name. | The analyzer result with the request token has already been consumed or its time-to-live (TTL) has been reached. The result is not available anymore. | Client error. | Internal server error.

    Code example

    import { analyzersClient } from "@dynatrace-sdk/client-davis-analyzers";

    const data = await analyzersClient.cancelAnalyzerExecution({
    analyzerName: "...",
    requestToken: "RHluYXRyYWNlMjAyMw==",
    });

    executeAnalyzer

    analyzersClient.executeAnalyzer(config): Promise<AnalyzerExecuteResult>

    Execute an analyzer with the given input.

    Required scope: davis:analyzers:execute

    The analyzer execution is started asynchronously. If the result is not available after the specified timeout, a request token is returned to poll for the result. Otherwise, the final result is directly available and no request token is returned.

    Depending on the chosen analyzer and the analyzer input, additional scopes might be required, e.g. storage:buckets:read and storage:metrics:read to enable the analyzer to read time series data from Grail™.

    Parameters

    NameTypeDescription
    config.analyzerName*requiredstringThe name of the analyzer.
    config.body*requiredAnalyzerInput
    config.enablePreviewboolean

    Indicates if analyzer results should preview already created outputs while the analyzer is still running.

    Set to false if only the final result is needed.

    config.timeoutSecondsnumber

    The amount of seconds to wait for the response to be returned.

    The timeout controls how long the client is willing to wait, while the analyzer execution continues running until it has finished or is cancelled.

    Returns

    Return typeStatus codeDescription
    AnalyzerExecuteResult200The final analyzer result and execution status.
    AnalyzerExecuteResult202The current analyzer execution status and a request token and time-to-live (TTL) to continue polling the result with.

    Throws

    Error TypeError Message
    AnalyzerErrorEnvelopeErrorInvalid or malformed request. | Insufficient permissions. | No analyzer available with the requested name. | Client error. | Internal server error.

    Code example

    import { analyzersClient } from "@dynatrace-sdk/client-davis-analyzers";

    const data = await analyzersClient.executeAnalyzer({
    analyzerName: "...",
    body: {
    timeSeriesData: {
    expression: "timeseries avg(dt.host.cpu.usage)",
    },
    forecastHorizon: 10,
    },
    });

    getAnalyzer

    analyzersClient.getAnalyzer(config): Promise<AnalyzerDefinitionDetails>

    Get the analyzer definition for an analyzer.

    Required scope: davis:analyzers:read

    All available meta-information for the analyzer is returned.

    Parameters

    NameTypeDescription
    config.analyzerName*requiredstringThe name of the analyzer.

    Returns

    Return typeStatus codeDescription
    AnalyzerDefinitionDetails200The definition of the requested analyzer.

    Throws

    Error TypeError Message
    AnalyzerErrorEnvelopeErrorInvalid or malformed request. | Insufficient permissions. | No analyzer available with the requested name. | Client error. | Internal server error.

    Code example

    import { analyzersClient } from "@dynatrace-sdk/client-davis-analyzers";

    const data = await analyzersClient.getAnalyzer({
    analyzerName: "...",
    });

    getAnalyzerDocumentation

    analyzersClient.getAnalyzerDocumentation(config): Promise<Binary>

    Get the documentation for an analyzer.

    Required scope: davis:analyzers:read

    A documentation may provide further information and context for a given analyzer. Not all analyzers provide documentation.

    The documentation is returned as Markdown.

    Parameters

    NameTypeDescription
    config.analyzerName*requiredstringThe name of the analyzer.

    Returns

    Return typeStatus codeDescription
    void200The documentation of the requested analyzer.

    Throws

    Error TypeError Message
    AnalyzerErrorEnvelopeErrorInvalid or malformed request. | Insufficient permissions. | No analyzer available with the requested name. | Client error. | Internal server error.

    Code example

    import { analyzersClient } from "@dynatrace-sdk/client-davis-analyzers";

    const data = await analyzersClient.getAnalyzerDocumentation(
    { analyzerName: "..." },
    );

    getJsonSchemaForInput

    analyzersClient.getJsonSchemaForInput(config): Promise<Record<string | any>>

    Get the JSON schema for an analyzer input.

    Required scope: davis:analyzers:read

    The JSON schema defines a standardized declaration of the input structure, providing well-defined input documentation that is both human- and machine-readable.

    Parameters

    NameTypeDescription
    config.analyzerName*requiredstringThe name of the analyzer.

    Returns

    Return typeStatus codeDescription
    void200The JSON input schema of the requested analyzer.

    Throws

    Error TypeError Message
    AnalyzerErrorEnvelopeErrorInvalid or malformed request. | Insufficient permissions. | No analyzer available with the requested name. | Client error. | Internal server error.

    Code example

    import { analyzersClient } from "@dynatrace-sdk/client-davis-analyzers";

    const data = await analyzersClient.getJsonSchemaForInput({
    analyzerName: "...",
    });

    getJsonSchemaForResult

    analyzersClient.getJsonSchemaForResult(config): Promise<Record<string | any>>

    Get the JSON schema for an analyzer result.

    Required scope: davis:analyzers:read

    The JSON schema defines a standardized declaration of the output structure, providing well-defined output documentation that is both human- and machine-readable.

    Parameters

    NameTypeDescription
    config.analyzerName*requiredstringThe name of the analyzer.

    Returns

    Return typeStatus codeDescription
    void200The JSON result schema of the requested analyzer.

    Throws

    Error TypeError Message
    AnalyzerErrorEnvelopeErrorInvalid or malformed request. | Insufficient permissions. | No analyzer available with the requested name. | Client error. | Internal server error.

    Code example

    import { analyzersClient } from "@dynatrace-sdk/client-davis-analyzers";

    const data = await analyzersClient.getJsonSchemaForResult({
    analyzerName: "...",
    });

    pollAnalyzerExecution

    analyzersClient.pollAnalyzerExecution(config): Promise<AnalyzerPollResult>

    Poll for the result of a started analyzer execution.

    Required scope: davis:analyzers:execute

    Use the request token returned when starting an analyzer execution to poll for a result.

    The executionStatus of the result indicates if the analyzer execution is already completed. While the status is RUNNING, wait and poll for the result again in subsequent calls.

    Parameters

    NameTypeDescription
    config.analyzerName*requiredstringThe name of the analyzer.
    config.requestToken*requiredstring

    The request token is returned when starting a long-running analyzer execution. It can be used to do follow-up operations like polling and cancelling.

    config.timeoutSecondsnumber

    The amount of seconds to wait for the response to be returned.

    The timeout controls how long the client is willing to wait, while the analyzer execution continues running until it has finished or is cancelled.

    Returns

    Return typeStatus codeDescription
    AnalyzerPollResult200The current analyzer execution status and an optional partial result.

    Throws

    Error TypeError Message
    AnalyzerErrorEnvelopeErrorInvalid or malformed request. | Insufficient permissions. | No analyzer available with the requested name. | The analyzer result with the request token has already been consumed or its time-to-live (TTL) has been reached. The result is not available anymore. | Client error. | Internal server error.

    Code example

    import { analyzersClient } from "@dynatrace-sdk/client-davis-analyzers";

    const data = await analyzersClient.pollAnalyzerExecution({
    analyzerName: "...",
    requestToken: "RHluYXRyYWNlMjAyMw==",
    });

    queryAnalyzers

    analyzersClient.queryAnalyzers(config): Promise<AnalyzerQueryResult>

    Query all available analyzer definitions.

    Required scope: davis:analyzers:read

    The analyzer definition contains meta-information about an analyzer, including its input and output structure:

    • The input definition specifies which fields the analyzer accepts, some of which may be required.
    • The output definition specifies how the returned analyzer result is structured.

    Parameters

    NameTypeDescription
    config.addFieldsstring

    Specify which meta-information to fetch in addition to the default fields name, displayName and description.

    Valid values are:

    • analyzerCall
    • baseAnalyzer
    • category
    • input
    • labels
    • output
    • type

    Any other field will result in a HTTP 400 response.

    config.filterstring

    Use the filter parameter to only fetch a subset of analyzer definitions.

    When using the operators =and !=, filtering is case sensitive.

    The following operators are supported:

    • =
    • !=
    • contains
    • starts-with
    • ends-with
    • and
    • or

    Parenthesis and the not operator are currently not supported.

    The following fields are valid filtering parameters:

    • baseAnalyzer
    • description
    • displayName
    • labels
    • name
    • type

    Any other field will result in a HTTP 400 response.

    config.pageKeystring

    The cursor for the page of results. Find it in the nextPageKey field of the previous response.

    If the page-key parameter is used, no other query parameters must be provided.

    If not provided, the first page is always returned.

    config.pageSizenumber

    The amount of returned analyzer definitions in a single response payload. By default, 50 is used. The maximum is 200.

    Returns

    Return typeStatus codeDescription
    AnalyzerQueryResult200All available analyzer definitions.

    Throws

    Error TypeError Message
    AnalyzerErrorEnvelopeErrorInsufficient permissions. | Client error. | Internal server error.

    Code example

    import { analyzersClient } from "@dynatrace-sdk/client-davis-analyzers";

    const data = await analyzersClient.queryAnalyzers();

    validateAnalyzerExecution

    analyzersClient.validateAnalyzerExecution(config): Promise<AnalyzerValidationResult>

    Validate the provided input for an analyzer execution.

    Required scope: davis:analyzers:execute

    Provide the same input that is planned to be used for an analyzer execution to have it validated without executing the analyzer.

    Parameters

    NameTypeDescription
    config.analyzerName*requiredstringThe name of the analyzer.
    config.body*requiredAnalyzerInput

    Returns

    Return typeStatus codeDescription
    AnalyzerValidationResult200The validation result for the requested analyzer execution.

    Throws

    Error TypeError Message
    AnalyzerErrorEnvelopeErrorNo analyzer available with the requested name. | Insufficient permissions. | Not found | Client error. | Internal server error.

    Code example

    import { analyzersClient } from "@dynatrace-sdk/client-davis-analyzers";

    const data =
    await analyzersClient.validateAnalyzerExecution({
    analyzerName: "...",
    body: {},
    });

    Types

    AnalyzerCancelResult

    Result of cancelling the analyzer execution. Only returned if the result completes while cancelling.

    NameTypeDescription
    requestTokenstring

    The request token is returned when starting a long-running analyzer execution. It can be used to do follow-up operations like polling and cancelling.

    result*requiredAnalyzerResult
    ttlInSecondsnumberTime-to-live until the result is not available anymore.

    AnalyzerCategory

    The category of an analyzer used to logically group different analyzers.

    NameType
    displayName*requiredstring

    AnalyzerData

    The map of actual data matching the input and output definition of the analyzer.

    type: Record<string, any>

    AnalyzerDefinition

    The definition of the analyzer. It describes which input and output data the analyzer accepts and produces when being executed.

    NameTypeDescription
    baseAnalyzerstring

    The analyzer name that the current analyzer is based on. All input and output parameters are inherited. Additional parameters may be present in the current analyzer.

    categoryAnalyzerCategoryThe category of an analyzer used to logically group different analyzers.
    descriptionstring

    Detailed description of the analyzers' functionality. Get the documentation of the analyzer for more information.

    displayName*requiredstring
    inputArray<ParameterDefinition>
    labelsArray<string>A list of string-based labels to group and mark different analyzers.
    name*requiredstringThe uniquely identifying name of the analyzer.
    outputArray<ParameterDefinition>
    type"IMPLEMENTED" | "INTERFACE"

    The type of the analyzer.

    • IMPLEMENTED: Analyzers which have an implementation and can be executed.
    • INTERFACE: Just an interface to be implemented or extended by other analyzer definitions.

    AnalyzerDefinitionDetails

    The definition of the analyzer. It describes which input and output data the analyzer accepts and produces when being executed.

    NameTypeDescription
    baseAnalyzerstring

    The analyzer name that the current analyzer is based on. All input and output parameters are inherited. Additional parameters may be present in the current analyzer.

    categoryAnalyzerCategoryThe category of an analyzer used to logically group different analyzers.
    descriptionstring

    Detailed description of the analyzers' functionality. Get the documentation of the analyzer for more information.

    displayName*requiredstring
    inputArray<ParameterDefinition>
    labelsArray<string>A list of string-based labels to group and mark different analyzers.
    name*requiredstringThe uniquely identifying name of the analyzer.
    outputArray<ParameterDefinition>
    type"IMPLEMENTED" | "INTERFACE"

    The type of the analyzer.

    • IMPLEMENTED: Analyzers which have an implementation and can be executed.
    • INTERFACE: Just an interface to be implemented or extended by other analyzer definitions.

    AnalyzerDimensionalData

    A list of resolved dimensional data.

    NameTypeDescription
    query*requiredDimensionQueryA query for dimensional data such as timeseries, entities, or logs.
    type*required"entityId" | "timeseriesArray"The type of the dimensional query.
    value*requiredAnalyzerDimensionalDataValueThe resolved value of the dimensional query.

    AnalyzerError

    The error that is returned for unsuccessful responses.

    NameTypeDescription
    code*requirednumberThe HTTP status code of the error.
    detailsAnalyzerErrorDetails
    message*requiredstring

    AnalyzerErrorDetails

    NameType
    constraintViolationsArray<ConstraintViolation>

    AnalyzerErrorEnvelope

    NameTypeDescription
    errorAnalyzerErrorThe error that is returned for unsuccessful responses.

    AnalyzerExecuteResult

    Result of the analyzer execution.

    NameTypeDescription
    requestTokenstring

    The request token is returned when starting a long-running analyzer execution. It can be used to do follow-up operations like polling and cancelling.

    result*requiredAnalyzerResult
    ttlInSecondsnumberTime-to-live until the result is not available anymore.

    AnalyzerExecutionLog

    NameTypeDescription
    level*required"TRACING" | "INFO" | "WARNING" | "SEVERE"Determines the severity of the log.
    message*requiredstring
    pathstring

    A path pointing to the source of the error in the input. The format of the path follows the JSON path specification.

    AnalyzerGeneralParameters

    Parameters that are present in all analyzer input parameter definitions.

    NameTypeDescription
    logVerbosity"TRACING" | "INFO" | "WARNING" | "SEVERE"Determines the severity of the log.
    resolveDimensionalQueryDatabooleandefault: false
    timeframeTimeframe

    AnalyzerInput

    The input is specific to an analyzer. Get the definition of the analyzer to retrieve the required input structure.

    NameTypeDescription
    generalParametersAnalyzerGeneralParametersParameters that are present in all analyzer input parameter definitions.

    AnalyzerOutput

    The output is specific to an analyzer. Get the definition of the analyzer to retrieve the required output structure.

    NameTypeDescription
    systemAnalyzerOutputSystemParametersParameters that are present in all analyzer output parameter definitions.

    AnalyzerOutputLog

    NameType
    level*required"TRACING" | "INFO" | "WARNING"
    message*requiredstring

    AnalyzerOutputSystemParameters

    Parameters that are present in all analyzer output parameter definitions.

    NameType
    logsArray<AnalyzerOutputLog>

    AnalyzerPollResult

    Result of polling the analyzer execution.

    NameTypeDescription
    requestTokenstring

    The request token is returned when starting a long-running analyzer execution. It can be used to do follow-up operations like polling and cancelling.

    result*requiredAnalyzerResult
    ttlInSecondsnumberTime-to-live until the result is not available anymore.

    AnalyzerQueryResult

    The list of available analyzers.

    NameTypeDescription
    analyzers*requiredArray<AnalyzerDefinition>
    nextPageKeystring

    The key that should be used to do follow-up requests, fetching the remaining analyzers. If the last page is reached or all analyzers are already listed, this field is omitted.

    totalCount*requirednumberThe total amount of analyzers available opposed to the current page size.

    AnalyzerResult

    NameTypeDescription
    dataArray<AnalyzerDimensionalData>
    executionStatus*required"RUNNING" | "ABORTED" | "COMPLETED"
    input*requiredAnalyzerInputThe input is specific to an analyzer. Get the definition of the analyzer to retrieve the required input structure.
    logsArray<AnalyzerExecutionLog>
    output*requiredArray<AnalyzerOutput>
    resultId*requiredstringThe uniquely identifying ID of the result. Used for logging.
    resultStatus*required"SUCCESSFUL" | "SUCCESSFUL_WITH_WARNINGS" | "FAILED"

    AnalyzerValidationResult

    The result of the dry-execution of the analyzer.

    NameTypeDescription
    detailsAnalyzerErrorDetails
    valid*requiredbooleanWhether the analyzer can be successfully executed with the given input data.

    ConstraintViolation

    A constraint violation indicating why an error has occurred.

    NameTypeDescription
    level*required"TRACING" | "INFO" | "WARNING" | "SEVERE"Determines the severity of the log.
    message*requiredstring
    pathstring

    A path pointing to the source of the error in the input. The format of the path follows the JSON path specification.

    EnumerationElement

    An object that has a fixed set of possible values differentiated by the key property.

    NameType
    description*requiredstring
    displayName*requiredstring
    key*requiredstring

    ParameterDefinition

    The definition for a single parameter, describing its name and other meta information.

    NameTypeDescription
    advancedbooleanIf true, this parameter is considered to be for advanced usage.
    array*requiredbooleanWhether this parameter can have an array of values. Passing a single, non-array value is also allowed.
    defaultValueanyThe default value used when the parameter is omitted.
    descriptionstring
    displayName*requiredstring
    enumerationValuesArray<EnumerationElement>
    extendedTypestring

    Provides extended type information for this parameter. This allows additional semantics that can be utilized by analyzer consumers.

    fieldsArray<ParameterDefinition>Given the parameter is of type structure this property contains the sub-definition of the parameter.
    maxSizenumberThe maximum number of elements if the parameter is an array.
    name*requiredstring
    optional*requiredbooleanWhether this parameter can be omitted when executing the analyzer.
    type*required"string" | "number" | "boolean" | "timeseriesArray" | "analyzerStructure" | "dimensionQuery" | "enumeration" | "integer" | "timeframe" | "timeseriesQuery" | "timestamp"The type of the parameter, indicating the format of the value to be provided.
    valueConstraintsParameterDefinitionValueConstraintsDefines value constraints for string or number parameters. Not applicable to other parameter types.

    Timeframe

    NameTypeDescription
    endTimestring

    Specify the end time in either absolute or relative format. For absolute format, use the ISO 8601 format (yyyy-MM-ddTHH:mm:ssZ). For relative format, use 'now' for the current time or apply an offset with the available units: 's' for seconds, 'm' for minutes, 'h' for hours, and 'd' for days. For example, use 'now-2h' or '-2h' for a relative offset of 2 hours. If not specified, defaults to now.

    startTime*requiredstring

    Specify the start time in either absolute or relative format. For absolute format, use the ISO 8601 format (yyyy-MM-ddTHH:mm:ssZ). For relative format, use 'now' for the current time or apply an offset with the available units: 's' for seconds, 'm' for minutes, 'h' for hours, and 'd' for days. For example, use 'now-2h' or '-2h' for a relative offset of 2 hours.

    Enums

    AnalyzerDefinitionType

    The type of the analyzer.

    • IMPLEMENTED: Analyzers which have an implementation and can be executed.
    • INTERFACE: Just an interface to be implemented or extended by other analyzer definitions.

    Enum keys

    Implemented | Interface

    AnalyzerDimensionalDataType

    The type of the dimensional query.

    Enum keys

    EntityId | TimeseriesArray

    AnalyzerExecutionLogLevel

    Determines the severity of the log.

    Enum keys

    Info | Severe | Tracing | Warning

    AnalyzerOutputLogLevel

    Enum keys

    Info | Tracing | Warning

    AnalyzerResultExecutionStatus

    Enum keys

    Aborted | Completed | Running

    AnalyzerResultResultStatus

    Enum keys

    Failed | Successful | SuccessfulWithWarnings

    ParameterDefinitionType

    The type of the parameter, indicating the format of the value to be provided.

    Enum keys

    AnalyzerStructure | Boolean | DimensionQuery | Enumeration | Integer | Number | String | Timeframe | TimeseriesArray | TimeseriesQuery | Timestamp

    Still have questions?
    Find answers in the Dynatrace Community