[8.11] [Reporting] UUID vs PUID (#170177) (#170460)

# Backport

This will backport the following commits from `main` to `8.11`:
- [[Reporting] UUID vs PUID
(#170177)](https://github.com/elastic/kibana/pull/170177)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Rachel
Shen","email":"rshen@elastic.co"},"sourceCommit":{"committedDate":"2023-11-02T17:01:17Z","message":"[Reporting]
UUID vs PUID (#170177)\n\n## Summary\r\n\r\nCloses
[169732](https://github.com/elastic/kibana/issues/169732)","sha":"3e92751b39e84671400b4040576f68767487701b","branchLabelMapping":{"^v8.12.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:all-open","v8.12.0"],"number":170177,"url":"https://github.com/elastic/kibana/pull/170177","mergeCommit":{"message":"[Reporting]
UUID vs PUID (#170177)\n\n## Summary\r\n\r\nCloses
[169732](https://github.com/elastic/kibana/issues/169732)","sha":"3e92751b39e84671400b4040576f68767487701b"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.12.0","labelRegex":"^v8.12.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/170177","number":170177,"mergeCommit":{"message":"[Reporting]
UUID vs PUID (#170177)\n\n## Summary\r\n\r\nCloses
[169732](https://github.com/elastic/kibana/issues/169732)","sha":"3e92751b39e84671400b4040576f68767487701b"}}]}]
BACKPORT-->

Co-authored-by: Rachel Shen <rshen@elastic.co>
This commit is contained in:
Kibana Machine 2023-11-02 14:48:46 -04:00 committed by GitHub
parent 3e367aadf8
commit d693cb4c02
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -8,7 +8,7 @@ import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import { ByteSizeValue } from '@kbn/config-schema';
import type { ElasticsearchClient, Logger } from '@kbn/core/server';
import { defaults, get } from 'lodash';
import Puid from 'puid';
import { v4 as uuidv4 } from 'uuid';
import { Duplex } from 'stream';
import type { ReportingCore } from '..';
import type { ReportSource } from '../../common/types';
@ -74,7 +74,6 @@ export class ContentStream extends Duplex {
private jobSize?: number;
private maxChunkSize?: number;
private parameters: Required<ContentStreamParameters>;
private puid = new Puid();
private primaryTerm?: number;
private seqNo?: number;
@ -233,7 +232,7 @@ export class ContentStream extends Duplex {
private async writeChunk(content: string) {
const { id: parentId, index } = this.document;
const id = this.puid.generate();
const id = uuidv4();
this.logger.debug(`Writing chunk #${this.chunksWritten} (${id}).`);