Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apmpackage: use package spec v3 #11822

Merged
merged 30 commits into from
Jan 12, 2024

Conversation

kyungeunni
Copy link
Contributor

@kyungeunni kyungeunni commented Oct 11, 2023

Motivation/summary

use package spec v3

blockers:

Checklist

For functional changes, consider:

  • Is it observable through the addition of either logging or metrics?
  • Is its use being published in telemetry to enable product improvement?
  • Have system tests been added to avoid regression?

How to test these changes

Testing compatibility

  1. Spin up apm-server and stack by using tilt up, makesure apmpackage installation was successful
  2. Generate some traces and send data to apm-server, preferably using a demo app instrumented with apm agents
  3. Observe whether the documents are indexed correctly by searching documents in Discover. Also, check if there are any differences in documents and make sure all APM UIs are intact without any issues etc.

Testing upgrade scenario

  1. Go to Elastic Cloud, create a deployment with stack version prior to 8.13
  2. Generate some traces and send data to apm-server, preferably using a demo app instrumented with apm agents.
  3. Perform an upgrade to 8.13, repeat step 2, then observe whether the documents are indexed correctly by searching documents in Discover. Also, check if there are any differences in documents and make sure all APM UIs are intact without any issues etc.

Related issues

closes #11643

@mergify
Copy link
Contributor

mergify bot commented Oct 11, 2023

This pull request does not have a backport label. Could you fix it @kyungeunni? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-7.17 is the label to automatically backport to the 7.17 branch.
  • backport-8./d is the label to automatically backport to the 8./d branch. /d is the digit.

NOTE: backport-skip has been added to this pull request.

@mergify mergify bot added the backport-skip Skip notification from the automated backport with mergify label Oct 11, 2023
@mergify
Copy link
Contributor

mergify bot commented Oct 12, 2023

This pull request is now in conflicts. Could you fix it @kyungeunni? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b apm-package-for-serverless upstream/apm-package-for-serverless
git merge upstream/main
git push upstream apm-package-for-serverless

@kyungeunni
Copy link
Contributor Author

After catching up with @jsoriano, we've narrowed down some of the issues and Jaime made a couple of fixes(thank you!).
But there are still failing tests as some documents can't be indexed with the following error or similar:

.ds-metrics-apm.transaction.1m-default-2023.10.24-000001' (illegal_state_exception): Missing intermediate object numeric_labels"

These data streams have a mapping with dynamic: runtime defined, and the generated index template with the latest elastic package and Fleet doesn't contain the numeric_labels property in the mapping but only the dynamic_templates, and that is probably the reason it can't be indexed(refer to this doc)

I will continue taking a look at this.

@jsoriano
Copy link
Member

the generated index template with the latest elastic package and Fleet doesn't contain the numeric_labels property in the mapping but only the dynamic_templates

I am investigating if we could install both, the static property for the parent objects, and the dynamic templates. Previously this was not installing the dynamic templates, only the parent object. It worked because the parent object had "runtime": true.

@mergify
Copy link
Contributor

mergify bot commented Oct 26, 2023

This pull request is now in conflicts. Could you fix it @kyungeunni? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b apm-package-for-serverless upstream/apm-package-for-serverless
git merge upstream/main
git push upstream apm-package-for-serverless

@kyungeunni kyungeunni self-assigned this Nov 6, 2023
@kyungeunni
Copy link
Contributor Author

kyungeunni commented Nov 6, 2023

The system tests should pass when elastic/kibana#169981 is merged and the snapshot is available. Confirmed that it works locally.

@kyungeunni kyungeunni marked this pull request as ready for review December 8, 2023 09:17
@kyungeunni kyungeunni requested a review from a team as a code owner December 8, 2023 09:17
Copy link
Contributor

mergify bot commented Dec 27, 2023

This pull request is now in conflicts. Could you fix it @kyungeunni? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b apm-package-for-serverless upstream/apm-package-for-serverless
git merge upstream/main
git push upstream apm-package-for-serverless

@kyungeunni
Copy link
Contributor Author

kyungeunni commented Dec 29, 2023

Here's the diff between the main branch and this branch as of today.
Not much differences, but note that several components have additional dynamic mappings applied due to the change:

labels field is added to the dynamic_templates

Affected components

  • metrics-apm.app@package
  • metrics-apm.transaction.*m@package
  • metrics-apm.service_destination.*m@package
  • metrics-apm.service_summary.*m@package
  • metrics-apm.internal@package
  • metrics-apm.service_transaction.*m@package
"dynamic_templates": [
    {
        "labels": {
            "mapping": {
                "type": "keyword"
            },
            "match_mapping_type": "string",
            "path_match": "labels.*"
        }
    },
    {
        "numeric_labels": {
            "mapping": {
                "scaling_factor": 1000,
                "type": "scaled_float"
            },
            "match_mapping_type": "*",
            "path_match": "numeric_labels.*"
        }
    }
]

More fields in dynamic template, newly added dynamic: true and type: object in http.request and http.response

Affected components

  • logs-apm.error:

    before:

    "dynamic_templates": [
          {
              "numeric_labels": {
                  "mapping": {
                      "scaling_factor": 1000000,
                      "type": "scaled_float"
                  },
                  "path_match": "numeric_labels.*"
              }
          }
      ],
    

    after:

    "dynamic_templates": [
        {
            "http.request.env": {
                "mapping": {
                    "type": "keyword"
                },
                "match_mapping_type": "string",
                "path_match": "http.request.env.*"
            }
        },
        {
            "http.request.cookies": {
                "mapping": {
                    "type": "keyword"
                },
                "match_mapping_type": "string",
                "path_match": "http.request.cookies.*"
            }
        },
        {
            "http.request.headers": {
                "mapping": {
                    "type": "keyword"
                },
                "match_mapping_type": "string",
                "path_match": "http.request.headers.*"
            }
        },
        {
            "http.response.headers": {
                "mapping": {
                    "type": "keyword"
                },
                "match_mapping_type": "string",
                "path_match": "http.response.headers.*"
            }
        },
        {
            "labels": {
                "mapping": {
                    "type": "keyword"
                },
                "match_mapping_type": "string",
                "path_match": "labels.*"
            }
        },
        {
            "numeric_labels": {
                "mapping": {
                    "scaling_factor": 1000000,
                    "type": "scaled_float"
                },
                "match_mapping_type": "*",
                "path_match": "numeric_labels.*"
            }
        }
    ]
    

http.request.headers and http.response.headers are added to dynamic_templates, newly added dynamic: true and type: object in http.request and http.response

Affected components

  • logs.apm.app@package

new fields in dynamic template, newly added dynamic: true and type: object in http.request and http.response

Affected components

  • traces.apm.rum:
  • traces-apm:

before:

"dynamic_templates": [
    {
        "numeric_labels": {
            "mapping": {
                "scaling_factor": 1000000,
                "type": "scaled_float"
            },
            "path_match": "numeric_labels.*"
        }
    }
]

after:

"dynamic_templates": [
    {
        "http.request.env": {
            "mapping": {
                "type": "keyword"
            },
            "match_mapping_type": "string",
            "path_match": "http.request.env.*"
        }
    },
    {
        "http.request.cookies": {
            "mapping": {
                "type": "keyword"
            },
            "match_mapping_type": "string",
            "path_match": "http.request.cookies.*"
        }
    },
    {
        "http.request.headers": {
            "mapping": {
                "type": "keyword"
            },
            "match_mapping_type": "string",
            "path_match": "http.request.headers.*"
        }
    },
    {
        "http.response.headers": {
            "mapping": {
                "type": "keyword"
            },
            "match_mapping_type": "string",
            "path_match": "http.response.headers.*"
        }
    },
    {
        "labels": {
            "mapping": {
                "type": "keyword"
            },
            "match_mapping_type": "string",
            "path_match": "labels.*"
        }
    },
    {
        "span.message.headers": {
            "mapping": {
                "type": "keyword"
            },
            "match_mapping_type": "string",
            "path_match": "span.message.headers.*"
        }
    },
    {
        "transaction.marks": {
            "mapping": {
                "type": "long"
            },
            "match_mapping_type": "long",
            "path_match": "transaction.marks.*"
        }
    },
    {
        "transaction.message.headers": {
            "mapping": {
                "type": "keyword"
            },
            "match_mapping_type": "string",
            "path_match": "transaction.message.headers.*"
        }
    },
    {
        "numeric_labels": {
            "mapping": {
                "scaling_factor": 1000000,
                "type": "scaled_float"
            },
            "match_mapping_type": "*",
            "path_match": "numeric_labels.*"
        }
    }
]

@carsonip
Copy link
Member

carsonip commented Jan 2, 2024

Here's a diff of the generated apmpackage:

diff -ru build/apmpackage-main/changelog.yml build/apmpackage/changelog.yml
--- build/apmpackage-main/changelog.yml	2024-01-02 11:03:03.239545292 +0000
+++ build/apmpackage/changelog.yml	2024-01-02 11:08:35.736920083 +0000
@@ -3,6 +3,9 @@
     - description: Placeholder
       type: enhancement
       link: https://github.com/elastic/apm-server/pull/123
+    - description: Migrate to package-spec v3
+      type: enhancement
+      link: https://github.com/elastic/apm-server/pull/11822
 - version: 8.12.0
   changes:
     - description: Add missing mappings for various fields
diff -ru build/apmpackage-main/data_stream/app_logs/fields/fields.yml build/apmpackage/data_stream/app_logs/fields/fields.yml
--- build/apmpackage-main/data_stream/app_logs/fields/fields.yml	2024-01-02 11:03:03.239545292 +0000
+++ build/apmpackage/data_stream/app_logs/fields/fields.yml	2024-01-02 11:08:35.736920083 +0000
@@ -5,6 +5,7 @@
     The way the agent is installed / used.
 - name: http.request.headers
   type: object
+  object_type: keyword
   description: |
     The canonical headers of the monitored HTTP request.
 - name: http.response.finished
@@ -13,6 +14,7 @@
     Used by the Node agent to indicate when in the response life cycle an error has occurred.
 - name: http.response.headers
   type: object
+  object_type: keyword
   description: |
     The canonical headers of the monitored HTTP response.
 - name: kubernetes.namespace
@@ -94,6 +96,8 @@
     The lambda function version.
 - name: numeric_labels
   type: object
+  object_type: scaled_float
   dynamic: true
+  scaling_factor: 1000000
   description: |
     Custom key/value pairs. Can be used to add meta information to events. Should not contain nested objects. All values are stored as scaled_float.
diff -ru build/apmpackage-main/data_stream/app_logs/manifest.yml build/apmpackage/data_stream/app_logs/manifest.yml
--- build/apmpackage-main/data_stream/app_logs/manifest.yml	2024-01-02 11:03:03.243545307 +0000
+++ build/apmpackage/data_stream/app_logs/manifest.yml	2024-01-02 11:08:35.736920083 +0000
@@ -14,9 +14,3 @@
       # ad-hoc searches on HTTP request headers without incurring storage cost
       # for users who do not need this capability.
       dynamic: false
-      dynamic_templates:
-        - numeric_labels:
-            path_match: numeric_labels.*
-            mapping:
-              type: scaled_float
-              scaling_factor: 1000000
diff -ru build/apmpackage-main/data_stream/app_metrics/fields/fields.yml build/apmpackage/data_stream/app_metrics/fields/fields.yml
--- build/apmpackage-main/data_stream/app_metrics/fields/fields.yml	2024-01-02 11:03:03.243545307 +0000
+++ build/apmpackage/data_stream/app_metrics/fields/fields.yml	2024-01-02 11:08:35.740920102 +0000
@@ -61,6 +61,8 @@
     Version of the runtime used.
 - name: numeric_labels
   type: object
+  object_type: scaled_float
   dynamic: true
+  scaling_factor: 1000000
   description: |
     Custom key/value pairs. Can be used to add meta information to events. Should not contain nested objects. All values are stored as scaled_float.
diff -ru build/apmpackage-main/data_stream/app_metrics/manifest.yml build/apmpackage/data_stream/app_metrics/manifest.yml
--- build/apmpackage-main/data_stream/app_metrics/manifest.yml	2024-01-02 11:03:03.243545307 +0000
+++ build/apmpackage/data_stream/app_metrics/manifest.yml	2024-01-02 11:08:35.740920102 +0000
@@ -7,16 +7,15 @@
   # Ensures agents have permissions to write data to `metrics-*-*`
   dynamic_dataset: true
   dynamic_namespace: true
+  # Individual measurements are typically uninteresting, so
+  # use synthetic source to reduce storage size.
+  source_mode: synthetic
   index_template:
     mappings:
       # Application metrics must be dynamically mapped,
       # as their names are application-specific and not
       # known ahead of time.
       dynamic: true
-      # Individual measurements are typically uninteresting, so
-      # use synthetic source to reduce storage size.
-      _source:
-        mode: synthetic
       # Install dynamic templates for use in dynamically
       # mapping complex application metrics.
       dynamic_templates:
@@ -34,8 +33,3 @@
             mapping:
               type: double
               index: false
-        - numeric_labels:
-            path_match: numeric_labels.*
-            mapping:
-              type: scaled_float
-              scaling_factor: 1000000
diff -ru build/apmpackage-main/data_stream/error_logs/fields/fields.yml build/apmpackage/data_stream/error_logs/fields/fields.yml
--- build/apmpackage-main/data_stream/error_logs/fields/fields.yml	2024-01-02 11:03:03.247545322 +0000
+++ build/apmpackage/data_stream/error_logs/fields/fields.yml	2024-01-02 11:08:35.740920102 +0000
@@ -62,16 +62,19 @@
     The original body of the monitored HTTP request.
 - name: http.request.env
   type: object
+  object_type: keyword
   dynamic: true
   description: |
     The CGI-like environment variables of the monitored HTTP request.
 - name: http.request.cookies
   type: object
+  object_type: keyword
   dynamic: true
   description: |
     The cookies of the monitored HTTP request.
 - name: http.request.headers
   type: object
+  object_type: keyword
   dynamic: true
   description: |
     The canonical headers of the monitored HTTP request.
@@ -81,6 +84,7 @@
     Used by the Node agent to indicate when in the response life cycle an error has occurred.
 - name: http.response.headers
   type: object
+  object_type: keyword
   dynamic: true
   description: |
     The canonical headers of the monitored HTTP response.
@@ -187,6 +191,8 @@
     Keyword of specific relevance in the service's domain (eg. 'request', 'backgroundjob', etc)
 - name: numeric_labels
   type: object
+  object_type: scaled_float
   dynamic: true
+  scaling_factor: 1000000
   description: |
     Custom key/value pairs. Can be used to add meta information to events. Should not contain nested objects. All values are stored as scaled_float.
diff -ru build/apmpackage-main/data_stream/error_logs/manifest.yml build/apmpackage/data_stream/error_logs/manifest.yml
--- build/apmpackage-main/data_stream/error_logs/manifest.yml	2024-01-02 11:03:03.247545322 +0000
+++ build/apmpackage/data_stream/error_logs/manifest.yml	2024-01-02 11:08:35.740920102 +0000
@@ -11,9 +11,3 @@
       # ad-hoc searches on HTTP request headers without incurring storage cost
       # for users who do not need this capability.
       dynamic: false
-      dynamic_templates:
-        - numeric_labels:
-            path_match: numeric_labels.*
-            mapping:
-              type: scaled_float
-              scaling_factor: 1000000
diff -ru build/apmpackage-main/data_stream/internal_metrics/fields/fields.yml build/apmpackage/data_stream/internal_metrics/fields/fields.yml
--- build/apmpackage-main/data_stream/internal_metrics/fields/fields.yml	2024-01-02 11:03:03.251545339 +0000
+++ build/apmpackage/data_stream/internal_metrics/fields/fields.yml	2024-01-02 11:08:35.744920120 +0000
@@ -163,6 +163,16 @@
     Keyword of specific relevance in the service's domain (eg. 'request', 'backgroundjob', etc)
 - name: numeric_labels
   type: object
+  object_type: scaled_float
   dynamic: true
+  scaling_factor: 1000000
   description: |
     Custom key/value pairs. Can be used to add meta information to events. Should not contain nested objects. All values are stored as scaled_float.
+- name: transaction.duration.summary
+  type: aggregate_metric_double
+  metrics: ["sum", "value_count"]
+  default_metric: "sum"
+- name: event.success_count
+  type: aggregate_metric_double
+  metrics: ["sum", "value_count"]
+  default_metric: "sum"
diff -ru build/apmpackage-main/data_stream/internal_metrics/manifest.yml build/apmpackage/data_stream/internal_metrics/manifest.yml
--- build/apmpackage-main/data_stream/internal_metrics/manifest.yml	2024-01-02 11:03:03.251545339 +0000
+++ build/apmpackage/data_stream/internal_metrics/manifest.yml	2024-01-02 11:08:35.744920120 +0000
@@ -4,35 +4,16 @@
 ilm_policy: metrics-apm.internal_metrics-default_policy
 elasticsearch:
   dynamic_namespace: true
+  # Individual measurements are typically uninteresting, so
+  # use synthetic source to reduce storage size.
+  source_mode: synthetic
   index_template:
     mappings:
       # We are in full control of the field names,
       # but do not block ingestion on unexpected fields.
       dynamic: runtime
-      # Individual measurements are typically uninteresting, so
-      # use synthetic source to reduce storage size.
-      _source:
-        mode: synthetic
-      # We map transaction.duration.summary here because aggregate_metric_double
-      # is not currently supported by package-spec.
-      #
-      # See https://github.com/elastic/package-spec/issues/363
-      properties:
-        transaction:
-          properties:
-            duration:
-              properties:
-                summary:
-                  type: aggregate_metric_double
-                  metrics: [sum, value_count]
-                  default_metric: sum
-        event:
-          properties:
-            success_count:
-              type: aggregate_metric_double
-              metrics: [sum, value_count]
-              default_metric: sum
     settings:
       index:
-        sort.field: "@timestamp"
-        sort.order: desc
+        sort:
+          field: "@timestamp"
+          order: desc
diff -ru build/apmpackage-main/data_stream/rum_traces/fields/fields.yml build/apmpackage/data_stream/rum_traces/fields/fields.yml
--- build/apmpackage-main/data_stream/rum_traces/fields/fields.yml	2024-01-02 11:03:03.279545449 +0000
+++ build/apmpackage/data_stream/rum_traces/fields/fields.yml	2024-01-02 11:08:35.772920252 +0000
@@ -62,16 +62,19 @@
     The original body of the monitored HTTP request.
 - name: http.request.env
   type: object
+  object_type: keyword
   dynamic: true
   description: |
     The CGI-like environment variables of the monitored HTTP request.
 - name: http.request.cookies
   type: object
+  object_type: keyword
   dynamic: true
   description: |
     The cookies of the monitored HTTP request.
 - name: http.request.headers
   type: object
+  object_type: keyword
   dynamic: true
   description: |
     The canonical headers of the monitored HTTP request.
@@ -81,6 +84,7 @@
     Used by the Node agent to indicate when in the response life cycle an error has occurred.
 - name: http.response.headers
   type: object
+  object_type: keyword
   dynamic: true
   description: |
     The canonical headers of the monitored HTTP response.
@@ -292,6 +296,7 @@
   index: false
 - name: span.message.headers
   type: object
+  object_type: keyword
   dynamic: true
   description: The message headers
 - name: span.message.age.ms
@@ -359,6 +364,7 @@
   description: The Total Blocking Time metric
 - name: transaction.marks
   type: object
+  object_type: long
   description: |
     A user-defined mapping of groups of marks in milliseconds.
   dynamic: true
@@ -372,6 +378,7 @@
   index: false
 - name: transaction.message.headers
   type: object
+  object_type: keyword
   dynamic: true
   description: The message headers
 - name: transaction.message.age.ms
@@ -414,6 +421,8 @@
     The approximate number of transactions represented, based on the inverse sampling rate.
 - name: numeric_labels
   type: object
+  object_type: scaled_float
   dynamic: true
+  scaling_factor: 1000000
   description: |
     Custom key/value pairs. Can be used to add meta information to events. Should not contain nested objects. All values are stored as scaled_float.
diff -ru build/apmpackage-main/data_stream/rum_traces/manifest.yml build/apmpackage/data_stream/rum_traces/manifest.yml
--- build/apmpackage-main/data_stream/rum_traces/manifest.yml	2024-01-02 11:03:03.255545354 +0000
+++ build/apmpackage/data_stream/rum_traces/manifest.yml	2024-01-02 11:08:35.748920139 +0000
@@ -11,9 +11,3 @@
       # ad-hoc searches on HTTP request headers without incurring storage cost
       # for users who do not need this capability.
       dynamic: false
-      dynamic_templates:
-        - numeric_labels:
-            path_match: numeric_labels.*
-            mapping:
-              type: scaled_float
-              scaling_factor: 1000000
diff -ru build/apmpackage-main/data_stream/sampled_traces/manifest.yml build/apmpackage/data_stream/sampled_traces/manifest.yml
--- build/apmpackage-main/data_stream/sampled_traces/manifest.yml	2024-01-02 11:03:03.259545370 +0000
+++ build/apmpackage/data_stream/sampled_traces/manifest.yml	2024-01-02 11:08:35.748920139 +0000
@@ -10,11 +10,14 @@
     # This data stream holds only non-sensitive information.
     indices: [auto_configure, create_doc, maintenance, monitor, read]
   index_template:
-    settings:
-      # Create a single shard per index, so we can use
-      # global checkpoints as a way of limiting search
-      # results.
-      number_of_shards: 1
+    # settings:
+    # Create a single shard per index, so we can use
+    # global checkpoints as a way of limiting search
+    # results.
+
+    # We are not setting this for now until the package-spec is updated
+    # to allow number_of_shards: https://github.com/elastic/package-spec/issues/644
+    # number_of_shards: 1
     mappings:
       # We are in full control of the field names,
       # but do not block ingestion on unexpected fields.
diff -ru build/apmpackage-main/data_stream/service_destination_10m_metrics/fields/ecs.yml build/apmpackage/data_stream/service_destination_10m_metrics/fields/ecs.yml
--- build/apmpackage-main/data_stream/service_destination_10m_metrics/fields/ecs.yml	2024-01-02 11:03:03.263545385 +0000
+++ build/apmpackage/data_stream/service_destination_10m_metrics/fields/ecs.yml	2024-01-02 11:08:35.752920158 +0000
@@ -3,6 +3,9 @@
 - external: ecs
   name: event.outcome
 - external: ecs
+  name: labels
+  dynamic: true
+- external: ecs
   name: observer.hostname
 - external: ecs
   name: observer.name
@@ -14,6 +17,3 @@
   name: service.environment
 - external: ecs
   name: service.name
-- external: ecs
-  name: labels
-  dynamic: true
diff -ru build/apmpackage-main/data_stream/service_destination_10m_metrics/fields/fields.yml build/apmpackage/data_stream/service_destination_10m_metrics/fields/fields.yml
--- build/apmpackage-main/data_stream/service_destination_10m_metrics/fields/fields.yml	2024-01-02 11:03:03.263545385 +0000
+++ build/apmpackage/data_stream/service_destination_10m_metrics/fields/fields.yml	2024-01-02 11:08:35.752920158 +0000
@@ -37,6 +37,8 @@
   unit: micros
 - name: numeric_labels
   type: object
+  object_type: scaled_float
   dynamic: true
+  scaling_factor: 1000000
   description: |
     Custom key/value pairs. Can be used to add meta information to events. Should not contain nested objects. All values are stored as scaled_float.
diff -ru build/apmpackage-main/data_stream/service_destination_10m_metrics/manifest.yml build/apmpackage/data_stream/service_destination_10m_metrics/manifest.yml
--- build/apmpackage-main/data_stream/service_destination_10m_metrics/manifest.yml	2024-01-02 11:03:03.263545385 +0000
+++ build/apmpackage/data_stream/service_destination_10m_metrics/manifest.yml	2024-01-02 11:08:35.752920158 +0000
@@ -4,18 +4,18 @@
 ilm_policy: metrics-apm.service_destination_10m_metrics-default_policy
 elasticsearch:
   dynamic_namespace: true
+  # Individual measurements are typically uninteresting, so
+  # use synthetic source to reduce storage size.
+  source_mode: synthetic
   index_template:
     mappings:
       # We are in full control of the field names,
       # but do not block ingestion on unexpected fields.
       dynamic: runtime
-      # Individual measurements are typically uninteresting, so
-      # use synthetic source to reduce storage size.
-      _source:
-        mode: synthetic
     settings:
       index:
-        sort.field: "@timestamp"
-        sort.order: desc
+        sort:
+          field: "@timestamp"
+          order: desc
     data_stream:
       hidden: true
diff -ru build/apmpackage-main/data_stream/service_destination_1m_metrics/fields/ecs.yml build/apmpackage/data_stream/service_destination_1m_metrics/fields/ecs.yml
--- build/apmpackage-main/data_stream/service_destination_1m_metrics/fields/ecs.yml	2024-01-02 11:03:03.263545385 +0000
+++ build/apmpackage/data_stream/service_destination_1m_metrics/fields/ecs.yml	2024-01-02 11:08:35.752920158 +0000
@@ -3,6 +3,9 @@
 - external: ecs
   name: event.outcome
 - external: ecs
+  name: labels
+  dynamic: true
+- external: ecs
   name: observer.hostname
 - external: ecs
   name: observer.name
@@ -14,6 +17,3 @@
   name: service.environment
 - external: ecs
   name: service.name
-- external: ecs
-  name: labels
-  dynamic: true
diff -ru build/apmpackage-main/data_stream/service_destination_1m_metrics/fields/fields.yml build/apmpackage/data_stream/service_destination_1m_metrics/fields/fields.yml
--- build/apmpackage-main/data_stream/service_destination_1m_metrics/fields/fields.yml	2024-01-02 11:03:03.263545385 +0000
+++ build/apmpackage/data_stream/service_destination_1m_metrics/fields/fields.yml	2024-01-02 11:08:35.752920158 +0000
@@ -37,6 +37,8 @@
   unit: micros
 - name: numeric_labels
   type: object
+  object_type: scaled_float
   dynamic: true
+  scaling_factor: 1000000
   description: |
     Custom key/value pairs. Can be used to add meta information to events. Should not contain nested objects. All values are stored as scaled_float.
diff -ru build/apmpackage-main/data_stream/service_destination_1m_metrics/manifest.yml build/apmpackage/data_stream/service_destination_1m_metrics/manifest.yml
--- build/apmpackage-main/data_stream/service_destination_1m_metrics/manifest.yml	2024-01-02 11:03:03.263545385 +0000
+++ build/apmpackage/data_stream/service_destination_1m_metrics/manifest.yml	2024-01-02 11:08:35.752920158 +0000
@@ -4,18 +4,18 @@
 ilm_policy: metrics-apm.service_destination_1m_metrics-default_policy
 elasticsearch:
   dynamic_namespace: true
+  # Individual measurements are typically uninteresting, so
+  # use synthetic source to reduce storage size.
+  source_mode: synthetic
   index_template:
     mappings:
       # We are in full control of the field names,
       # but do not block ingestion on unexpected fields.
       dynamic: runtime
-      # Individual measurements are typically uninteresting, so
-      # use synthetic source to reduce storage size.
-      _source:
-        mode: synthetic
     settings:
       index:
-        sort.field: "@timestamp"
-        sort.order: desc
+        sort:
+          field: "@timestamp"
+          order: desc
     data_stream:
       hidden: false
diff -ru build/apmpackage-main/data_stream/service_destination_60m_metrics/fields/ecs.yml build/apmpackage/data_stream/service_destination_60m_metrics/fields/ecs.yml
--- build/apmpackage-main/data_stream/service_destination_60m_metrics/fields/ecs.yml	2024-01-02 11:03:03.263545385 +0000
+++ build/apmpackage/data_stream/service_destination_60m_metrics/fields/ecs.yml	2024-01-02 11:08:35.752920158 +0000
@@ -3,6 +3,9 @@
 - external: ecs
   name: event.outcome
 - external: ecs
+  name: labels
+  dynamic: true
+- external: ecs
   name: observer.hostname
 - external: ecs
   name: observer.name
@@ -14,6 +17,3 @@
   name: service.environment
 - external: ecs
   name: service.name
-- external: ecs
-  name: labels
-  dynamic: true
diff -ru build/apmpackage-main/data_stream/service_destination_60m_metrics/fields/fields.yml build/apmpackage/data_stream/service_destination_60m_metrics/fields/fields.yml
--- build/apmpackage-main/data_stream/service_destination_60m_metrics/fields/fields.yml	2024-01-02 11:03:03.263545385 +0000
+++ build/apmpackage/data_stream/service_destination_60m_metrics/fields/fields.yml	2024-01-02 11:08:35.752920158 +0000
@@ -37,6 +37,8 @@
   unit: micros
 - name: numeric_labels
   type: object
+  object_type: scaled_float
   dynamic: true
+  scaling_factor: 1000000
   description: |
     Custom key/value pairs. Can be used to add meta information to events. Should not contain nested objects. All values are stored as scaled_float.
diff -ru build/apmpackage-main/data_stream/service_destination_60m_metrics/manifest.yml build/apmpackage/data_stream/service_destination_60m_metrics/manifest.yml
--- build/apmpackage-main/data_stream/service_destination_60m_metrics/manifest.yml	2024-01-02 11:03:03.263545385 +0000
+++ build/apmpackage/data_stream/service_destination_60m_metrics/manifest.yml	2024-01-02 11:08:35.752920158 +0000
@@ -4,18 +4,18 @@
 ilm_policy: metrics-apm.service_destination_60m_metrics-default_policy
 elasticsearch:
   dynamic_namespace: true
+  # Individual measurements are typically uninteresting, so
+  # use synthetic source to reduce storage size.
+  source_mode: synthetic
   index_template:
     mappings:
       # We are in full control of the field names,
       # but do not block ingestion on unexpected fields.
       dynamic: runtime
-      # Individual measurements are typically uninteresting, so
-      # use synthetic source to reduce storage size.
-      _source:
-        mode: synthetic
     settings:
       index:
-        sort.field: "@timestamp"
-        sort.order: desc
+        sort:
+          field: "@timestamp"
+          order: desc
     data_stream:
       hidden: true
diff -ru build/apmpackage-main/data_stream/service_summary_10m_metrics/fields/ecs.yml build/apmpackage/data_stream/service_summary_10m_metrics/fields/ecs.yml
--- build/apmpackage-main/data_stream/service_summary_10m_metrics/fields/ecs.yml	2024-01-02 11:03:03.267545402 +0000
+++ build/apmpackage/data_stream/service_summary_10m_metrics/fields/ecs.yml	2024-01-02 11:08:35.764920214 +0000
@@ -1,6 +1,9 @@
 - external: ecs
   name: agent.name
 - external: ecs
+  name: labels
+  dynamic: true
+- external: ecs
   name: observer.hostname
 - external: ecs
   name: observer.name
@@ -12,6 +15,3 @@
   name: service.environment
 - external: ecs
   name: service.name
-- external: ecs
-  name: labels
-  dynamic: true
diff -ru build/apmpackage-main/data_stream/service_summary_10m_metrics/fields/fields.yml build/apmpackage/data_stream/service_summary_10m_metrics/fields/fields.yml
--- build/apmpackage-main/data_stream/service_summary_10m_metrics/fields/fields.yml	2024-01-02 11:03:03.267545402 +0000
+++ build/apmpackage/data_stream/service_summary_10m_metrics/fields/fields.yml	2024-01-02 11:08:35.764920214 +0000
@@ -14,6 +14,7 @@
     Name of the programming language used.
 - name: numeric_labels
   type: object
+  object_type: scaled_float
   dynamic: true
   description: |
     Custom key/value pairs. Can be used to add meta information to events. Should not contain nested objects. All values are stored as scaled_float.
diff -ru build/apmpackage-main/data_stream/service_summary_10m_metrics/manifest.yml build/apmpackage/data_stream/service_summary_10m_metrics/manifest.yml
--- build/apmpackage-main/data_stream/service_summary_10m_metrics/manifest.yml	2024-01-02 11:03:03.271545417 +0000
+++ build/apmpackage/data_stream/service_summary_10m_metrics/manifest.yml	2024-01-02 11:08:35.764920214 +0000
@@ -9,13 +9,13 @@
       # We are in full control of the field names,
       # but do not block ingestion on unexpected fields.
       dynamic: runtime
-      # Individual measurements are typically uninteresting, so
-      # use synthetic source to reduce storage size.
-      _source:
-        mode: synthetic
     settings:
       index:
-        sort.field: "@timestamp"
-        sort.order: desc
+        sort:
+          field: "@timestamp"
+          order: desc
     data_stream:
       hidden: true
+  # Individual measurements are typically uninteresting, so
+  # use synthetic source to reduce storage size.
+  source_mode: synthetic
diff -ru build/apmpackage-main/data_stream/service_summary_1m_metrics/fields/ecs.yml build/apmpackage/data_stream/service_summary_1m_metrics/fields/ecs.yml
--- build/apmpackage-main/data_stream/service_summary_1m_metrics/fields/ecs.yml	2024-01-02 11:03:03.267545402 +0000
+++ build/apmpackage/data_stream/service_summary_1m_metrics/fields/ecs.yml	2024-01-02 11:08:35.764920214 +0000
@@ -1,6 +1,9 @@
 - external: ecs
   name: agent.name
 - external: ecs
+  name: labels
+  dynamic: true
+- external: ecs
   name: observer.hostname
 - external: ecs
   name: observer.name
@@ -12,6 +15,3 @@
   name: service.environment
 - external: ecs
   name: service.name
-- external: ecs
-  name: labels
-  dynamic: true
diff -ru build/apmpackage-main/data_stream/service_summary_1m_metrics/fields/fields.yml build/apmpackage/data_stream/service_summary_1m_metrics/fields/fields.yml
--- build/apmpackage-main/data_stream/service_summary_1m_metrics/fields/fields.yml	2024-01-02 11:03:03.267545402 +0000
+++ build/apmpackage/data_stream/service_summary_1m_metrics/fields/fields.yml	2024-01-02 11:08:35.764920214 +0000
@@ -14,6 +14,7 @@
     Name of the programming language used.
 - name: numeric_labels
   type: object
+  object_type: scaled_float
   dynamic: true
   description: |
     Custom key/value pairs. Can be used to add meta information to events. Should not contain nested objects. All values are stored as scaled_float.
diff -ru build/apmpackage-main/data_stream/service_summary_1m_metrics/manifest.yml build/apmpackage/data_stream/service_summary_1m_metrics/manifest.yml
--- build/apmpackage-main/data_stream/service_summary_1m_metrics/manifest.yml	2024-01-02 11:03:03.267545402 +0000
+++ build/apmpackage/data_stream/service_summary_1m_metrics/manifest.yml	2024-01-02 11:08:35.764920214 +0000
@@ -9,13 +9,13 @@
       # We are in full control of the field names,
       # but do not block ingestion on unexpected fields.
       dynamic: runtime
-      # Individual measurements are typically uninteresting, so
-      # use synthetic source to reduce storage size.
-      _source:
-        mode: synthetic
     settings:
       index:
-        sort.field: "@timestamp"
-        sort.order: desc
+        sort:
+          field: "@timestamp"
+          order: desc
     data_stream:
       hidden: false
+  # Individual measurements are typically uninteresting, so
+  # use synthetic source to reduce storage size.
+  source_mode: synthetic
diff -ru build/apmpackage-main/data_stream/service_summary_60m_metrics/fields/ecs.yml build/apmpackage/data_stream/service_summary_60m_metrics/fields/ecs.yml
--- build/apmpackage-main/data_stream/service_summary_60m_metrics/fields/ecs.yml	2024-01-02 11:03:03.267545402 +0000
+++ build/apmpackage/data_stream/service_summary_60m_metrics/fields/ecs.yml	2024-01-02 11:08:35.764920214 +0000
@@ -1,6 +1,9 @@
 - external: ecs
   name: agent.name
 - external: ecs
+  name: labels
+  dynamic: true
+- external: ecs
   name: observer.hostname
 - external: ecs
   name: observer.name
@@ -12,6 +15,3 @@
   name: service.environment
 - external: ecs
   name: service.name
-- external: ecs
-  name: labels
-  dynamic: true
diff -ru build/apmpackage-main/data_stream/service_summary_60m_metrics/fields/fields.yml build/apmpackage/data_stream/service_summary_60m_metrics/fields/fields.yml
--- build/apmpackage-main/data_stream/service_summary_60m_metrics/fields/fields.yml	2024-01-02 11:03:03.267545402 +0000
+++ build/apmpackage/data_stream/service_summary_60m_metrics/fields/fields.yml	2024-01-02 11:08:35.764920214 +0000
@@ -14,6 +14,7 @@
     Name of the programming language used.
 - name: numeric_labels
   type: object
+  object_type: scaled_float
   dynamic: true
   description: |
     Custom key/value pairs. Can be used to add meta information to events. Should not contain nested objects. All values are stored as scaled_float.
diff -ru build/apmpackage-main/data_stream/service_summary_60m_metrics/manifest.yml build/apmpackage/data_stream/service_summary_60m_metrics/manifest.yml
--- build/apmpackage-main/data_stream/service_summary_60m_metrics/manifest.yml	2024-01-02 11:03:03.271545417 +0000
+++ build/apmpackage/data_stream/service_summary_60m_metrics/manifest.yml	2024-01-02 11:08:35.764920214 +0000
@@ -9,13 +9,13 @@
       # We are in full control of the field names,
       # but do not block ingestion on unexpected fields.
       dynamic: runtime
-      # Individual measurements are typically uninteresting, so
-      # use synthetic source to reduce storage size.
-      _source:
-        mode: synthetic
     settings:
       index:
-        sort.field: "@timestamp"
-        sort.order: desc
+        sort:
+          field: "@timestamp"
+          order: desc
     data_stream:
       hidden: true
+  # Individual measurements are typically uninteresting, so
+  # use synthetic source to reduce storage size.
+  source_mode: synthetic
diff -ru build/apmpackage-main/data_stream/service_transaction_10m_metrics/fields/ecs.yml build/apmpackage/data_stream/service_transaction_10m_metrics/fields/ecs.yml
--- build/apmpackage-main/data_stream/service_transaction_10m_metrics/fields/ecs.yml	2024-01-02 11:03:03.275545433 +0000
+++ build/apmpackage/data_stream/service_transaction_10m_metrics/fields/ecs.yml	2024-01-02 11:08:35.768920233 +0000
@@ -1,6 +1,9 @@
 - external: ecs
   name: agent.name
 - external: ecs
+  name: labels
+  dynamic: true
+- external: ecs
   name: observer.hostname
 - external: ecs
   name: observer.name
@@ -12,6 +15,3 @@
   name: service.environment
 - external: ecs
   name: service.name
-- external: ecs
-  name: labels
-  dynamic: true
diff -ru build/apmpackage-main/data_stream/service_transaction_10m_metrics/fields/fields.yml build/apmpackage/data_stream/service_transaction_10m_metrics/fields/fields.yml
--- build/apmpackage-main/data_stream/service_transaction_10m_metrics/fields/fields.yml	2024-01-02 11:03:03.275545433 +0000
+++ build/apmpackage/data_stream/service_transaction_10m_metrics/fields/fields.yml	2024-01-02 11:08:35.768920233 +0000
@@ -22,9 +22,18 @@
     Pre-aggregated histogram of transaction durations.
 - name: numeric_labels
   type: object
+  object_type: scaled_float
   dynamic: true
   description: |
     Custom key/value pairs. Can be used to add meta information to events. Should not contain nested objects. All values are stored as scaled_float.
 - name: service_transaction.aggregation.overflow_count
   type: long
   description: Number of aggregation groups that overflowed for service transaction metrics aggregation.
+- name: transaction.duration.summary
+  type: aggregate_metric_double
+  metrics: ["sum", "value_count"]
+  default_metric: "sum"
+- name: event.success_count
+  type: aggregate_metric_double
+  metrics: ["sum", "value_count"]
+  default_metric: "sum"
diff -ru build/apmpackage-main/data_stream/service_transaction_10m_metrics/manifest.yml build/apmpackage/data_stream/service_transaction_10m_metrics/manifest.yml
--- build/apmpackage-main/data_stream/service_transaction_10m_metrics/manifest.yml	2024-01-02 11:03:03.275545433 +0000
+++ build/apmpackage/data_stream/service_transaction_10m_metrics/manifest.yml	2024-01-02 11:08:35.772920252 +0000
@@ -4,37 +4,18 @@
 ilm_policy: metrics-apm.service_transaction_10m_metrics-default_policy
 elasticsearch:
   dynamic_namespace: true
+  # Individual measurements are typically uninteresting, so
+  # use synthetic source to reduce storage size.
+  source_mode: synthetic
   index_template:
     mappings:
       # We are in full control of the field names,
       # but do not block ingestion on unexpected fields.
       dynamic: runtime
-      # Individual measurements are typically uninteresting, so
-      # use synthetic source to reduce storage size.
-      _source:
-        mode: synthetic
-      # We map transaction.duration.summary here because aggregate_metric_double
-      # is not currently supported by package-spec.
-      #
-      # See https://github.com/elastic/package-spec/issues/363
-      properties:
-        transaction:
-          properties:
-            duration:
-              properties:
-                summary:
-                  type: aggregate_metric_double
-                  metrics: [sum, value_count]
-                  default_metric: sum
-        event:
-          properties:
-            success_count:
-              type: aggregate_metric_double
-              metrics: [sum, value_count]
-              default_metric: sum
     settings:
       index:
-        sort.field: "@timestamp"
-        sort.order: desc
+        sort:
+          field: "@timestamp"
+          order: desc
     data_stream:
       hidden: true
diff -ru build/apmpackage-main/data_stream/service_transaction_1m_metrics/fields/ecs.yml build/apmpackage/data_stream/service_transaction_1m_metrics/fields/ecs.yml
--- build/apmpackage-main/data_stream/service_transaction_1m_metrics/fields/ecs.yml	2024-01-02 11:03:03.275545433 +0000
+++ build/apmpackage/data_stream/service_transaction_1m_metrics/fields/ecs.yml	2024-01-02 11:08:35.768920233 +0000
@@ -1,6 +1,9 @@
 - external: ecs
   name: agent.name
 - external: ecs
+  name: labels
+  dynamic: true
+- external: ecs
   name: observer.hostname
 - external: ecs
   name: observer.name
@@ -12,6 +15,3 @@
   name: service.environment
 - external: ecs
   name: service.name
-- external: ecs
-  name: labels
-  dynamic: true
diff -ru build/apmpackage-main/data_stream/service_transaction_1m_metrics/fields/fields.yml build/apmpackage/data_stream/service_transaction_1m_metrics/fields/fields.yml
--- build/apmpackage-main/data_stream/service_transaction_1m_metrics/fields/fields.yml	2024-01-02 11:03:03.275545433 +0000
+++ build/apmpackage/data_stream/service_transaction_1m_metrics/fields/fields.yml	2024-01-02 11:08:35.768920233 +0000
@@ -22,9 +22,18 @@
     Pre-aggregated histogram of transaction durations.
 - name: numeric_labels
   type: object
+  object_type: scaled_float
   dynamic: true
   description: |
     Custom key/value pairs. Can be used to add meta information to events. Should not contain nested objects. All values are stored as scaled_float.
 - name: service_transaction.aggregation.overflow_count
   type: long
   description: Number of aggregation groups that overflowed for service transaction metrics aggregation.
+- name: transaction.duration.summary
+  type: aggregate_metric_double
+  metrics: ["sum", "value_count"]
+  default_metric: "sum"
+- name: event.success_count
+  type: aggregate_metric_double
+  metrics: ["sum", "value_count"]
+  default_metric: "sum"
diff -ru build/apmpackage-main/data_stream/service_transaction_1m_metrics/manifest.yml build/apmpackage/data_stream/service_transaction_1m_metrics/manifest.yml
--- build/apmpackage-main/data_stream/service_transaction_1m_metrics/manifest.yml	2024-01-02 11:03:03.275545433 +0000
+++ build/apmpackage/data_stream/service_transaction_1m_metrics/manifest.yml	2024-01-02 11:08:35.772920252 +0000
@@ -4,37 +4,18 @@
 ilm_policy: metrics-apm.service_transaction_1m_metrics-default_policy
 elasticsearch:
   dynamic_namespace: true
+  # Individual measurements are typically uninteresting, so
+  # use synthetic source to reduce storage size.
+  source_mode: synthetic
   index_template:
     mappings:
       # We are in full control of the field names,
       # but do not block ingestion on unexpected fields.
       dynamic: runtime
-      # Individual measurements are typically uninteresting, so
-      # use synthetic source to reduce storage size.
-      _source:
-        mode: synthetic
-      # We map transaction.duration.summary here because aggregate_metric_double
-      # is not currently supported by package-spec.
-      #
-      # See https://github.com/elastic/package-spec/issues/363
-      properties:
-        transaction:
-          properties:
-            duration:
-              properties:
-                summary:
-                  type: aggregate_metric_double
-                  metrics: [sum, value_count]
-                  default_metric: sum
-        event:
-          properties:
-            success_count:
-              type: aggregate_metric_double
-              metrics: [sum, value_count]
-              default_metric: sum
     settings:
       index:
-        sort.field: "@timestamp"
-        sort.order: desc
+        sort:
+          field: "@timestamp"
+          order: desc
     data_stream:
       hidden: false
diff -ru build/apmpackage-main/data_stream/service_transaction_60m_metrics/fields/ecs.yml build/apmpackage/data_stream/service_transaction_60m_metrics/fields/ecs.yml
--- build/apmpackage-main/data_stream/service_transaction_60m_metrics/fields/ecs.yml	2024-01-02 11:03:03.275545433 +0000
+++ build/apmpackage/data_stream/service_transaction_60m_metrics/fields/ecs.yml	2024-01-02 11:08:35.768920233 +0000
@@ -1,6 +1,9 @@
 - external: ecs
   name: agent.name
 - external: ecs
+  name: labels
+  dynamic: true
+- external: ecs
   name: observer.hostname
 - external: ecs
   name: observer.name
@@ -12,6 +15,3 @@
   name: service.environment
 - external: ecs
   name: service.name
-- external: ecs
-  name: labels
-  dynamic: true
diff -ru build/apmpackage-main/data_stream/service_transaction_60m_metrics/fields/fields.yml build/apmpackage/data_stream/service_transaction_60m_metrics/fields/fields.yml
--- build/apmpackage-main/data_stream/service_transaction_60m_metrics/fields/fields.yml	2024-01-02 11:03:03.275545433 +0000
+++ build/apmpackage/data_stream/service_transaction_60m_metrics/fields/fields.yml	2024-01-02 11:08:35.768920233 +0000
@@ -22,9 +22,18 @@
     Pre-aggregated histogram of transaction durations.
 - name: numeric_labels
   type: object
+  object_type: scaled_float
   dynamic: true
   description: |
     Custom key/value pairs. Can be used to add meta information to events. Should not contain nested objects. All values are stored as scaled_float.
 - name: service_transaction.aggregation.overflow_count
   type: long
   description: Number of aggregation groups that overflowed for service transaction metrics aggregation.
+- name: transaction.duration.summary
+  type: aggregate_metric_double
+  metrics: ["sum", "value_count"]
+  default_metric: "sum"
+- name: event.success_count
+  type: aggregate_metric_double
+  metrics: ["sum", "value_count"]
+  default_metric: "sum"
diff -ru build/apmpackage-main/data_stream/service_transaction_60m_metrics/manifest.yml build/apmpackage/data_stream/service_transaction_60m_metrics/manifest.yml
--- build/apmpackage-main/data_stream/service_transaction_60m_metrics/manifest.yml	2024-01-02 11:03:03.275545433 +0000
+++ build/apmpackage/data_stream/service_transaction_60m_metrics/manifest.yml	2024-01-02 11:08:35.772920252 +0000
@@ -4,37 +4,18 @@
 ilm_policy: metrics-apm.service_transaction_60m_metrics-default_policy
 elasticsearch:
   dynamic_namespace: true
+  # Individual measurements are typically uninteresting, so
+  # use synthetic source to reduce storage size.
+  source_mode: synthetic
   index_template:
     mappings:
       # We are in full control of the field names,
       # but do not block ingestion on unexpected fields.
       dynamic: runtime
-      # Individual measurements are typically uninteresting, so
-      # use synthetic source to reduce storage size.
-      _source:
-        mode: synthetic
-      # We map transaction.duration.summary here because aggregate_metric_double
-      # is not currently supported by package-spec.
-      #
-      # See https://github.com/elastic/package-spec/issues/363
-      properties:
-        transaction:
-          properties:
-            duration:
-              properties:
-                summary:
-                  type: aggregate_metric_double
-                  metrics: [sum, value_count]
-                  default_metric: sum
-        event:
-          properties:
-            success_count:
-              type: aggregate_metric_double
-              metrics: [sum, value_count]
-              default_metric: sum
     settings:
       index:
-        sort.field: "@timestamp"
-        sort.order: desc
+        sort:
+          field: "@timestamp"
+          order: desc
     data_stream:
       hidden: true
diff -ru build/apmpackage-main/data_stream/traces/fields/fields.yml build/apmpackage/data_stream/traces/fields/fields.yml
--- build/apmpackage-main/data_stream/traces/fields/fields.yml	2024-01-02 11:03:03.279545449 +0000
+++ build/apmpackage/data_stream/traces/fields/fields.yml	2024-01-02 11:08:35.772920252 +0000
@@ -62,16 +62,19 @@
     The original body of the monitored HTTP request.
 - name: http.request.env
   type: object
+  object_type: keyword
   dynamic: true
   description: |
     The CGI-like environment variables of the monitored HTTP request.
 - name: http.request.cookies
   type: object
+  object_type: keyword
   dynamic: true
   description: |
     The cookies of the monitored HTTP request.
 - name: http.request.headers
   type: object
+  object_type: keyword
   dynamic: true
   description: |
     The canonical headers of the monitored HTTP request.
@@ -81,6 +84,7 @@
     Used by the Node agent to indicate when in the response life cycle an error has occurred.
 - name: http.response.headers
   type: object
+  object_type: keyword
   dynamic: true
   description: |
     The canonical headers of the monitored HTTP response.
@@ -292,6 +296,7 @@
   index: false
 - name: span.message.headers
   type: object
+  object_type: keyword
   dynamic: true
   description: The message headers
 - name: span.message.age.ms
@@ -359,6 +364,7 @@
   description: The Total Blocking Time metric
 - name: transaction.marks
   type: object
+  object_type: long
   description: |
     A user-defined mapping of groups of marks in milliseconds.
   dynamic: true
@@ -372,6 +378,7 @@
   index: false
 - name: transaction.message.headers
   type: object
+  object_type: keyword
   dynamic: true
   description: The message headers
 - name: transaction.message.age.ms
@@ -414,6 +421,8 @@
     The approximate number of transactions represented, based on the inverse sampling rate.
 - name: numeric_labels
   type: object
+  object_type: scaled_float
   dynamic: true
+  scaling_factor: 1000000
   description: |
     Custom key/value pairs. Can be used to add meta information to events. Should not contain nested objects. All values are stored as scaled_float.
diff -ru build/apmpackage-main/data_stream/traces/manifest.yml build/apmpackage/data_stream/traces/manifest.yml
--- build/apmpackage-main/data_stream/traces/manifest.yml	2024-01-02 11:03:03.279545449 +0000
+++ build/apmpackage/data_stream/traces/manifest.yml	2024-01-02 11:08:35.772920252 +0000
@@ -13,9 +13,3 @@
       # ad-hoc searches on HTTP request headers without incurring storage cost
       # for users who do not need this capability.
       dynamic: false
-      dynamic_templates:
-        - numeric_labels:
-            path_match: numeric_labels.*
-            mapping:
-              type: scaled_float
-              scaling_factor: 1000000
diff -ru build/apmpackage-main/data_stream/transaction_10m_metrics/fields/fields.yml build/apmpackage/data_stream/transaction_10m_metrics/fields/fields.yml
--- build/apmpackage-main/data_stream/transaction_10m_metrics/fields/fields.yml	2024-01-02 11:03:03.287545480 +0000
+++ build/apmpackage/data_stream/transaction_10m_metrics/fields/fields.yml	2024-01-02 11:08:35.776920270 +0000
@@ -73,9 +73,18 @@
     Keyword of specific relevance in the service's domain (eg. 'request', 'backgroundjob', etc)
 - name: numeric_labels
   type: object
+  object_type: scaled_float
   dynamic: true
   description: |
     Custom key/value pairs. Can be used to add meta information to events. Should not contain nested objects. All values are stored as scaled_float.
 - name: transaction.aggregation.overflow_count
   type: long
   description: Number of aggregation groups that overflowed for transaction metrics aggregation
+- name: transaction.duration.summary
+  type: aggregate_metric_double
+  metrics: ["sum", "value_count"]
+  default_metric: "sum"
+- name: event.success_count
+  type: aggregate_metric_double
+  metrics: ["sum", "value_count"]
+  default_metric: "sum"
diff -ru build/apmpackage-main/data_stream/transaction_10m_metrics/manifest.yml build/apmpackage/data_stream/transaction_10m_metrics/manifest.yml
--- build/apmpackage-main/data_stream/transaction_10m_metrics/manifest.yml	2024-01-02 11:03:03.287545480 +0000
+++ build/apmpackage/data_stream/transaction_10m_metrics/manifest.yml	2024-01-02 11:08:35.780920289 +0000
@@ -4,37 +4,18 @@
 ilm_policy: metrics-apm.transaction_10m_metrics-default_policy
 elasticsearch:
   dynamic_namespace: true
+  # Individual measurements are typically uninteresting, so
+  # use synthetic source to reduce storage size.
+  source_mode: synthetic
   index_template:
     mappings:
       # We are in full control of the field names,
       # but do not block ingestion on unexpected fields.
       dynamic: runtime
-      # Individual measurements are typically uninteresting, so
-      # use synthetic source to reduce storage size.
-      _source:
-        mode: synthetic
-      # We map transaction.duration.summary and event.success_count here
-      # because aggregate_metric_double is not currently supported by package-spec.
-      #
-      # See https://github.com/elastic/package-spec/issues/363
-      properties:
-        transaction:
-          properties:
-            duration:
-              properties:
-                summary:
-                  type: aggregate_metric_double
-                  metrics: [sum, value_count]
-                  default_metric: sum
-        event:
-          properties:
-            success_count:
-              type: aggregate_metric_double
-              metrics: [sum, value_count]
-              default_metric: sum
     settings:
       index:
-        sort.field: "@timestamp"
-        sort.order: desc
+        sort:
+          field: "@timestamp"
+          order: desc
     data_stream:
       hidden: true
diff -ru build/apmpackage-main/data_stream/transaction_1m_metrics/fields/fields.yml build/apmpackage/data_stream/transaction_1m_metrics/fields/fields.yml
--- build/apmpackage-main/data_stream/transaction_1m_metrics/fields/fields.yml	2024-01-02 11:03:03.287545480 +0000
+++ build/apmpackage/data_stream/transaction_1m_metrics/fields/fields.yml	2024-01-02 11:08:35.776920270 +0000
@@ -73,9 +73,18 @@
     Keyword of specific relevance in the service's domain (eg. 'request', 'backgroundjob', etc)
 - name: numeric_labels
   type: object
+  object_type: scaled_float
   dynamic: true
   description: |
     Custom key/value pairs. Can be used to add meta information to events. Should not contain nested objects. All values are stored as scaled_float.
 - name: transaction.aggregation.overflow_count
   type: long
   description: Number of aggregation groups that overflowed for transaction metrics aggregation
+- name: transaction.duration.summary
+  type: aggregate_metric_double
+  metrics: ["sum", "value_count"]
+  default_metric: "sum"
+- name: event.success_count
+  type: aggregate_metric_double
+  metrics: ["sum", "value_count"]
+  default_metric: "sum"
diff -ru build/apmpackage-main/data_stream/transaction_1m_metrics/manifest.yml build/apmpackage/data_stream/transaction_1m_metrics/manifest.yml
--- build/apmpackage-main/data_stream/transaction_1m_metrics/manifest.yml	2024-01-02 11:03:03.287545480 +0000
+++ build/apmpackage/data_stream/transaction_1m_metrics/manifest.yml	2024-01-02 11:08:35.776920270 +0000
@@ -4,37 +4,18 @@
 ilm_policy: metrics-apm.transaction_1m_metrics-default_policy
 elasticsearch:
   dynamic_namespace: true
+  # Individual measurements are typically uninteresting, so
+  # use synthetic source to reduce storage size.
+  source_mode: synthetic
   index_template:
     mappings:
       # We are in full control of the field names,
       # but do not block ingestion on unexpected fields.
       dynamic: runtime
-      # Individual measurements are typically uninteresting, so
-      # use synthetic source to reduce storage size.
-      _source:
-        mode: synthetic
-      # We map transaction.duration.summary and event.success_count here
-      # because aggregate_metric_double is not currently supported by package-spec.
-      #
-      # See https://github.com/elastic/package-spec/issues/363
-      properties:
-        transaction:
-          properties:
-            duration:
-              properties:
-                summary:
-                  type: aggregate_metric_double
-                  metrics: [sum, value_count]
-                  default_metric: sum
-        event:
-          properties:
-            success_count:
-              type: aggregate_metric_double
-              metrics: [sum, value_count]
-              default_metric: sum
     settings:
       index:
-        sort.field: "@timestamp"
-        sort.order: desc
+        sort:
+          field: "@timestamp"
+          order: desc
     data_stream:
       hidden: false
diff -ru build/apmpackage-main/data_stream/transaction_60m_metrics/fields/fields.yml build/apmpackage/data_stream/transaction_60m_metrics/fields/fields.yml
--- build/apmpackage-main/data_stream/transaction_60m_metrics/fields/fields.yml	2024-01-02 11:03:03.287545480 +0000
+++ build/apmpackage/data_stream/transaction_60m_metrics/fields/fields.yml	2024-01-02 11:08:35.776920270 +0000
@@ -73,9 +73,18 @@
     Keyword of specific relevance in the service's domain (eg. 'request', 'backgroundjob', etc)
 - name: numeric_labels
   type: object
+  object_type: scaled_float
   dynamic: true
   description: |
     Custom key/value pairs. Can be used to add meta information to events. Should not contain nested objects. All values are stored as scaled_float.
 - name: transaction.aggregation.overflow_count
   type: long
   description: Number of aggregation groups that overflowed for transaction metrics aggregation
+- name: transaction.duration.summary
+  type: aggregate_metric_double
+  metrics: ["sum", "value_count"]
+  default_metric: "sum"
+- name: event.success_count
+  type: aggregate_metric_double
+  metrics: ["sum", "value_count"]
+  default_metric: "sum"
diff -ru build/apmpackage-main/data_stream/transaction_60m_metrics/manifest.yml build/apmpackage/data_stream/transaction_60m_metrics/manifest.yml
--- build/apmpackage-main/data_stream/transaction_60m_metrics/manifest.yml	2024-01-02 11:03:03.287545480 +0000
+++ build/apmpackage/data_stream/transaction_60m_metrics/manifest.yml	2024-01-02 11:08:35.780920289 +0000
@@ -4,37 +4,18 @@
 ilm_policy: metrics-apm.transaction_60m_metrics-default_policy
 elasticsearch:
   dynamic_namespace: true
+  # Individual measurements are typically uninteresting, so
+  # use synthetic source to reduce storage size.
+  source_mode: synthetic
   index_template:
     mappings:
       # We are in full control of the field names,
       # but do not block ingestion on unexpected fields.
       dynamic: runtime
-      # Individual measurements are typically uninteresting, so
-      # use synthetic source to reduce storage size.
-      _source:
-        mode: synthetic
-      # We map transaction.duration.summary and event.success_count here
-      # because aggregate_metric_double is not currently supported by package-spec.
-      #
-      # See https://github.com/elastic/package-spec/issues/363
-      properties:
-        transaction:
-          properties:
-            duration:
-              properties:
-                summary:
-                  type: aggregate_metric_double
-                  metrics: [sum, value_count]
-                  default_metric: sum
-        event:
-          properties:
-            success_count:
-              type: aggregate_metric_double
-              metrics: [sum, value_count]
-              default_metric: sum
     settings:
       index:
-        sort.field: "@timestamp"
-        sort.order: desc
+        sort:
+          field: "@timestamp"
+          order: desc
     data_stream:
       hidden: true
diff -ru build/apmpackage-main/docs/README.md build/apmpackage/docs/README.md
--- build/apmpackage-main/docs/README.md	2024-01-02 11:03:06.267557210 +0000
+++ build/apmpackage/docs/README.md	2024-01-02 11:08:36.356922989 +0000
@@ -390,6 +390,7 @@
 | destination.ip | IP address of the destination (IPv4 or IPv6). | ip |  |  |
 | destination.port | Port of the destination. | long |  |  |
 | event.outcome | This is one of four ECS Categorization Fields, and indicates the lowest level in the ECS category hierarchy. `event.outcome` simply denotes whether the event represents a success or a failure from the perspective of the entity that produced the event. Note that when a single transaction is described in multiple events, each event may populate different values of `event.outcome`, according to their perspective. Also note that in the case of a compound event (a single event that contains multiple logical events), this field should be populated with the value that best captures the overall success or failure from the perspective of the event producer. Further note that not all events will have an associated outcome. For example, this field is generally not populated for metric events, events with `event.type:info`, or any events for which an outcome does not make logical sense. | keyword |  |  |
+| event.success_count |  | aggregate_metric_double |  |  |
 | faas.billed_duration | The number of milliseconds for which the FaaS end user is billed. | long | ms | counter |
 | faas.coldstart | Boolean indicating whether the function invocation was a coldstart or not. | boolean |  |  |
 | faas.coldstart_duration | The number of milliseconds elapsed during cold start. | float | ms | counter |
@@ -515,6 +516,7 @@
 | system.process.memory.size | The total virtual memory the process has. | long | byte | gauge |
 | tags | List of keywords used to tag each event. | keyword |  |  |
 | transaction.duration.histogram | Pre-aggregated histogram of transaction durations. | histogram |  |  |
+| transaction.duration.summary |  | aggregate_metric_double |  |  |
 | transaction.name | Generic designation of a transaction in the scope of a single service (eg. 'GET /users/:id'). | keyword |  |  |
 | transaction.result | The result of the transaction. HTTP status code for HTTP-related transactions. | keyword |  |  |
 | transaction.root | Identifies metrics for root transactions. This can be used for calculating metrics for traces. | boolean |  |  |
diff -ru build/apmpackage-main/manifest.yml build/apmpackage/manifest.yml
--- build/apmpackage-main/manifest.yml	2024-01-02 11:03:03.291545496 +0000
+++ build/apmpackage/manifest.yml	2024-01-02 11:08:35.780920289 +0000
@@ -1,4 +1,4 @@
-format_version: 2.10.0
+format_version: 3.0.1
 name: apm
 title: Elastic APM
 version: 8.13.0
@@ -6,7 +6,11 @@
 type: integration
 categories: ["elastic_stack", "monitoring"]
 conditions:
-  kibana.version: ^8.13.0
+  elastic:
+    capabilities:
+      - apm
+  kibana:
+    version: ^8.13.0
 icons:
   - src: /img/logo_apm.svg
     title: APM Logo
@@ -164,4 +168,5 @@
             default: "3GB"
         template_path: template.yml.hbs
 owner:
+  type: elastic
   github: elastic/apm-server

carsonip
carsonip previously approved these changes Jan 3, 2024
@carsonip
Copy link
Member

carsonip commented Jan 3, 2024

When testing this, we should really test upgrading apmpackage with existing docs, as well as searching for documents in discover.

@kyungeunni kyungeunni requested a review from carsonip January 4, 2024 01:57
@simitt
Copy link
Contributor

simitt commented Jan 4, 2024

When testing this we should really test upgrading apmpackage, as well as searching documents in discover.

@kyungeunni, please add instructions to the How to test this section

@kyungeunni kyungeunni enabled auto-merge (squash) January 11, 2024 10:41
@kyungeunni kyungeunni merged commit 8a1d41a into elastic:main Jan 12, 2024
10 of 11 checks passed
@simitt simitt assigned simitt and unassigned kyungeunni Mar 20, 2024
@simitt
Copy link
Contributor

simitt commented Mar 20, 2024

Tested with BC 5 on ESS:
(1) create deployment v8.11.4 and ingested data via apm-server apmsoak tool (go run main.go -api-key ${APM_SERVER_API_KEY} -server ${APM_SERVER_URL} --event-rate=20/s --rewrite-ids --rewrite-timestamps)
(2) upgrade deployment to v8.13.0 and re-run command for ingestion
(3) checked that there are no error logs
(4) checked apm templates are set up correctly and integration is upgraded to 8.13
(5) checked that data are showing up in apm ui as expected

Behavior as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-skip Skip notification from the automated backport with mergify test-plan test-plan-ok v8.13.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update integration package to package spec v3
4 participants