Skip to main content

Development assistance

Dynatrace Extensions leverages the full power of your VS Code editor to help you create better extensions faster.

Read on to learn how to make the most out of these features.

Feature overview

Feature typeDescription
Code completionsSuggestions for auto-completing words or fields of the manifest
Code actionsCommands generating or editing the content of your extension's manifest
Code lensAdditional commands to interact with extension data
Fast development modeA workflow focused on speed of delivery
DiagnosticsAdditional diagnostics beyond simple schema validation

Code completions

Code completions or suggestions happen at key points within the extension manifest. Either automatically or on-demand (using Ctrl + Space), these offer known values that can be inserted at the location of your cursor.

Implemented triggers

Keyword triggerEffects
On fromType: or toType: inside topology.relationships list itemsBrowse built-in and custom entity types
On sourceAttribute: inside mappingRules list items of topology relationshipsBrowse entity attributes (entity needs to be present in the fromType attribute)
On destinationAttribute: inside mappingRules list items of topology relationshipsBrowse entity attributes (entity needs to be present in toType attribute)
On entityType: and entityTypes:Browse relevant entity types
On key: (of attributes inside screen properties)Attributes are suggested from topology and built-in values
On entitySelectorTemplate:Use Ctrl + Space to trigger completions as you build your selector or choose one of the pre-built selectors (from relationships seen in your manifest)
On iconPattern: (within topology rules) or icon: (within staticContent header)Browse available Barista icon codes
On key: (of cards in screens, either in layout or individual lists)Browse keys of cards defined but not yet utilized
On value:, for metrics and dimensions of a Prometheus extensionBrowse metrics and dimensions scraped using the Prometheus code lens
On description: (in the metrics section of the manifest)For those metrics that have been scraped using the Prometheus code lens, add the description from the scraped data

Code actions

Code actions happen on key lines of your extension manifest. Your editor will automatically show a lightbulb icon whenever actions are relevant to the clicked line. Typically these will generate and insert content into your extension manifest or fix issues highlighted by Dynatrace Extensions.

Currently implemented triggers

Action triggerEffects
Inside propertiesCard when clicking on propertiesAutomatically add properties for the entity's attributes and relations
Inside entitiesListCards when clicking on columnsAutomatically add columns for the listed entity's attributes and relations
Inside chartsCards and entitiesListCards when clicking on charts inside a cardAutomatically add charts for metrics that aren't already in the card
Inside graphChartConfig when clicking on metricsAdd more metrics to your chart that aren't used within the surrounding card
Inside screens when clicking on chartsCardsAutomatically add chart cards for entire feature sets of metrics
Inside screens when clicking on entitiesListCardsAutomatically add cards for listing this entity as well as the related ones
When clicking on metrics within the Prometheus data sourceAutomatically add details from a scraped Prometheus endpoint
On screensAutomatically generate entire unified analysis screens for your entities
Inside entitiesListCards when clicking on filteringInsert entire filtering blocks with a default filter by name
Inside entitiesListCards and inside filtering, when clicking on filtersInsert individual filter for the entity's attributes
Inside screens when clicking on actionsInsert global actions to configure the extension
Inside actions when clicking on actionsInsert an action expression to configure the extension

Code lens

Code lenses are actionable, contextual information interspersed with your code. For Dynatrace Extensions, these can help trigger code-related actions to your Dynatrace environment or other external endpoints.

Metric selectors

The lens appears automatically wherever metricSelector and shows:

  • Query data - an action that runs the metric selector query and visualizes its results
  • Validate selector - an action to verify this selector against your Dynatrace environment
  • An icon representing the last validation status for this selector. You can hover over it for more details

metric selector lens

Metric selector results are displayed within a separate metric panel:

results panel

Any errors from querying your environment are displayed in the Dynatrace output panel (by default at the bottom of your editor):

output panel

Entity selectors

The lens appears automatically wherever entitySelector is mentioned and shows:

  • Query data - an action that runs the entity selector query and visualizes its results
  • Validate selector - an action to verify this selector against your Dynatrace environment
  • An icon representing the last validation status for this selector. You can hover over it for more details

entity selector lens

Entity selector results, as well as any errors, are displayed within the Dynatrace output panel (by default at the bottom of your editor):

selector results

Prometheus

The lens appears automatically when the Prometheus data source is defined and shows:

  • Scrape data - an action that connects to a Prometheus scraper endpoint and collects its data
  • Edit config - an action that allows you to make changes to the connected Prometheus endpoint
  • Text indicating the status of the last scrape action, such as the timestamp and number of metrics scraped

prometheus lens

After the data has been scraped, this can be used with Code actions to:

  • insert metric definitions in the prometheus section of the manifest
  • insert dimensions in the prometheus section of the manifest
  • insert metric metadata in the metrics section of the manifest

prometheus data action

Windows Management Interface (WMI) queries

The lens appears automatically over queries inside the WMI data source definition and shows:

  • Run WMI Query: an action that runs your query against the local Windows machine
  • Text indicating the summary of the query results (i.e., how many object instances were found)

The full results of running the WMI query are displayed in a separate panel:

wmi panel

After a query is run, you can use the results with Code completions

wmi query completions

Unified analysis screens

The lens appears automatically over entity type definitions inside the screens element of the manifest and shows:

unified analysis screen lens

Note

A 404 response code is expected if your entity type does exist yet.

Fast development mode

Fast development mode is a workflow designed to allow advanced developers to gain immediate feedback on the current state of their extension and minimize the steps and time it takes to see updates in their connected Dynatrace environment.

How does it work?

When enabled, every time the extension manifest saves, the extension version automatically increments, and the extension is packaged, signed, and uploaded to your connected environment. The workflow is hands-free, so if the maximum number of extension versions is reached, one will be removed automatically so the upload can succeed.

An accompanying status bar confirms the mode is active and displays the status of the last attempted build.

fast mode

With this workflow, pre-upload validation is skipped in favor of speed, and any issues are communicated immediately via an output channel.

errors in fast mode

When developing your static assets, such as the unified analysis screens, this mode is the quickest way to cycle through a variety of changes before finding your ideal configuration.

Diagnostics

Often, perfectly valid YAML still produces a manifest that causes issues when we upload the extension to Dynatrace or later when it tries to run. Many of these situations can be caught early, and Dynatrace Extensions aims to bring these to light so you can fix them and reduce the number of failed deployment attempts.

How do custom diagnostics work?

On every edit of your extension manifest, the diagnostics suite will trigger an update of all diagnostic items applicable to that file. Based on findings, relevant content is highlighted within the manifest, and hovering over the highlight will provide more details about the issue.

Some issues may provide a Quick fix link as part of the hover information. If this is available, it will trigger a content change of the document to resolve the highlighted issue.

Diagnostic severities:

  • Error - these findings are highlighted in red and represent issues that would break your extension when deployed. The Build command won't work if Error severity diagnostics are in your manifest.
  • Warning - these findings are highlighted in yellow and represent issues that would not stop an extension from functioning but may still produce undesired behaviors.

Currently implemented diagnostics

CodeSeverityWhat does it mean?
DED001ErrorYour extension doesn't have a name, which is mandatory.
DED002ErrorYour extension's name needs to be less that 50 character. characters.
DED003ErrorYour extension's name is invalid. It should only contain lowercase letters, numbers, hyphens, underscores, or dots.
DED004ErrorYour extension's name needs to start with custom: but it doesn't.
DED005WarningInternal Dynatrace extension names shouldn't start with custom:.
DED006WarningMetrics of type count should have keys ending in .count or _count.
DED007WarningMetrics of type gauge shouldn't have keys ending in .count or _count.
DED008ErrorYou referenced this card key in a screen layout, but it doesn't have a definition.
DED009WarningYou defined this card, but you're not referencing it in the screen layout.
DED010WarningThere is no online data about this Object Identifier (OID). You may want to validate it.
DED011ErrorThis OID isn't readable. The access permissions (MAX-ACCESS) don't allow it.
DED012ErrorThis OID returns a string, but you're using it as a metric value.
DED013WarningThis OID returns a Counter, but you're using it as a Gauge metric.
DED014WarningThis OID returns a Gauge, but you're using it as a Counter metric.
DED015ErrorInvalid OID syntax. OID shouldn't start/end with '.' and may only contain dots and digits.
DED016ErrorInvalid OID syntax. OIDs shouldn't end in '.0' when 'table' is set to 'true' in the subgroup.
DED017ErrorInvalid OID syntax. OIDs needs to end in '.0' when 'table' is set to 'false' in the subgroup.
DED018ErrorOnline data lists this OID as static, but you're using it inside a 'table' subgroup.
DED019ErrorOnline data maps this OID to table entries, but you're not using it inside a 'table' subgroup.
Note

The code itself doesn't mean anything; it just provides a unique identifier within all diagnostics that may come up in VS Code. We chose the DED prefix to stand for Dynatrace Extensions Diagnostic.

Still have questions?
Find answers in the Dynatrace Community