cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

DetailsInjection does not work

HuangMarco
Visitor

Hello There,
I need your professional help on giving suggestions about detailsInjection in the unified analysis page. I am working on building custom extension to display a customized metrics in "HOST" and "Container" page. According to the documentation (https://docs.dynatrace.com/docs/extend-dynatrace/extend-ui/unified-analysis/unified-analysis-referen...) the "HOST" page can be extended to display my own metrics. I build the package with the extension.yaml as below and I found the chart is there but there is no metrics data.

screens:
  - entityType: HOST
    detailsInjections:
      - type: CHART_GROUP
        key: cfcollector-cpu-usage-metrics-chart
        width: FULL_SIZE
    chartsCards:
      - key: "cfcollector-cpu-usage-metrics-chart"
        mode: NORMAL
        displayName: "Cloud Foundry Application Cpu Usage"
        numberOfVisibleCharts: 1
        charts:
          - displayName: "Cloud Foundry App Cpu Usage"
            visualizationType: GRAPH_CHART
            graphChartConfig:
              stacked: false
              metrics:
                - metricSelector: btp.cf.cpu.entitlement.usage:splitBy():sort(value(auto,descending)):limit(20)

HuangMarco_0-1718703582950.png


The metrics "btp.cf.cpu.entitlement.usage" is collected by an application running in our platform, this "cfcollector" application collects all the metrics data from many other applications. Those application doesn't bind any Dynatrace service instance. That means those applications will not display in the "HOST" page. "cfcollector" application binds the Dynatrace service instance so that it can be found in the "HOST" page.

I have below questions:
1. Could you please suggest how to fix the issue that metrics data not displayed in the "HOST" page? From the screenshot and the extension.yaml, it seems Dynatrace automatically adds the entityCondition with attaching the "filter(eq("dt.entity.host",HOST-6BEBD4C8D7))". Is there a way to remove this filter condition by updating the extension.yaml?

HuangMarco_3-1718703794010.png

Jump to the Data Explorer, the filter condition is automatically added:

HuangMarco_2-1718703709815.png


If the "filter" is removed the metrics data can be displayed.

 

HuangMarco_1-1718703677352.png

 


2. Whether the "typology" block should be added in the extension.yaml in order to display the metrics data? If it is, please help to suggest how to do it.

3. Since the collected metrics data is for different applications, and those applications will not display in the "HOST" page. Do you think it is possible or not to display below chart directly split by "app_name" dimension in the "HOST" page chart panel? 

HuangMarco_4-1718703910533.png

 

My goal is to display my metrics in the HOST page, please help to guide.
Thanks in advance!

Regards,
Marco

6 REPLIES 6

Mike_L
Dynatrace Guru
Dynatrace Guru

Unified Analysis pages only show the data in context, so you'll either have to send in the metric line with the host entity id, or attach the metric to an entity, and then create a relationship between that entity and the host entity. You can do such relationships based on for example IP address.

Mike

Thanks Mike!
Can you share any documentation link for introducing how to attach the metric to an entity and also create the relationship?
I found an example "typology" as below, but I don't understand the rule&relationships definition.

topology:
  types:
    - name: custom:sap_btp_cf_cpu_entitlement_usage
      displayName: sap_btp_cf_cpu_entitlement_usage Host
      enabled: true
      rules:
      - idPattern: nc_alertmanager_{host}
        sources:
        - sourceType: Metrics
          condition: $prefix(com.dynatrace.extension.prometheus-nc-alertmanager.alert_state)
        attributes:
        - pattern: "{host}"
          key: nc_alertmanager_host
          displayName: nc_alertmanager_host
        - pattern: "{support_team}"
          key: support_team
          displayName: support_team
        requiredDimensions: []
        instanceNamePattern: "{host}"
  relationships:
    - sources:
        - sourceType: Entities
          mappingRules:
            - sourceProperty: nc_alertmanager_host
              sourceTransformation: To lower case
              destinationProperty: displayName
              destinationTransformation: To lower case
      fromType: custom:dt_extension_prometheus_nc_alertmanager_host
      typeOfRelation: SAME_AS
      toType: host


Regards,
Marco

The best explanation of the topology in extensions can be found at 22:38 in this observability clinic: https://youtu.be/tIIVaC9iWPM?si=INJ5hWCxSjyHIE1e&t=1358

Mike
Dynatrace Unified Analysis screens provide a common user experience when analyzing data as they bring all relevant observability signals (logs, metrics, events ..) into the context of an analyzed entity, e.g: Kubernetes workload or host. While Dynatrace is rolling out the adoption of Unified ...

Hi Mike,
Thanks for that video. My further question is: The demo is based on two types of metrics. My case is that I only want to use one metrics, do I still need to define the relationship? If it is, how to implement that? 
Regards,
Marco

If you want to display data on the host screen from a source which is not routed through the OneAgent CLI/REST (which automatically adds the dt.entity.host), then you need to create a relationship. This is a simple relationship between a generic entity and a host, based on IP mapping:

    - fromType: custom:sap_btp_cf_cpu_entitlement_usage
      typeOfRelation: SAME_AS
      toType: host
      sources:
        - sourceType: Entities
          mappingRules:
            - sourceProperty: dt.ip_addresses
              sourceTransformation: To lower case
              destinationProperty: ipAddress
              destinationTransformation: To lower case
Mike

I still met the error. I already had my entity type as "custom:sap_btp_cf_application_cpu_entitlement_usage". But when I uploaded my extension package it always mention that this entity type does not exist. Please suggest.

HuangMarco_0-1719302798226.png

HuangMarco_1-1719302831561.png

My extension yaml for the screen part is as below:

screens:
- entityType: HOST
detailsInjections:
- type: CHART_GROUP
key: sap-btp-cf-app-cpu-usage-chart
width: FULL_SIZE
conditions:
- relatedEntity|entitySelectorTemplate=type(custom:sap_btp_cf_application_cpu_entitlement_usage),fromRelationships.isSameAs($(entityConditions))
chartsCards:
- key: "sap-btp-cf-app-cpu-usage-chart"
displayName: "SAP BTP Cloud Foundry Application Cpu Usage"
numberOfVisibleCharts: 1
charts:
- displayName: "Cloud Foundry App Cpu Usage"
visualizationType: GRAPH_CHART
graphChartConfig:
stacked: false
metrics:
- metricSelector: "sap.btp.cf.cpu.entitlement.usage:filter(in(\"dt.entity.custom:sap_btp_cf_application_cpu_entitlement_usage\",entitySelector(\"type(custom:sap_btp_cf_application_cpu_entitlement_usage),fromRelationships.isSameAs($(entityConditions))\"))):splitBy(\"description\")"



Thanks,
Marco

 

 

Featured Posts