Skip to content

Commit

Permalink
rename indices and refactor code
Browse files Browse the repository at this point in the history
  • Loading branch information
MiriamAparicio committed Sep 25, 2024
1 parent e214bfc commit 5c95114
Show file tree
Hide file tree
Showing 7 changed files with 121 additions and 309 deletions.
2 changes: 1 addition & 1 deletion packages/kbn-apm-synthtrace-client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ export type { ESDocumentWithOperation, SynthtraceESAction, SynthtraceGenerator }
export { log, type LogDocument, LONG_FIELD_NAME } from './src/lib/logs';
export { type AssetDocument } from './src/lib/assets';
export { syntheticsMonitor, type SyntheticsMonitorDocument } from './src/lib/synthetics';
export { otel, type OtelDocument, type OtelTrace } from './src/lib/otel';
export { otel, type OtelDocument } from './src/lib/otel';
26 changes: 13 additions & 13 deletions packages/kbn-apm-synthtrace-client/src/lib/otel/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@
* Side Public License, v 1.
*/

import type { OtelDocument } from '@kbn/apm-synthtrace-client';
import type { OtelDocument } from '../../..';
import { Serializable } from '../serializable';
import { generateShortId } from '../utils/generate_id';

export class OtelError extends Serializable<OtelDocument> {
constructor(fields: OtelDocument) {
export interface OtelErrorDocument extends OtelDocument {
name?: string;
attributes?: {
'exception.message'?: string;
'exception.type'?: string;
'processor.event'?: string;
'timestamp.us'?: number;
};
}

export class OtelError extends Serializable<OtelErrorDocument> {
constructor(fields: OtelErrorDocument) {
super({
...fields,
// 'processor.event': 'error',
// 'processor.name': 'error',
trace_id: generateShortId(),
});
}

timestamp(value: number) {
const ret = super.timestamp(value);
this.fields['timestamp.us'] = value * 1000;
return ret;
}
}
Loading

0 comments on commit 5c95114

Please sign in to comment.