Skip to content

Commit

Permalink
bump cache version
Browse files Browse the repository at this point in the history
  • Loading branch information
maorleger committed Jun 11, 2021
1 parent 552232a commit ff81d06
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
1 change: 1 addition & 0 deletions sdk/core/core-tracing/rollup.base.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import nodeResolve from "@rollup/plugin-node-resolve";
import multiEntry from "@rollup/plugin-multi-entry";
import cjs from "@rollup/plugin-commonjs";
import json from "@rollup/plugin-json";
import replace from "@rollup/plugin-replace";
import { terser } from "rollup-plugin-terser";
import sourcemaps from "rollup-plugin-sourcemaps";
Expand Down
7 changes: 4 additions & 3 deletions sdk/core/core-tracing/src/utils/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ import { getGlobalObject } from "./global";
// V2 = OpenTelemetry 0.2
// V3 = OpenTelemetry 0.6.1
// V4 = OpenTelemetry 1.0.0-rc.0
const GLOBAL_TRACER_VERSION = 4;
// V5 onwards will match OpenTelemetry version
export const GLOBAL_TRACER_VERSION = "0.20.0";
// preview5 shipped with @azure/core-tracing.tracerCache
// and didn't have smart detection for collisions
const GLOBAL_TRACER_SYMBOL = Symbol.for("@azure/core-tracing.tracerCache3");
const GLOBAL_TRACER_SYMBOL = Symbol.for(`@azure/core-tracing.tracerCache${GLOBAL_TRACER_VERSION}`);

export interface TracerCache {
version: number;
version: number | string;
tracer?: Tracer;
}

Expand Down
18 changes: 18 additions & 0 deletions sdk/core/core-tracing/test/cache.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import assert from "assert";
import { GLOBAL_TRACER_VERSION } from "../src/utils/cache";
import * as fs from "fs";
import * as path from "path";

describe("cache", () => {
const packageJson = JSON.parse(
fs.readFileSync(path.join(__dirname, "../package.json"), { encoding: "utf8" })
);

it("ensure version matches @opentelemetry/api version", () => {
assert.equal(
GLOBAL_TRACER_VERSION,
packageJson["dependencies"]["@opentelemetry/api"],
"GLOBAL_TRACER_VERSION constant should match the version set in package.json"
);
});
});

0 comments on commit ff81d06

Please sign in to comment.