dynatrace-extensions / dynatrace-extensions-vscode

A VisualStudio Code extension to support all aspects of developing Dynatrace Extensions 2.0
Apache License 2.0
16 stars 6 forks source link

Better extension starter templates #174

Open radu-stefan-dt opened 7 months ago

radu-stefan-dt commented 7 months ago

Improvement: Better extension templates

Context

Currently when starting a new extension we provide an overly simplistic yaml:

name: custom:my.awesome.extension
version: "0.0.1"
minDynatraceVersion: "1.256.0"
author:
  name: Your Name Here

In addition, our very popular Generic Database Queries extension is now deprecated along with the whole EF1 framework and will later be completely unavailable. There is no direct replacement (e.g. like-for-like extension) but users can leverage SQL datasources to create extensions that run their desired queries.

At this point users are left with very little detail on how to actually start writing the datasource part of the extension. We have documentation online, but we could also start them in a better way.

Details

For Databases we can probably draft up a generic definition for topology - DB Host, Instance, runs on dt.entity.host etc. Along with that screens are probably self-deduceable too. Create the base screens similar to how we do already, and maybe add some injections for the Host.

However, for new users of any datasource, we could provide them with some basic YAML enough to give a hint on how to extract metrics/dimensions etc.

This is an example from a sql-like datasource, but something similar can be done for all:

sql:
  - group: my-queries
    subgroups:
      - subgroup: first-query
        query: >
          "Write your first query here"
        dimensions:
          - key: example.dimension
            value: col:COLUMN_NAME_1
        metrics:
          - key: example.metric
            value: col:COLUMN_NAME_2

Use Cases

Challenges

radu-stefan-dt commented 1 month ago

After several re-thinks of the topic, a nicer implmentation would be in the form of a snippet provider. Similar to our existing one, we can hook this up via code actions.

I envision this working as follows:

This way we can have an iterative approach to adding examples And we don't have to work with full extension yaml files either. An advantage being the user might have already figured out one part, but still needs help/suggestions with another part.