Skip to content

Commit

Permalink
Merge remote-tracking branch 'crespocarlos/192606-move-source-to-fiel…
Browse files Browse the repository at this point in the history
…ds' into 192606-move-source-to-fields
  • Loading branch information
miloszmarcinkowski committed Oct 8, 2024
2 parents 35062d0 + 486e30e commit ae4633c
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import { AllowUnknownProperties } from '../../typings/common';
import { APMError } from '../../typings/es_schemas/ui/apm_error';
import { Span } from '../../typings/es_schemas/ui/span';
import { Transaction } from '../../typings/es_schemas/ui/transaction';
import * as allApmFieldnames from './apm';
import * as infraMetricsFieldnames from './infra_metrics';
import * as allApmFieldNames from './apm';
import * as infraMetricsFieldNames from './infra_metrics';

const { AT_TIMESTAMP, ...apmFieldnames } = allApmFieldnames;
const { AT_TIMESTAMP, ...apmFieldNames } = allApmFieldNames;
const fieldnames = {
...apmFieldnames,
...infraMetricsFieldnames,
...apmFieldNames,
...infraMetricsFieldNames,
};

describe('Transaction', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ export async function getErrorSampleDetails({
}): Promise<Partial<ErrorSampleDetailsResponse>> {
const requiredFields = asMutableArray([
AGENT_NAME,
AGENT_VERSION,
PROCESSOR_EVENT,
TRACE_ID,
TIMESTAMP_US,
Expand All @@ -80,6 +79,7 @@ export async function getErrorSampleDetails({

const optionalFields = asMutableArray([
TRANSACTION_ID,
AGENT_VERSION,
PROCESSOR_NAME,
ERROR_STACK_TRACE,
ERROR_EXC_MESSAGE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
LABEL_TELEMETRY_AUTO_VERSION,
AGENT_VERSION,
SERVICE_FRAMEWORK_NAME,
KUBERNETES,
} from '../../../common/es_fields/apm';
import { ContainerType } from '../../../common/service_metadata';
import { getProcessorEventForTransactions } from '../../lib/helpers/transactions';
Expand Down Expand Up @@ -62,7 +61,7 @@ export async function getServiceMetadataIcons({
const filter = [{ term: { [SERVICE_NAME]: serviceName } }, ...rangeQuery(start, end)];

const fields = asMutableArray([
KUBERNETES,
KUBERNETES_POD_NAME,
CLOUD_PROVIDER,
CONTAINER_ID,
AGENT_NAME,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ async function fetchSpanLinksDetails({
.filter((hit) => {
// The above query might return other spans from the same transaction because siblings spans share the same transaction.id
// so, if it is a span we need to guarantee that the span.id is the same as the span links ids
if (hit.fields['processor.event']?.[0] === ProcessorEvent.span) {
if (hit.fields[PROCESSOR_EVENT]?.[0] === ProcessorEvent.span) {
const spanLink = unflattenKnownApmEventFields(hit.fields, [
...requiredFields,
...requiredSpanFields,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ async function getTraceDocsPerPage({
const sort = hit.sort;
const spanLinksSource = 'span' in hit._source ? hit._source.span?.links : undefined;

if (hit.fields['processor.event']?.[0] === ProcessorEvent.span) {
if (hit.fields[PROCESSOR_EVENT]?.[0] === ProcessorEvent.span) {
const spanEvent = unflattenKnownApmEventFields(hit.fields, [
...requiredFields,
...requiredSpanFields,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export async function getTraceSamplesByQuery({
filter_path: 'hits.sequences.events._source.trace.id',
})
).hits?.sequences?.flatMap((sequence) =>
sequence.events.map((event) => (event.fields as { 'trace.id': [string] })['trace.id'][0])
sequence.events.map((event) => (event.fields as { [TRACE_ID]: [string] })[TRACE_ID][0])
) ?? [];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ const rootTransactionByTraceIdRoute = createApmServerRoute({
handler: async (
resources
): Promise<{
transaction: TransactionDetailRedirectInfo | undefined;
transaction?: TransactionDetailRedirectInfo;
}> => {
const {
params: {
Expand All @@ -158,7 +158,7 @@ const transactionByIdRoute = createApmServerRoute({
handler: async (
resources
): Promise<{
transaction: Transaction | undefined;
transaction?: Transaction;
}> => {
const {
params: {
Expand Down Expand Up @@ -194,7 +194,7 @@ const transactionByNameRoute = createApmServerRoute({
handler: async (
resources
): Promise<{
transaction: TransactionDetailRedirectInfo | undefined;
transaction?: TransactionDetailRedirectInfo;
}> => {
const {
params: {
Expand Down

0 comments on commit ae4633c

Please sign in to comment.