Skip to content

Commit

Permalink
Update version number (#146)
Browse files Browse the repository at this point in the history
* Update version number

* Update lockfiles

* Test fixes

* Formatting
  • Loading branch information
arendjr authored Dec 5, 2023
1 parent 17a2d15 commit 30d790a
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 35 deletions.
10 changes: 6 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,13 @@ you want to publish you will need to create a separate release.

### Creating a release

1. Ensure that the version number in respective `package.json` is up to date
2. Make sure that all tests have successfully passed in the latest commit on
1. Ensure that the version number in the root `package.json` is up to date
2. Run `just build-all` to make sure lock files in the examples are updated
correctly.
3. Make sure that all tests have successfully passed in the latest commit on
`main` (the CI will run one more time before publishing it to NPM)
3. Create a release on GitHub along with a respective tag for each package:
4. Create a release on GitHub along with a respective tag for each package:
- `lib/` (main autometrics library) → tag: `lib-*` (e.g.: `lib-v0.7`)
- `typescript-plugin/` → tag: `typescript-plugin-*`
- `parcel-transformer-autometrics/` → tag: `parcel-transformer-*`
4. When the release is published, the relevant GitHub workflow will kick off.
5. When the release is published, the relevant GitHub workflow will kick off.
6 changes: 3 additions & 3 deletions examples/fastify/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ __metadata:
version: 6
cacheKey: 8

"@autometrics/autometrics@0.8.0-dev, @autometrics/autometrics@workspace:../../dist/autometrics":
"@autometrics/autometrics@1.0.0, @autometrics/autometrics@workspace:../../dist/autometrics":
version: 0.0.0-use.local
resolution: "@autometrics/autometrics@workspace:../../dist/autometrics"
dependencies:
Expand All @@ -28,7 +28,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@autometrics/exporter-prometheus@portal:../../dist/exporter-prometheus::locator=fastify-example%40workspace%3A."
dependencies:
"@autometrics/autometrics": 0.8.0-dev
"@autometrics/autometrics": 1.0.0
"@opentelemetry/api": 1.7.0
"@opentelemetry/exporter-prometheus": 0.45.0
"@opentelemetry/sdk-metrics": 1.18.0
Expand All @@ -39,7 +39,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@autometrics/exporter-prometheus@workspace:../../dist/exporter-prometheus"
dependencies:
"@autometrics/autometrics": 0.8.0-dev
"@autometrics/autometrics": 1.0.0
"@opentelemetry/api": 1.7.0
"@opentelemetry/exporter-prometheus": 0.45.0
"@opentelemetry/sdk-metrics": 1.18.0
Expand Down
6 changes: 3 additions & 3 deletions examples/react-app-experimental/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ __metadata:
languageName: node
linkType: hard

"@autometrics/autometrics@0.8.0-dev, @autometrics/autometrics@workspace:../../dist/autometrics":
"@autometrics/autometrics@1.0.0, @autometrics/autometrics@workspace:../../dist/autometrics":
version: 0.0.0-use.local
resolution: "@autometrics/autometrics@workspace:../../dist/autometrics"
dependencies:
Expand All @@ -38,7 +38,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@autometrics/exporter-otlp-http@portal:../../dist/exporter-otlp-http::locator=react-app-example%40workspace%3A."
dependencies:
"@autometrics/autometrics": 0.8.0-dev
"@autometrics/autometrics": 1.0.0
"@opentelemetry/api": 1.7.0
"@opentelemetry/exporter-metrics-otlp-http": 0.45.0
"@opentelemetry/sdk-metrics": 1.18.0
Expand All @@ -49,7 +49,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@autometrics/exporter-prometheus@workspace:../../dist/exporter-prometheus"
dependencies:
"@autometrics/autometrics": 0.8.0-dev
"@autometrics/autometrics": 1.0.0
"@opentelemetry/api": 1.7.0
"@opentelemetry/exporter-prometheus": 0.45.0
"@opentelemetry/sdk-metrics": 1.18.0
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"private": true,
"name": "autometrics-monorepo",
"packageManager": "[email protected]",
"version": "0.8.0-dev",
"version": "1.0.0",
"workspaces": [
"dist/autometrics",
"dist/exporter-otlp-http",
Expand Down
48 changes: 26 additions & 22 deletions packages/autometrics/src/exporter-prometheus/PrometheusExporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export interface ExporterConfig {

export class PrometheusExporter extends MetricReader {
private readonly _abortController: AbortController;
private readonly _server: Deno.HttpServer;

// This will be required when histogram is implemented. Leaving here so it is not forgotten
// Histogram cannot have a attribute named 'le'
Expand All @@ -68,29 +69,32 @@ export class PrometheusExporter extends MetricReader {
this._abortController = new AbortController();
const { signal } = this._abortController;

Deno.serve({ hostname, port, signal, onError }, async (request) => {
if (new URL(request.url).pathname !== "/metrics") {
return new Response("not found", { status: 404 });
}

try {
const { resourceMetrics, errors } = await this.collect();
if (errors.length) {
amLogger.trace(
"PrometheusExporter: metrics collection errors",
...errors,
);
this._server = Deno.serve(
{ hostname, port, signal, onError },
async (request) => {
if (new URL(request.url).pathname !== "/metrics") {
return new Response("not found", { status: 404 });
}

return new Response(serializer.serialize(resourceMetrics), {
headers: HEADERS,
});
} catch (error) {
return new Response(`# failed to export metrics: ${error}`, {
headers: HEADERS,
});
}
});
try {
const { resourceMetrics, errors } = await this.collect();
if (errors.length) {
amLogger.trace(
"PrometheusExporter: metrics collection errors",
...errors,
);
}

return new Response(serializer.serialize(resourceMetrics), {
headers: HEADERS,
});
} catch (error) {
return new Response(`# failed to export metrics: ${error}`, {
headers: HEADERS,
});
}
},
);

amLogger.debug(
`Prometheus exporter server started: ${hostname}:${port}/metrics`,
Expand All @@ -113,6 +117,6 @@ export class PrometheusExporter extends MetricReader {
*/
stopServer(): Promise<void> {
this._abortController.abort();
return Promise.resolve();
return this._server.finished;
}
}
4 changes: 3 additions & 1 deletion packages/autometrics/tests/otlpHttpExporter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Deno.test("OTLP/HTTP exporter", async (t) => {
// retrying, which may mess with other tests.
const serverController = new AbortController();
const { signal } = serverController;
Deno.serve({ port, signal }, () => new Response("ok"));
const server = Deno.serve({ port, signal }, () => new Response("ok"));

// make sure that metrics that are collected before `init()` is called are
// correctly tracked.
Expand Down Expand Up @@ -53,4 +53,6 @@ Deno.test("OTLP/HTTP exporter", async (t) => {
);

serverController.abort();

await server.finished;
});
4 changes: 3 additions & 1 deletion packages/autometrics/tests/testUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export function testWithTemporality({
// retrying, which may mess with other tests.
const serverController = new AbortController();
const { signal } = serverController;
Deno.serve({ port, signal }, () => new Response("ok"));
const server = Deno.serve({ port, signal }, () => new Response("ok"));

const timeout = 10;

Expand Down Expand Up @@ -96,5 +96,7 @@ export function testWithTemporality({
await metricReader.shutdown();

serverController.abort();

await server.finished;
};
}

0 comments on commit 30d790a

Please sign in to comment.