Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Proto v0.5.0 #1588

Merged
merged 15 commits into from
Oct 19, 2020
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ version: "3"
services:
# Collector
collector:
# image: otel/opentelemetry-collector:0.12.0
image: otel/opentelemetry-collector:latest
# image: otel/opentelemetry-collector:0.6.0
command: ["--config=/conf/collector-config.yaml", "--log-level=DEBUG"]
volumes:
- ./collector-config.yaml:/conf/collector-config.yaml
Expand Down
3 changes: 2 additions & 1 deletion examples/collector-exporter-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
"@opentelemetry/exporter-collector-grpc": "^0.11.0",
"@opentelemetry/exporter-collector-proto": "^0.11.0",
"@opentelemetry/metrics": "^0.11.0",
"@opentelemetry/tracing": "^0.11.0"
"@opentelemetry/tracing": "^0.11.0",
"grpc": "^1.24.2"
obecny marked this conversation as resolved.
Show resolved Hide resolved
},
"homepage": "https:/open-telemetry/opentelemetry-js#readme"
}
5 changes: 5 additions & 0 deletions packages/opentelemetry-api/src/metrics/Metric.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ export interface MetricOptions {
* User provided logger.
*/
logger?: Logger;

/**
* Boundaries optional for histogram
*/
boundaries?: number[];
}

export interface BatchMetricOptions extends MetricOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,10 @@ import { CollectorMetricExporter } from '../src';
import {
mockCounter,
mockObserver,
mockHistogram,
ensureExportedCounterIsCorrect,
ensureExportedObserverIsCorrect,
ensureMetadataIsCorrect,
ensureResourceIsCorrect,
ensureExportedHistogramIsCorrect,
ensureExportedValueRecorderIsCorrect,
mockValueRecorder,
} from './helper';
Expand Down Expand Up @@ -117,7 +115,7 @@ const testCollectorMetricExporter = (params: TestParams) =>
server.forceShutdown();
});

beforeEach(done => {
beforeEach(async () => {
const credentials = params.useTLS
? grpc.credentials.createSsl(
fs.readFileSync('./test/certs/ca.crt'),
Expand All @@ -136,10 +134,9 @@ const testCollectorMetricExporter = (params: TestParams) =>
value: 1592602232694000000,
});
metrics = [];
metrics.push(mockCounter());
metrics.push(mockObserver());
metrics.push(mockHistogram());
metrics.push(mockValueRecorder());
metrics.push(await mockCounter());
metrics.push(await mockObserver());
metrics.push(await mockValueRecorder());

metrics[0].aggregator.update(1);

Expand All @@ -148,8 +145,6 @@ const testCollectorMetricExporter = (params: TestParams) =>

metrics[2].aggregator.update(7);
metrics[2].aggregator.update(14);
metrics[3].aggregator.update(5);
done();
});

afterEach(() => {
Expand Down Expand Up @@ -189,15 +184,21 @@ const testCollectorMetricExporter = (params: TestParams) =>
const counter =
exportedData[0].instrumentationLibraryMetrics[0].metrics[0];
const observer =
exportedData[1].instrumentationLibraryMetrics[0].metrics[0];
const histogram =
exportedData[2].instrumentationLibraryMetrics[0].metrics[0];
exportedData[0].instrumentationLibraryMetrics[0].metrics[1];
const recorder =
exportedData[3].instrumentationLibraryMetrics[0].metrics[0];
ensureExportedCounterIsCorrect(counter);
ensureExportedObserverIsCorrect(observer);
ensureExportedHistogramIsCorrect(histogram);
ensureExportedValueRecorderIsCorrect(recorder);
exportedData[0].instrumentationLibraryMetrics[0].metrics[2];
ensureExportedCounterIsCorrect(
counter,
counter.intSum?.dataPoints[0].timeUnixNano
);
ensureExportedObserverIsCorrect(
observer,
observer.doubleGauge?.dataPoints[0].timeUnixNano
);
ensureExportedValueRecorderIsCorrect(
recorder,
recorder.intHistogram?.dataPoints[0].timeUnixNano
);
assert.ok(
typeof resource !== 'undefined',
"resource doesn't exist"
Expand Down
Loading