Skip to content

Commit

Permalink
Merge branch 'main' into bug/visualization_vertical_bar
Browse files Browse the repository at this point in the history
  • Loading branch information
Koustubh5585 committed Oct 21, 2022
2 parents fe096e2 + e486d06 commit 766aa20
Show file tree
Hide file tree
Showing 14 changed files with 49 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ on: [pull_request, push]
env:
PLUGIN_NAME: dashboards-observability
OPENSEARCH_VERSION: 'main'
OPENSEARCH_PLUGIN_VERSION: 2.2.0.0
OPENSEARCH_PLUGIN_VERSION: 3.0.0.0

jobs:

build:

runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}

steps:
- name: Checkout Plugin
Expand Down Expand Up @@ -57,13 +59,13 @@ jobs:
yarn test --coverage
- name: Upload coverage
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: codecov/codecov-action@v1
with:
flags: dashboards-observability
directory: ./OpenSearch-Dashboards/plugins/dashboards-observability
token: ${{ secrets.CODECOV_TOKEN }}

# TODO remove hard coded version when observability is ready
- name: Build Artifact
run: |
cd OpenSearch-Dashboards/plugins/dashboards-observability
Expand All @@ -73,6 +75,5 @@ jobs:
- name: Upload Artifact
uses: actions/upload-artifact@v1
with:
name: dashboards-observability
path: ./OpenSearch-Dashboards/plugins/dashboards-observability/build

name: dashboards-observability-${{ matrix.os }}
path: ./OpenSearch-Dashboards/plugins/dashboards-observability/build
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,18 @@ on: [pull_request, push]

jobs:
build:
env:
BUILD_ARGS: ${{ matrix.os_build_args }}
strategy:
matrix:
java:
- 11
- 17

runs-on: ubuntu-latest
java: [11, 17]
os: [ubuntu-latest, windows-latest, macos-latest]
include:
- os: windows-latest
os_build_args: -x integTest -x jacocoTestReport
- os: macos-latest
os_build_args: -x integTest -x jacocoTestReport
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v1
Expand All @@ -21,6 +26,8 @@ jobs:
java-version: ${{ matrix.java }}

- name: Run Backwards Compatibility Tests
# Temporarily only do this for linux
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
cd opensearch-observability
echo "Running backwards compatibility tests ..."
Expand All @@ -29,9 +36,10 @@ jobs:
- name: Build with Gradle
run: |
cd opensearch-observability
./gradlew build
./gradlew build ${{ env.BUILD_ARGS }}
- name: Upload coverage
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: codecov/codecov-action@v1
with:
flags: opensearch-observability
Expand All @@ -46,5 +54,5 @@ jobs:
- name: Upload Artifacts
uses: actions/upload-artifact@v1
with:
name: opensearch-observability
path: opensearch-observability-builds
name: opensearch-observability-${{ matrix.os }}
path: opensearch-observability-builds
1 change: 1 addition & 0 deletions dashboards-observability/common/constants/explorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,3 +273,4 @@ export const SPAN = 'span';
export const AGGREGATION_INFO = 'At least one metric is required to render a chart';
export const DIMENSION_INFO = 'The timestamp type field can be selected as a first dimension only';
export const TIME_FIELD = 'time_field';
export const DISABLED_COLOUR = "#fafbfd";
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { isFunction, isEqual } from 'lodash';
import { AbstractParseTreeVisitor } from 'antlr4ts/tree/AbstractParseTreeVisitor';
import {
RootContext,
Expand Down Expand Up @@ -49,13 +50,16 @@ export class StatsAstBuilder

visitRoot(ctx: RootContext) {
if (!ctx.pplStatement()) return this.defaultResult();
return this.visitChildren(ctx.pplStatement()!);
return this.visitPplStatement(ctx.pplStatement()!);
}

visitPplStatement(ctx: PplStatementContext): PPLNode {
let statsTree: VisitResult = this.defaultResult();
ctx.commands().map((pplCommandContext) => {
if (this.visitChildren(pplCommandContext).getName() === 'stats_command')
if (
isFunction(this.visitChildren(pplCommandContext).getName) &&
isEqual(this.visitChildren(pplCommandContext).getName(), 'stats_command')
)
statsTree = this.visitChildren(pplCommandContext);
});
return statsTree;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ import {
StatsAggregationFunctionChunk,
GroupByChunk,
GroupField,
statsChunk,
StatsChunk,
SpanExpressionChunk,
} from '../types';
import { CUSTOM_LABEL } from '../../../../common/constants/explorer';

export class StatsBuilder implements QueryBuilder<Aggregations> {
constructor(private statsChunk: statsChunk) {}
constructor(private statsChunk: StatsChunk) {}

build(): Aggregations {
// return a new stats subtree
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export {
StatsAggregationFunctionChunk,
GroupByChunk,
GroupField,
statsChunk,
StatsChunk,
SpanExpressionChunk,
AggregationConfigurations,
PreviouslyParsedStaleStats
Expand Down
4 changes: 2 additions & 2 deletions dashboards-observability/opensearch_dashboards.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "observabilityDashboards",
"version": "2.2.0.0",
"opensearchDashboardsVersion": "2.2.0",
"version": "3.0.0.0",
"opensearchDashboardsVersion": "3.0.0",
"server": true,
"ui": true,
"requiredPlugins": [
Expand Down
2 changes: 1 addition & 1 deletion dashboards-observability/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "observability-dashboards",
"version": "2.2.0.0",
"version": "3.0.0.0",
"main": "index.ts",
"license": "Apache-2.0",
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ export const NoResults = () => {
<p>
<FormattedMessage
id="discover.noResults.queryMayNotMatchTitle"
defaultMessage="Your query may not match anything in the current time range, or there may not be any data at all in
the currently selected time range. Try change time range, query filters or choose different time fields"
defaultMessage="Your query may not match anything in the current time range, or there may not be any data at all in the currently selected time range. Try change time range, query filters or choose different time fields"
/>
</p>
</EuiText>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
AVAILABLE_FIELDS,
GROUPBY,
SELECTED_FIELDS,
DISABLED_COLOUR
} from '../../../../../../../../common/constants/explorer';
import {
ConfigList,
Expand Down Expand Up @@ -177,7 +178,7 @@ export const LogsViewConfigPanelItem = ({
<EuiText size="xs">
<EuiIcon
type="cross"
color="danger"
color={queriedFields.length === 0 ? "danger" : DISABLED_COLOUR}
onClick={() => handleServiceRemove(index, GROUPBY)}
/>
</EuiText>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ export const Line = ({ visualizations, layout, config }: any) => {
titlefont: {
color: selectedColor,
},
automargin: true,
tickfont: {
color: selectedColor,
...(labelSize && {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ export const HeatMap = ({ visualizations, layout, config }: any) => {
},
];

layout.yaxis = { autosize: true, automargin: true };
const mergedLayout = {
...layout,
...(layoutConfig.layout && layoutConfig.layout),
Expand Down
10 changes: 5 additions & 5 deletions opensearch-observability/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import org.opensearch.gradle.testclusters.StandaloneRestIntegTestTask
buildscript {
ext {
isSnapshot = "true" == System.getProperty("build.snapshot", "true")
opensearch_version = System.getProperty("opensearch.version", "2.2.0-SNAPSHOT")
opensearch_version = System.getProperty("opensearch.version", "3.0.0-SNAPSHOT")
buildVersionQualifier = System.getProperty("build.version_qualifier", "")
version_tokens = opensearch_version.tokenize('-')
opensearch_build = version_tokens[0] + '.0'
Expand Down Expand Up @@ -308,16 +308,16 @@ testClusters.integTest {
setting 'path.repo', repo.absolutePath
}

String bwcVersion = "1.2.0-SNAPSHOT"
String bwcVersion = "2.4.0-SNAPSHOT"
String baseName = "obsBwcCluster"
String bwcFilePath = "src/test/resources/bwc/"
String remoteFileURL = "https://github.com/opensearch-project/observability/releases/download/1.2.0.0/opensearch-observability-1.2.0.0.zip"
String remoteFileURL = "https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/2.4.0/latest/linux/x64/tar/builds/opensearch/plugins/opensearch-observability-2.4.0.0.zip"

2.times {i ->
testClusters {
"${baseName}$i" {
testDistribution = "ARCHIVE"
versions = ["1.2.0",opensearch_version]
versions = ["2.4.0",opensearch_version]
numberOfNodes = 3
plugin(provider(new Callable<RegularFile>(){
@Override
Expand All @@ -329,7 +329,7 @@ String remoteFileURL = "https://github.com/opensearch-project/observability/rele
if (!dir.exists()) {
dir.mkdirs()
}
File file = new File(dir, "opensearch-observability-1.2.0.0-SNAPSHOT.zip")
File file = new File(dir, "opensearch-observability-2.4.0.0-SNAPSHOT.zip")
if (!file.exists()) {
new URL(remoteFileURL).withInputStream{ ins -> file.withOutputStream{ it << ins }}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
package org.opensearch.observability

import com.google.gson.JsonObject
import org.apache.http.HttpHost
import org.apache.hc.core5.http.HttpHost
import org.junit.After
import org.junit.AfterClass
import org.junit.Before
Expand Down Expand Up @@ -60,7 +60,7 @@ abstract class PluginRestTestCase : OpenSearchRestTestCase() {
open fun wipeAllOpenSearchIndices() {
if (preserveOpenSearchIndicesAfterTest()) return
val response = client().performRequest(Request("GET", "/_cat/indices?format=json&expand_wildcards=all"))
val xContentType = XContentType.fromMediaType(response.entity.contentType.value)
val xContentType = XContentType.fromMediaType(response.entity.contentType)
xContentType.xContent().createParser(
NamedXContentRegistry.EMPTY, DeprecationHandler.THROW_UNSUPPORTED_OPERATION,
response.entity.content
Expand Down

0 comments on commit 766aa20

Please sign in to comment.