Prometheus Extension 2.0 best practices

Hi fellow Dynatracers,

I am currently writing an extension for scraping a prometheus endpoint of an appliance. This is a virtual appliance that is under update control of the supplier.

Coding

  • What is best practice for the extension name (e.g. biz.ictcore.<suppliername>.<supplierProductname>) to use safe namespaces (ictcore.biz is my domain)?

  • What is best practice for the metrics naming (<suppliername>.<supplierProductname>.<original prometheusMetricname>), to avoid clashes?

  • This specific Prometheus reply also contains some static values, like a build_info metric. How could I put this information into attributes for my topology, so that it gets visible in the properties (like I already put in some other info in properties)?

    # HELP node_exporter_build_info A metric with a constant '1' value labeled by version, revision, branch, goversion from which node_exporter was built, and the goos and goarch for the build.
    

example for <suppliername>.<supplierProductname> could be paloalto.cortexxdr or f5.bigip … etc.

Anyone has an idea on how to get e.g. those attributes from a “static” metric? The other stuff I can just decide myself, for those questions I was only hoping for additional insights from fellow-dynatracers.

For question 1 and 2, I think you propose a good system for them.

As for 3, you can always download the YAML’s of existing extensions from the Dynatrace hub and have a look. the f5 contain most functionality. Here’s how it’s done as soon as the value is added as a dimension to the metric line:

topology:
  types:
    # Generic Network Types
    - name: network:device
      enabled: true
      displayName: Network device
      rules:
        - idPattern: network_device_{device.address}
          instanceNamePattern: "{instance.name}"
          iconPattern: f5
          sources:
            - sourceType: Metrics
              condition: $eq(com.dynatrace.extension.f5.bigip.sys.uptime)
          requiredDimensions:
            - key: instance.systemname
          attributes:
            - key: devMonitoringMode
              displayName: Monitoring mode
              pattern: "{monitoring.mode}"

Took me little longer to put some focus on this, but it “works like a charm”, thank you very much for this…!