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

ci: enumerate caching paths manually #514

Merged
Merged
Show file tree
Hide file tree
Changes from 3 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
97 changes: 90 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,66 @@ postgres_service: &postgres_service
POSTGRES_USER: postgres
POSTGRES_DB: circle_database

cache_1: &cache_1
key: npm-cache-01-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/checksums.txt" }}-1
paths:
- ./node_modules
- ./yarn.lock
- packages/opentelemetry-base/node_modules
- packages/opentelemetry-scope-base/node_modules
- packages/opentelemetry-types/node_modules
- packages/opentelemetry-scope-async-hooks/node_modules
- packages/opentelemetry-core/node_modules
- packages/opentelemetry-exporter-prometheus/node_modules
- packages/opentelemetry-metrics/node_modules
- packages/opentelemetry-tracing/node_modules
- packages/opentelemetry-exporter-jaeger/node_modules
- packages/opentelemetry-exporter-zipkin/node_modules
- packages/opentelemetry-node/node_modules
- packages/opentelemetry-shim-opentracing/node_modules
- packages/opentelemetry-web/node_modules
- packages/opentelemetry-plugin-dns/node_modules

cache_2: &cache_2
key: npm-cache-02-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/checksums.txt" }}-1
paths:
- packages/opentelemetry-plugin-grpc/node_modules
dyladan marked this conversation as resolved.
Show resolved Hide resolved
- packages/opentelemetry-plugin-http/node_modules
- packages/opentelemetry-plugin-http2/node_modules
- packages/opentelemetry-plugin-mongodb/node_modules
- packages/opentelemetry-plugin-redis/node_modules
- packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/node_modules
- packages/opentelemetry-plugin-document-load/node_modules
- packages/opentelemetry-plugin-https/node_modules
- packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/node_modules
- packages/opentelemetry-base/yarn.lock
- packages/opentelemetry-scope-base/yarn.lock
- packages/opentelemetry-types/yarn.lock
- packages/opentelemetry-scope-async-hooks/yarn.lock
- packages/opentelemetry-core/yarn.lock
- packages/opentelemetry-exporter-prometheus/yarn.lock

cache_3: &cache_3
key: npm-cache-03-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/checksums.txt" }}-1
paths:
- packages/opentelemetry-metrics/yarn.lock
- packages/opentelemetry-tracing/yarn.lock
- packages/opentelemetry-exporter-jaeger/yarn.lock
- packages/opentelemetry-exporter-zipkin/yarn.lock
- packages/opentelemetry-node/yarn.lock
- packages/opentelemetry-shim-opentracing/yarn.lock
- packages/opentelemetry-web/yarn.lock
- packages/opentelemetry-plugin-dns/yarn.lock
- packages/opentelemetry-plugin-grpc/yarn.lock
- packages/opentelemetry-plugin-http/yarn.lock
- packages/opentelemetry-plugin-http2/yarn.lock
- packages/opentelemetry-plugin-mongodb/yarn.lock
- packages/opentelemetry-plugin-redis/yarn.lock
- packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/yarn.lock
- packages/opentelemetry-plugin-document-load/yarn.lock
- packages/opentelemetry-plugin-https/yarn.lock
- packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/yarn.lock

node_unit_tests: &node_unit_tests
steps:
- checkout
Expand All @@ -31,17 +91,22 @@ node_unit_tests: &node_unit_tests
echo "CIRCLE_NODE_VERSION=${CIRCLE_NODE_VERSION}"
- restore_cache:
keys:
- npm-cache-{{ checksum "/tmp/checksums.txt" }}
- npm-cache-01-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/checksums.txt" }}-1
- restore_cache:
keys:
- npm-cache-02-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/checksums.txt" }}-1
- restore_cache:
keys:
- npm-cache-03-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/checksums.txt" }}-1
- run:
name: Install Dependencies
command: yarn install
- save_cache:
key: npm-cache-{{ checksum "/tmp/checksums.txt" }}
paths:
- ./node_modules
- ./yarn.lock
- ./packages/*/node_modules
- ./packages/*/yarn.lock
<<: *cache_1
- save_cache:
<<: *cache_2
- save_cache:
<<: *cache_3
- run:
name: Compile code
command: yarn compile
Expand All @@ -55,6 +120,9 @@ node_unit_tests: &node_unit_tests
browsers_unit_tests: &browsers_unit_tests
steps:
- checkout
- run:
name: Create Checksum
command: sh .circleci/checksum.sh /tmp/checksums.txt
- run:
name: Setup environment variables
command: |
Expand All @@ -65,9 +133,24 @@ browsers_unit_tests: &browsers_unit_tests
command: |
node --version
echo "CIRCLE_NODE_VERSION=${CIRCLE_NODE_VERSION}"
- restore_cache:
keys:
- npm-cache-01-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/checksums.txt" }}-1
- restore_cache:
keys:
- npm-cache-02-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/checksums.txt" }}-1
- restore_cache:
keys:
- npm-cache-03-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/checksums.txt" }}-1
dyladan marked this conversation as resolved.
Show resolved Hide resolved
- run:
name: Install Dependencies
command: yarn install
- save_cache:
<<: *cache_1
- save_cache:
<<: *cache_2
- save_cache:
<<: *cache_3
- run:
name: Compile code
command: yarn compile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ export class DocumentLoad extends BasePlugin<unknown> {
});
} else {
// // fallback to previous version
const perf: (typeof otperformance) & PerformanceLegacy = otperformance;
const perf: typeof otperformance & PerformanceLegacy = otperformance;
const performanceTiming = perf.timing;
if (performanceTiming) {
const keys = Object.values(PTN);
Expand Down
9 changes: 6 additions & 3 deletions packages/opentelemetry-plugin-grpc/src/grpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,12 @@ export class GrpcPlugin extends BasePlugin<grpc> {
parent: currentSpan || undefined,
})
.setAttribute(AttributeNames.COMPONENT, GrpcPlugin.component);
return plugin._makeGrpcClientRemoteCall(original, args, this, plugin)(
span
);
return plugin._makeGrpcClientRemoteCall(
original,
args,
this,
plugin
)(span);
};
};
}
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-plugin-http/src/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ export class HttpPlugin extends BasePlugin<Http> {
span: Span,
execute: T,
rethrow: K
): K extends true ? ReturnType<T> : (ReturnType<T> | void);
): K extends true ? ReturnType<T> : ReturnType<T> | void;
private _safeExecute<T extends (...args: unknown[]) => ReturnType<T>>(
span: Span,
execute: T,
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-plugin-http/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export type RequestSignature = [http.RequestOptions, HttpCallbackOptional] &
export type HttpRequestArgs = Array<HttpCallbackOptional | RequestSignature>;

export type ParsedRequestOptions =
| http.RequestOptions & Partial<url.UrlWithParsedQuery>
| (http.RequestOptions & Partial<url.UrlWithParsedQuery>)
| http.RequestOptions;
export type Http = typeof http;
/* tslint:disable-next-line:no-any */
Expand Down
4 changes: 3 additions & 1 deletion packages/opentelemetry-plugin-http/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ export const getAbsoluteUrl = (
// it should be displayed if it's not 80 and 443 (default ports)
if (
(host as string).indexOf(':') === -1 &&
(port && port !== '80' && port !== '443')
port &&
port !== '80' &&
port !== '443'
) {
host += `:${port}`;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,10 @@ export class PostgresPlugin extends BasePlugin<typeof pgTypes> {
const parentSpan = plugin._tracer.getCurrentSpan();
if (typeof args[args.length - 1] === 'function') {
// Patch ParameterQuery callback
args[args.length - 1] = utils.patchCallback(span, args[
args.length - 1
] as PostgresCallback);
args[args.length - 1] = utils.patchCallback(
span,
args[args.length - 1] as PostgresCallback
);
// If a parent span exists, bind the callback
if (parentSpan) {
args[args.length - 1] = plugin._tracer.bind(
Expand Down