kibana/packages/kbn-apm-synthtrace-client/index.ts
Cauê Marcondes fe22ac9928
[Synthtrace] Adding Entities support (#196258)
## known issue
```
- Transforms are not started by synthtrace. 
Because it duplicates data ingested by synthrace on signal indices. And it takes a long time to generate data.

- We are not able to open the Inventory page because of 👆🏻.
```
---

```
node scripts/synthtrace.js traces_logs_entities.ts --clean --live
```
or 
```
node scripts/synthtrace.js traces_logs_entities.ts --clean --from=2024-04-08T08:00:00.000Z --to=2024-04-08T08:15:00.000Z
```

docs produces by the new scenario:
```
{
  "took": 1,
  "timed_out": false,
  "_shards": {
    "total": 1,
    "successful": 1,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": {
      "value": 3,
      "relation": "eq"
    },
    "max_score": 1,
    "hits": [
      {
        "_index": ".entities.v1.latest.builtin_services_from_ecs_data",
        "_id": "2846700000000001",
        "_score": 1,
        "_source": {
          "service": {
            "name": "synth-node-trace-logs",
            "environment": "Synthtrace: traces_logs_entities"
          },
          "source_data_stream": {
            "type": [
              "traces",
              "logs"
            ]
          },
          "agent": {
            "name": [
              "nodejs"
            ]
          },
          "entity": {
            "id": "2846700000000001",
            "type": "service",
            "definitionId": "latest",
            "lastSeenTimestamp": "2024-10-15T08:56:20.562Z"
          },
          "event": {
            "ingested": "2024-10-15T08:56:20.562Z"
          }
        }
      },
      {
        "_index": ".entities.v1.latest.builtin_services_from_ecs_data",
        "_id": "2846700000000000",
        "_score": 1,
        "_source": {
          "service": {
            "name": "synth-java-trace",
            "environment": "Synthtrace: traces_logs_entities"
          },
          "source_data_stream": {
            "type": [
              "traces"
            ]
          },
          "agent": {
            "name": [
              "java"
            ]
          },
          "entity": {
            "id": "2846700000000000",
            "type": "service",
            "definitionId": "latest",
            "lastSeenTimestamp": "2024-10-15T08:56:20.562Z"
          },
          "event": {
            "ingested": "2024-10-15T08:56:20.562Z"
          }
        }
      },
      {
        "_index": ".entities.v1.latest.builtin_services_from_ecs_data",
        "_id": "2846700000000002",
        "_score": 1,
        "_source": {
          "service": {
            "name": "synth-go-logs",
            "environment": "Synthtrace: traces_logs_entities"
          },
          "source_data_stream": {
            "type": [
              "logs"
            ]
          },
          "agent": {
            "name": [
              "go"
            ]
          },
          "entity": {
            "id": "2846700000000002",
            "type": "service",
            "definitionId": "latest",
            "lastSeenTimestamp": "2024-10-15T08:56:20.562Z"
          },
          "event": {
            "ingested": "2024-10-15T08:56:20.562Z"
          }
        }
      }
    ]
  }
}
```
2024-10-15 16:21:32 +01:00

40 lines
2.1 KiB
TypeScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/
export { observer } from './src/lib/agent_config';
export type { AgentConfigFields } from './src/lib/agent_config/agent_config_fields';
export { apm } from './src/lib/apm';
export type { ApmFields } from './src/lib/apm/apm_fields';
export type { Instance } from './src/lib/apm/instance';
export { MobileDevice } from './src/lib/apm/mobile_device';
export type {
DeviceInfo,
GeoInfo,
NetworkConnectionInfo,
OSInfo,
} from './src/lib/apm/mobile_device';
export { httpExitSpan } from './src/lib/apm/span';
export { DistributedTrace } from './src/lib/dsl/distributed_trace_client';
export { serviceMap } from './src/lib/dsl/service_map';
export type { Fields } from './src/lib/entity';
export { Entity } from './src/lib/entity';
export { infra, type InfraDocument } from './src/lib/infra';
export { parseInterval } from './src/lib/interval';
export { monitoring, type MonitoringDocument } from './src/lib/monitoring';
export type { Serializable } from './src/lib/serializable';
export { timerange } from './src/lib/timerange';
export type { Timerange } from './src/lib/timerange';
export { dedot } from './src/lib/utils/dedot';
export { generateLongId, generateShortId } from './src/lib/utils/generate_id';
export { appendHash, hashKeysOf } from './src/lib/utils/hash';
export type { ESDocumentWithOperation, SynthtraceESAction, SynthtraceGenerator } from './src/types';
export { log, type LogDocument, LONG_FIELD_NAME } from './src/lib/logs';
export { syntheticsMonitor, type SyntheticsMonitorDocument } from './src/lib/synthetics';
export { otel, type OtelDocument } from './src/lib/otel';
export { type EntityFields, entities } from './src/lib/entities';