Skip to content

Commit

Permalink
Backwards compatibility fix for teraslice (#846)
Browse files Browse the repository at this point in the history
This PR makes the following changes:

- Introduces backwards compatibility for teraslice versions before
`v1.4.0`
- This fixes an issue where using a teraslice version older than version
`v1.4.0` would throw `TypeError: this.promMetrics.addGauge is not a
function`
- Bump **standard-assets** to `v0.25.1`
- Updates the following dependencies:
  - **@terascope/job-components** from `v0.74.2` to `v0.75.0`

ref: terascope/teraslice#3625

---------

Co-authored-by: busma13 <pluitjens@terascope.io>
  • Loading branch information
sotojn and busma13 authored May 24, 2024
1 parent bd23c8c commit 92f02b4
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion asset/asset.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "standard",
"version": "0.25.0",
"version": "0.25.1",
"description": "Teraslice standard processor asset bundle"
}
4 changes: 2 additions & 2 deletions asset/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "standard",
"displayName": "Asset",
"version": "0.25.0",
"version": "0.25.1",
"private": true,
"description": "Teraslice standard processor asset bundle",
"repository": {
Expand All @@ -21,7 +21,7 @@
},
"dependencies": {
"@faker-js/faker": "^8.4.1",
"@terascope/job-components": "^0.74.2",
"@terascope/job-components": "^0.75.0",
"@terascope/standard-asset-apis": "^0.7.2",
"@terascope/utils": "^0.59.1",
"@types/chance": "^1.1.4",
Expand Down
4 changes: 2 additions & 2 deletions asset/src/count_by_field/processor.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {
MapProcessor, DataEntity
MapProcessor, DataEntity, isPromAvailable
} from '@terascope/job-components';
import { CountByFieldConfig } from './interfaces';

Expand All @@ -13,7 +13,7 @@ export default class CountByField extends MapProcessor<CountByFieldConfig> {
static counters: Counters = {};
async initialize(): Promise<void> {
const { opConfig, context } = this;
if (opConfig.collect_metrics) {
if (opConfig.collect_metrics && isPromAvailable(context)) {
const defaultLabels = context.apis.foundation.promMetrics.getDefaultLabels();
const name = `${this.opConfig._op}_count_total`;
const help = `${this.opConfig._op} value field count`;
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "standard-assets-bundle",
"displayName": "Standard Assets Bundle",
"version": "0.25.0",
"version": "0.25.1",
"private": true,
"description": "Teraslice standard processor asset bundle",
"workspaces": [
Expand All @@ -26,7 +26,7 @@
},
"devDependencies": {
"@terascope/eslint-config": "^0.8.0",
"@terascope/job-components": "^0.74.2",
"@terascope/job-components": "^0.75.0",
"@terascope/scripts": "0.77.2",
"@terascope/standard-asset-apis": "^0.7.2",
"@types/express": "^4.17.19",
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -845,12 +845,12 @@
progress "^2.0.3"
yargs "^17.2.1"

"@terascope/job-components@^0.74.2":
version "0.74.2"
resolved "https://registry.yarnpkg.com/@terascope/job-components/-/job-components-0.74.2.tgz#de875f792644abf3324f74d98e6b7daa046d7fff"
integrity sha512-FEliIWkcK43Q+kiONkwutXgV/f9qQMGUjesmJq9IyqYswOd7ZHtlXCjBUziKqdUWZ01OZ3YDzFxeuufJoLflUg==
"@terascope/job-components@^0.75.0":
version "0.75.0"
resolved "https://registry.yarnpkg.com/@terascope/job-components/-/job-components-0.75.0.tgz#03739729d7d7aee722b6291418987084cf65aaa9"
integrity sha512-QbIAKfbjX5Wj8A/hZvjE0E8y9hvW9QecQIw6eMwTRneudx2OPQcissCCYNlxBpfP13dK/U85BIqOVFZRTh8KcA==
dependencies:
"@terascope/utils" "^0.59.1"
"@terascope/utils" "^0.59.2"
convict "^6.2.4"
convict-format-with-moment "^6.2.0"
convict-format-with-validator "^6.2.0"
Expand Down

0 comments on commit 92f02b4

Please sign in to comment.