Unverified Commit cadf24f2 authored by Yt's avatar Yt Committed by GitHub
Browse files

openobserve: 0.15.3 -> 0.40.0 (#477867)

parents 0b9c114d 87a40120
Loading
Loading
Loading
Loading
+124 −97
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  rustPlatform,
  fetchFromGitHub,
  fetchurl,
  pkg-config,
  protobuf,
  bzip2,
@@ -14,21 +16,16 @@
  gitUpdater,
}:

rustPlatform.buildRustPackage (
  finalAttrs:
  let
  version = "0.15.3";
  src = fetchFromGitHub {
    owner = "openobserve";
    repo = "openobserve";
    tag = "v${version}";
    hash = "sha256-GHyfIVUSX7evP3LaHZClD1RjZ6somYcMNBFdkaZL7lg=";
  };
    web = buildNpmPackage {
    inherit src version;
      inherit (finalAttrs) src version;
      pname = "openobserve-ui";

    sourceRoot = "${src.name}/web";
      sourceRoot = "${finalAttrs.src.name}/web";

    npmDepsHash = "sha256-5bXEC48m3FbtmLwVYYvEdMV3qWA7KNEKVxkMZ94qEpA=";
      npmDepsHash = "sha256-ED3plf8Miw5+cbCOo+R1rbRxBju/MZvR0U9JA+NLr2k=";

      preBuild = ''
        # Patch vite config to not open the browser to visualize plugin composition
@@ -50,9 +47,16 @@ let
      '';
    };
  in
rustPlatform.buildRustPackage {
  {
    pname = "openobserve";
  inherit version src;
    version = "0.40.0";

    src = fetchFromGitHub {
      owner = "openobserve";
      repo = "openobserve";
      tag = "v${finalAttrs.version}";
      hash = "sha256-eiF9t3l6RcbO6d79iSuA7ikH2atizyNjWABQ9KAkkfE=";
    };

    patches = [
      # prevent using git to determine version info during build time
@@ -63,7 +67,7 @@ rustPlatform.buildRustPackage {
      cp -r ${web}/share/openobserve-ui web/dist
    '';

  cargoHash = "sha256-j/bx4qoWcSh2/yJ9evnzSfyUd0tLAk4M310A89k4wy8=";
    cargoHash = "sha256-RNrI5DB5FTSLxeT7a62KkEnqyDYV4dQ3G65PPofa9Zs=";

    nativeBuildInputs = [
      pkg-config
@@ -86,12 +90,33 @@ rustPlatform.buildRustPackage {
      RUSTC_BOOTSTRAP = 1; # uses experimental features

      # the patched build.rs file sets these variables
    GIT_VERSION = src.tag;
      GIT_VERSION = finalAttrs.src.tag;
      GIT_COMMIT_HASH = "builtByNix";
      GIT_BUILD_DATE = "1970-01-01T00:00:00Z";

      RUSTFLAGS = "-C target-feature=+aes,+sse2";

      SWAGGER_UI_DOWNLOAD_URL =
        # When updating:
        # - Look for the version of `utoipa-swagger-ui` at:
        #   https://github.com/StractOrg/stract/blob/<STRACT-REV>/Cargo.toml#L183
        # - Look at the corresponding version of `swagger-ui` at:
        #   https://github.com/juhaku/utoipa/blob/utoipa-swagger-ui-<UTOPIA-SWAGGER-UI-VERSION>/utoipa-swagger-ui/build.rs#L21-L22
        let
          swaggerUiVersion = "5.17.14";
          swaggerUi = fetchurl {
            url = "https://github.com/swagger-api/swagger-ui/archive/refs/tags/v${swaggerUiVersion}.zip";
            hash = "sha256-SBJE0IEgl7Efuu73n3HZQrFxYX+cn5UU5jrL4T5xzNw=";
          };
        in
        "file://${swaggerUi}";
    };

    # swagger-ui will once more be copied in the target directory during the check phase
    # Not deleting the existing unpacked archive leads to a `PermissionDenied` error
    preCheck = ''
      rm -rf target/${stdenv.hostPlatform.rust.cargoShortTarget}/release/build/
    '';

    # requires network access or filesystem mutations
    checkFlags = [
@@ -99,6 +124,7 @@ rustPlatform.buildRustPackage {
      "--skip=tests::e2e_test"
      "--skip=tests::test_setup_logs"
      "--skip=handler::http::router::middlewares::compress::Compress"
      "--skip=service::github"
      # Tests are not threadsafe. Most likely can only run one test at a time,
      # due to altering shared database state.
      # This option already in upstream code: https://github.com/openobserve/openobserve/pull/7084
@@ -114,9 +140,10 @@ rustPlatform.buildRustPackage {
    meta = {
      description = "Cloud-native observability platform built specifically for logs, metrics, traces, analytics & realtime user-monitoring";
      homepage = "https://github.com/openobserve/openobserve";
    changelog = "https://github.com/openobserve/openobserve/releases/tag/v${version}";
      changelog = "https://github.com/openobserve/openobserve/releases/tag/v${finalAttrs.version}";
      license = lib.licenses.asl20;
      maintainers = with lib.maintainers; [ happysalada ];
      mainProgram = "openobserve";
    };
  }
)