Skip to content

Commit

Permalink
Pick fields for AgentConfigFields from ApmFields
Browse files Browse the repository at this point in the history
  • Loading branch information
gbamparop committed May 16, 2022
1 parent 560c644 commit 0aa86ff
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,20 @@
* Side Public License, v 1.
*/

import { Fields } from '../entity';
import { ApmFields } from '../apm/apm_fields';

export interface Observer {
hostname: string;
id: string;
ephemeral_id: string;
type: string;
version: string;
}

export type AgentConfigFields = Fields &
export type AgentConfigFields = Pick<
ApmFields,
| '@timestamp'
| 'processor.event'
| 'processor.name'
| 'metricset.name'
| 'observer'
| 'ecs.version'
| 'event.ingested'
> &
Partial<{
'processor.event': string;
'processor.name': string;
'labels.etag': string;
'metricset.name': string;
observer: Observer;
agent_config_applied: number;
'ecs.version': string;
'event.agent_id_status': string;
'event.ingested': string;
}>;
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { AgentConfigFields } from './agent_config_fields';
export class AgentConfigMetrics extends Serializable<AgentConfigFields> {
timestamp(timestamp: number): this {
super.timestamp(timestamp);
this.fields['event.ingested'] = new Date(timestamp).toISOString();
this.fields['event.ingested'] = new Date(timestamp).getTime();
return this;
}
}

0 comments on commit 0aa86ff

Please sign in to comment.