Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
f6e2f5f
chore: updating submodule for otlp-grpc-exporter-base
pichlermarc Apr 25, 2022
a8f045d
chore: updating submodule for otlp-proto-exporter-base
pichlermarc Apr 25, 2022
606870a
feat(otlp-metrics-exporter): update to proto 0.14.
pichlermarc Apr 27, 2022
ca54530
feat(otlp-trace-exporter): update to proto 0.14.
pichlermarc Apr 26, 2022
c801f42
fix(changelog): update changelog.
pichlermarc Apr 27, 2022
258e503
feat(exporter-trace-otlp-http): use hex representation for traceId an…
pichlermarc Apr 27, 2022
aed89cb
feat(otlp-transformer): update tests for base64 trace and span id rep…
pichlermarc Apr 27, 2022
78720de
feat(protos): update protos to 0.16
pichlermarc Apr 27, 2022
48b14af
fix(exporter): cleanup dependencies.
pichlermarc Apr 27, 2022
90eaaab
fix(exporters): cleanup.
pichlermarc Apr 27, 2022
f04dcb5
fix(otlp-transformer): rename IInstrumentationLibrarySpans to IScopeS…
pichlermarc Apr 29, 2022
dbc1a35
feat(otlp-exporter-example): update example to use new exporter version.
pichlermarc Apr 29, 2022
69110d7
Merge branch 'main' into use-updated-proto
pichlermarc Apr 29, 2022
7052b25
docs(exporters): update readme files.
pichlermarc Apr 29, 2022
d32f440
fix(otlp-metric-exporter): map over metrics directly.
pichlermarc Apr 29, 2022
e591ad3
fix(exporter-trace-otlp-proto): rename constant instrumentationLibrar…
pichlermarc Apr 29, 2022
87be662
fix(otlp-exporter): use assert.ok() instead of assert.strictEqual() i…
pichlermarc Apr 29, 2022
4eae398
feat(otlp-transformer): add support for instrumentationLibarary next …
pichlermarc May 2, 2022
4507c52
fix(otlp-transformer): change publish config from 'restricted' to 'pu…
pichlermarc May 2, 2022
993e1a3
Merge remote-tracking branch 'upstream/main' into use-updated-proto
pichlermarc May 2, 2022
6c77da9
docs(readme): add upgrade guidelines entries.
pichlermarc May 2, 2022
f0c4fc5
fix(otlp-transformer): cleanup.
pichlermarc May 2, 2022
3cd3a0e
docs(otlp-exporters): add compatible version range for opentelemetry-…
pichlermarc May 2, 2022
d7f400e
docs(exporter-metrics-otlp-http): remove double newline.
pichlermarc May 2, 2022
fbcf9c3
feat(otlp-transformer): revert to only publishing scopeMetrics.
pichlermarc May 3, 2022
00e7015
docs(otlp-exporter-node-example): fix links.
pichlermarc May 3, 2022
c33fbe1
fix(otlp-exporters): cleanup test assertions.
pichlermarc May 3, 2022
02c4c55
fix(otlp-exporters): cleanup tests.
pichlermarc May 3, 2022
35d9762
fix(exporter-trace-otlp-http): remove 'if' for undefined checks.
pichlermarc May 4, 2022
47aa7e4
fix(otlp-exporters): remove 'if' for undefined checks from tests.
pichlermarc May 4, 2022
2dcb4c1
fix(otlp-exporters): remove more 'if's for undefined checks from tests.
pichlermarc May 4, 2022
052eabb
Merge branch 'main' into use-updated-proto
pichlermarc May 4, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(otlp-transformer): revert to only publishing scopeMetrics.
  • Loading branch information
pichlermarc committed May 3, 2022
commit fbcf9c3596ce821b7a90799c16c860e305677433
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class OTLPTraceExporter
);
}
convert(spans: ReadableSpan[]): IExportTraceServiceRequest {
return createExportTraceServiceRequest(spans, true, true);
return createExportTraceServiceRequest(spans, true);
}

getDefaultUrl(config: OTLPExporterConfigBase): string {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class OTLPTraceExporter
}

convert(spans: ReadableSpan[]): IExportTraceServiceRequest {
return createExportTraceServiceRequest(spans, true, true);
return createExportTraceServiceRequest(spans, true);
}

getDefaultUrl(config: OTLPExporterNodeConfigBase): string {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ class OTLPExporterBrowserProxy extends OTLPExporterBrowserBase<ResourceMetrics,
convert(metrics: ResourceMetrics[]): IExportMetricsServiceRequest {
return createExportMetricsServiceRequest(
metrics,
this._aggregationTemporality,
true
this._aggregationTemporality
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ class OTLPExporterNodeProxy extends OTLPExporterNodeBase<ResourceMetrics,
convert(metrics: ResourceMetrics[]): IExportMetricsServiceRequest {
return createExportMetricsServiceRequest(
metrics,
this._aggregationTemporality,
true
this._aggregationTemporality
);
}

Expand Down
5 changes: 2 additions & 3 deletions experimental/packages/otlp-transformer/src/metrics/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ import { AggregationTemporality } from '@opentelemetry/sdk-metrics-base';
import { toResourceMetrics } from './internal';

export function createExportMetricsServiceRequest(resourceMetrics: ResourceMetrics[],
aggregationTemporality: AggregationTemporality,
json?: boolean): IExportMetricsServiceRequest {
aggregationTemporality: AggregationTemporality): IExportMetricsServiceRequest {
return {
resourceMetrics: resourceMetrics.map(metrics => toResourceMetrics(metrics, aggregationTemporality, json))
resourceMetrics: resourceMetrics.map(metrics => toResourceMetrics(metrics, aggregationTemporality))
};
}
29 changes: 3 additions & 26 deletions experimental/packages/otlp-transformer/src/metrics/internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,31 +28,23 @@ import {
import { toAttributes } from '../common/internal';
import {
EAggregationTemporality,
IHistogramDataPoint, IInstrumentationLibraryMetrics,
IHistogramDataPoint,
IMetric,
INumberDataPoint,
IResourceMetrics,
IScopeMetrics
} from './types';

export function toResourceMetrics(resourceMetrics: ResourceMetrics,
aggregationTemporality: AggregationTemporality,
json?: boolean): IResourceMetrics {
const transformedMetrics: IResourceMetrics = {
aggregationTemporality: AggregationTemporality): IResourceMetrics {
return {
resource: {
attributes: toAttributes(resourceMetrics.resource.attributes),
droppedAttributesCount: 0
},
schemaUrl: undefined, // TODO: Schema Url does not exist yet in the SDK.
scopeMetrics: toScopeMetrics(resourceMetrics.instrumentationLibraryMetrics, aggregationTemporality)
};

if (json) {
transformedMetrics.instrumentationLibraryMetrics =
toInstrumentationLibraryMetrics(resourceMetrics.instrumentationLibraryMetrics, aggregationTemporality);
}

return transformedMetrics;
}

export function toScopeMetrics(instrumentationLibraryMetrics: InstrumentationLibraryMetrics[],
Expand All @@ -70,21 +62,6 @@ export function toScopeMetrics(instrumentationLibraryMetrics: InstrumentationLib
}));
}

export function toInstrumentationLibraryMetrics(instrumentationLibraryMetrics: InstrumentationLibraryMetrics[],
aggregationTemporality: AggregationTemporality): IInstrumentationLibraryMetrics[]{
return Array.from(instrumentationLibraryMetrics.map(metrics => {
const resultMetrics : IInstrumentationLibraryMetrics = {
instrumentationLibrary: {
name: metrics.instrumentationLibrary.name,
version: metrics.instrumentationLibrary.version,
},
metrics: metrics.metrics.map(metricData => toMetric(metricData, aggregationTemporality)),
schemaUrl: metrics.instrumentationLibrary.schemaUrl
};
return resultMetrics;
}));
}

export function toMetric(metricData: MetricData, metricTemporality: AggregationTemporality): IMetric {
const out: IMetric = {
name: metricData.descriptor.name,
Expand Down
25 changes: 3 additions & 22 deletions experimental/packages/otlp-transformer/src/metrics/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
import { IInstrumentationScope, IKeyValue } from '../common/types';
import { IResource } from '../resource/types';
import { InstrumentationLibrary } from '@opentelemetry/core';

/** Properties of an ExportMetricsServiceRequest. */
export interface IExportMetricsServiceRequest {
Expand All @@ -24,25 +23,22 @@ export interface IExportMetricsServiceRequest {
resourceMetrics: IResourceMetrics[]
}


/** Properties of a ResourceMetrics. */
export interface IResourceMetrics {

/** ResourceMetrics resource */
resource?: IResource;

/** ResourceMetrics scopeMetrics */
scopeMetrics: IScopeMetrics[]

/** ResourceMetrics instrumentationLibraryMetrics */
instrumentationLibraryMetrics?: IInstrumentationLibraryMetrics[]

/** ResourceMetrics schemaUrl */
schemaUrl?: string;
}


/** Properties of an IScopeMetrics. */
export interface IScopeMetrics {

/** ScopeMetrics scope */
scope?: IInstrumentationScope;

Expand All @@ -53,20 +49,6 @@ export interface IScopeMetrics {
schemaUrl?: string;
}

/** Properties of an IInstrumentationLibraryMetrics. */
export interface IInstrumentationLibraryMetrics {
/**
* InstrumentationLibraryMetrics instrumentationLibrary
*/
instrumentationLibrary?: InstrumentationLibrary

/** InstrumentationLibraryMetrics metrics */
metrics: IMetric[];

/** InstrumentationLibraryMetrics schemaUrl */
schemaUrl?: string;
}

/** Properties of a Metric. */
export interface IMetric {

Expand Down Expand Up @@ -299,8 +281,7 @@ export interface IExemplar {
* AggregationTemporality defines how a metric aggregator reports aggregated
* values. It describes how those values relate to the time interval over
* which they are aggregated.
*/
export const enum EAggregationTemporality {
*/export const enum EAggregationTemporality {
/* UNSPECIFIED is the default AggregationTemporality, it MUST not be used. */
AGGREGATION_TEMPORALITY_UNSPECIFIED = 0,

Expand Down
21 changes: 4 additions & 17 deletions experimental/packages/otlp-transformer/src/trace/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ import type { Resource } from '@opentelemetry/resources';
import type { ReadableSpan } from '@opentelemetry/sdk-trace-base';
import { toAttributes } from '../common/internal';
import { sdkSpanToOtlpSpan } from './internal';
import { IExportTraceServiceRequest, IInstrumentationLibrarySpans, IResourceSpans, IScopeSpans } from './types';
import { IExportTraceServiceRequest, IResourceSpans, IScopeSpans } from './types';

export function createExportTraceServiceRequest(spans: ReadableSpan[], useHex?: boolean, json?: boolean): IExportTraceServiceRequest {
export function createExportTraceServiceRequest(spans: ReadableSpan[], useHex?: boolean): IExportTraceServiceRequest {
return {
resourceSpans: spanRecordsToResourceSpans(spans, useHex, json)
resourceSpans: spanRecordsToResourceSpans(spans, useHex)
};
}

Expand Down Expand Up @@ -50,7 +50,7 @@ function createResourceMap(readableSpans: ReadableSpan[]) {
return resourceMap;
}

function spanRecordsToResourceSpans(readableSpans: ReadableSpan[], useHex?: boolean, json?: boolean): IResourceSpans[] {
function spanRecordsToResourceSpans(readableSpans: ReadableSpan[], useHex?: boolean): IResourceSpans[] {
const resourceMap = createResourceMap(readableSpans);
const out: IResourceSpans[] = [];

Expand All @@ -59,7 +59,6 @@ function spanRecordsToResourceSpans(readableSpans: ReadableSpan[], useHex?: bool
while (!entry.done) {
const [resource, ilmMap] = entry.value;
const scopeResourceSpans: IScopeSpans[] = [];
const instrumentationLibraryResourceSpans: IInstrumentationLibrarySpans[] = [];
const ilmIterator = ilmMap.values();
let ilmEntry = ilmIterator.next();
while (!ilmEntry.done) {
Expand All @@ -73,14 +72,6 @@ function spanRecordsToResourceSpans(readableSpans: ReadableSpan[], useHex?: bool
spans: spans,
schemaUrl: schemaUrl
});

if (json) {
instrumentationLibraryResourceSpans.push({
instrumentationLibrary: { name, version },
spans: spans,
schemaUrl: schemaUrl
});
}
}
ilmEntry = ilmIterator.next();
}
Expand All @@ -94,10 +85,6 @@ function spanRecordsToResourceSpans(readableSpans: ReadableSpan[], useHex?: bool
schemaUrl: undefined
};

if (json) {
transformedSpans.instrumentationLibrarySpans = instrumentationLibraryResourceSpans;
}

out.push(transformedSpans);
entry = entryIterator.next();
}
Expand Down
16 changes: 0 additions & 16 deletions experimental/packages/otlp-transformer/src/trace/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ export interface IResourceSpans {
/** ResourceSpans scopeSpans */
scopeSpans: IScopeSpans[];

/** ResourceSpans instrumentationLibrarySpans */
instrumentationLibrarySpans?: IScopeSpans[];

/** ResourceSpans schemaUrl */
schemaUrl?: string;
}
Expand All @@ -53,19 +50,6 @@ export interface IScopeSpans {
schemaUrl?: (string | null);
}

/** Properties of an InstrumentationLibrarySpans. */
export interface IInstrumentationLibrarySpans {

/** InstrumentationLibrarySpans scope */
instrumentationLibrary?: IInstrumentationScope;

/** InstrumentationLibrarySpans spans */
spans?: ISpan[]

/** InstrumentationLibrarySpans schemaUrl */
schemaUrl?: (string | null);
}

/** Properties of a Span. */
export interface ISpan {
/** Span traceId */
Expand Down