github.com/waldiirawan/apm-agent-go/v2@v2.2.2/internal/testdata/json-specs/service_resource_inference.json (about)

     1  [
     2    {
     3      "span": {
     4        "exit": "true",
     5        "type": "custom",
     6        "subtype": "test-subtype"
     7      },
     8      "expected_resource": "test-subtype",
     9      "expected_service_target": {
    10        "type": "test-subtype"
    11      },
    12      "failure_message": "In the absence of specific context fields, subtype should used"
    13    },
    14    {
    15      "span": {
    16        "exit": "true",
    17        "type": "custom",
    18        "subtype": "test-subtype",
    19        "context": {
    20          "service": {
    21            "target": {
    22              "type": "custom-service-type",
    23              "name": "custom-service-name"
    24            }
    25          }
    26        }
    27      },
    28      "expected_resource": "custom-service-type/custom-service-name",
    29      "expected_service_target": {
    30        "type": "custom-service-type",
    31        "name": "custom-service-name"
    32      },
    33      "failure_message": "If the `service target type or name` is already set, the inference mechanism should not override it"
    34    },
    35    {
    36      "span": {
    37        "exit": "true",
    38        "type": "custom"
    39      },
    40      "expected_resource": "custom",
    41      "expected_service_target": {
    42        "type": "custom"
    43      },
    44      "failure_message": "In the absence of specific context fields and absence of subtype, the type should be used"
    45    },
    46    {
    47      "span": {
    48        "exit": "false",
    49        "type": "custom",
    50        "subtype": "test-subtype"
    51      },
    52      "expected_resource": null,
    53      "expected_service_target": null,
    54      "failure_message": "The output for non-exit spans should be `null`"
    55    },
    56    {
    57      "span": {
    58        "exit": "false",
    59        "type": "custom",
    60        "subtype": "proprietary-db",
    61        "context": {
    62          "db": {
    63            "instance": "myInstance"
    64          }
    65        }
    66      },
    67      "expected_resource": null,
    68      "expected_service_target": null,
    69      "failure_message": "The output for non-exit spans should be `null` even if exit-related context data is set"
    70    },
    71    {
    72      "span": {
    73        "exit": "true",
    74        "type": "db",
    75        "subtype": "mysql",
    76        "context": {
    77          "db": {
    78            "instance": "myInstance"
    79          }
    80        }
    81      },
    82      "expected_resource": "mysql/myInstance",
    83      "expected_service_target": {
    84        "type": "mysql",
    85        "name": "myInstance"
    86      },
    87      "failure_message": "If `context.db.instance` exists, the output should be: `${subtype}/${context.db.instance}`"
    88    },
    89    {
    90      "span": {
    91        "exit": "true",
    92        "type": "db",
    93        "subtype": "mysql",
    94        "context": {
    95          "db": {
    96            "type": "sql"
    97          }
    98        }
    99      },
   100      "expected_resource": "mysql",
   101      "expected_service_target": {
   102        "type": "mysql"
   103      },
   104      "failure_message": "If `context.db` exists without `context.db.instance`, the subtype should be used"
   105    },
   106    {
   107      "span": {
   108        "exit": "true",
   109        "type": "db",
   110        "context": {
   111          "db": {
   112            "instance": "myInstance"
   113          }
   114        }
   115      },
   116      "expected_resource": "db/myInstance",
   117      "expected_service_target": {
   118        "type": "db",
   119        "name": "myInstance"
   120      },
   121      "failure_message": "If `context.db.instance` exists and subtype is `null`, the output should be: `${type}/${context.db.instance}`"
   122    },
   123    {
   124      "span": {
   125        "exit": "true",
   126        "type": "db",
   127        "subtype": "elasticsearch",
   128        "context": {
   129          "db": {
   130            "type": "elasticsearch"
   131          },
   132          "http": {
   133            "url": "https://my-cluster.com:9200"
   134          }
   135        }
   136      },
   137      "expected_resource": "elasticsearch",
   138      "expected_service_target": {
   139        "type": "elasticsearch"
   140      },
   141      "failure_message": "If `context.db` exists without `context.db.instance`, the subtype should be used, even if `context.http` exists"
   142    },
   143    {
   144      "span": {
   145        "exit": "true",
   146        "type": "messaging",
   147        "subtype": "msg-http-client",
   148        "context": {
   149          "message": {
   150            "body": "Text message"
   151          },
   152          "http": {
   153            "url": "https://my-broker.com:8888"
   154          }
   155        }
   156      },
   157      "expected_resource": "msg-http-client",
   158      "expected_service_target": {
   159        "type": "msg-http-client"
   160      },
   161      "failure_message": "If `context.message` exists without `context.message.queue.name`, the subtype should be used, even if `context.http` exists"
   162    },
   163    {
   164      "span": {
   165        "exit": "true",
   166        "type": "external",
   167        "subtype": "http",
   168        "context": {
   169          "http": {
   170            "url": "http://my-cluster.com:9200"
   171          }
   172        }
   173      },
   174      "expected_resource": "my-cluster.com:9200",
   175      "expected_service_target": {
   176        "type": "http",
   177        "name": "my-cluster.com:9200"
   178      },
   179      "failure_message": "If `context.http.url` exists, output should be `${context.http.url}`"
   180    },
   181    {
   182      "span": {
   183        "exit": "true",
   184        "type": "external",
   185        "subtype": "http",
   186        "context": {
   187          "http": {
   188            "url": "https://my-cluster.com"
   189          }
   190        }
   191      },
   192      "expected_resource": "my-cluster.com:443",
   193      "expected_service_target": {
   194        "type": "http",
   195        "name": "my-cluster.com:443"
   196      },
   197      "failure_message": "`context.http.url` without an explicit default HTTPS port, output should be reported as `${context.http.url}:443`"
   198    },
   199    {
   200      "span": {
   201        "exit": "true",
   202        "type": "external",
   203        "subtype": "http",
   204        "context": {
   205          "http": {
   206            "url": "http://my-cluster.com"
   207          }
   208        }
   209      },
   210      "expected_resource": "my-cluster.com:80",
   211      "expected_service_target": {
   212        "type": "http",
   213        "name": "my-cluster.com:80"
   214      },
   215      "failure_message": "`context.http.url` without an explicit default HTTP port, output should be reported as `${context.http.url}:80`"
   216    },
   217    {
   218      "span": {
   219        "exit": "true",
   220        "type": "messaging",
   221        "context": {
   222          "message": {
   223            "body": "Text message",
   224            "queue": {
   225              "name": "myQueue"
   226            }
   227          }
   228        }
   229      },
   230      "expected_resource": "messaging/myQueue",
   231      "expected_service_target": {
   232        "type": "messaging",
   233        "name": "myQueue"
   234      },
   235      "failure_message": "If `context.message` exists, and subtype is `null`, output should be `${type}/${context.message.queue.name}"
   236    },
   237    {
   238      "span": {
   239        "exit": "true",
   240        "type": "messaging",
   241        "subtype": "kafka",
   242        "context": {
   243          "message": {
   244            "body": "Text message",
   245            "queue": {
   246              "name": "myQueue"
   247            }
   248          }
   249        }
   250      },
   251      "expected_resource": "kafka/myQueue",
   252      "expected_service_target": {
   253        "type": "kafka",
   254        "name": "myQueue"
   255      },
   256      "failure_message": "If `context.message` exists, output should be `${subtype}/${context.message.queue.name}"
   257    },
   258    {
   259      "span": {
   260        "exit": "true",
   261        "type": "messaging",
   262        "subtype": "kafka",
   263        "context": {
   264          "message": {
   265            "body": "Text message"
   266          }
   267        }
   268      },
   269      "expected_resource": "kafka",
   270      "expected_service_target": {
   271        "type": "kafka"
   272      },
   273      "failure_message": "If `context.message` exists without `context.message.queue.name`, output should be `${subtype}`"
   274    }
   275  ]