{"id":18811776,"url":"https://github.com/logicmonitor/hipster","last_synced_at":"2025-04-13T20:31:44.146Z","repository":{"id":42465556,"uuid":"434563997","full_name":"logicmonitor/hipster","owner":"logicmonitor","description":null,"archived":false,"fork":false,"pushed_at":"2022-09-05T16:13:49.000Z","size":4774,"stargazers_count":3,"open_issues_count":0,"forks_count":3,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-03-26T22:47:27.072Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/logicmonitor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-12-03T11:00:12.000Z","updated_at":"2022-09-22T19:18:06.000Z","dependencies_parsed_at":"2022-09-14T00:10:49.674Z","dependency_job_id":null,"html_url":"https://github.com/logicmonitor/hipster","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logicmonitor%2Fhipster","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logicmonitor%2Fhipster/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logicmonitor%2Fhipster/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logicmonitor%2Fhipster/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/logicmonitor","download_url":"https://codeload.github.com/logicmonitor/hipster/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223604594,"owners_count":17172334,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T23:27:39.209Z","updated_at":"2024-11-07T23:27:39.856Z","avatar_url":"https://github.com/logicmonitor.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HipsterShop\nHipster Shop is a cloud-native microservices demo application .Google uses this application to demonstrate use of technologies like Kubernetes/GKE, Istio, Stackdriver, gRPC and OpenCensus.\nThis application works on any Kubernetes cluster, as well as Google Kubernetes Engine. It’s easy to deploy with little to no configuration.\n\n## Architecture\n\n**Online Boutique** is composed of 11 microservices written in different\nlanguages that talk to each other over gRPC.\n\n[![Architecture of\nmicroservices](./architecture-diagram.png)](./architecture-diagram.png)\n\nThe following table represents functionality of each microservice.\n\n\n| Service                                              | Language      | Description                                                                                                                       |\n| ---------------------------------------------------- | ------------- | --------------------------------------------------------------------------------------------------------------------------------- |\n| [frontend](./frontend)                           | Go            | Exposes an HTTP server to serve the website. Does not require signup/login and generates session IDs for all users automatically. |\n| [cartservice](./cartservice)                     | C#            | Stores the items in the user's shopping cart in Redis and retrieves it.                                                           |\n| [productcatalogservice](./productcatalogservice) | Go            | Provides the list of products from a JSON file and ability to search products and get individual products.                        |\n| [currencyservice](./currencyservice)             | Node.js       | Converts one money amount to another currency. Uses real values fetched from European Central Bank. It's the highest QPS service. |\n| [paymentservice](./paymentservice)               | Node.js       | Charges the given credit card info (mock) with the given amount and returns a transaction ID.                                     |\n| [shippingservice](./shippingservice)             | Go            | Gives shipping cost estimates based on the shopping cart. Ships items to the given address (mock)                                 |\n| [emailservice](./emailservice)                   | Python        | Sends users an order confirmation email (mock).                                                                                   |\n| [checkoutservice](./checkoutservice)             | Go            | Retrieves user cart, prepares order and orchestrates the payment, shipping and the email notification.                            |\n| [recommendationservice](./recommendationservice) | Python        | Recommends other products based on what's given in the cart.                                                                      |\n| [adservice](./adservice)                         | Java          | Provides text ads based on given context words.                                                                                   |\n| [loadgenerator](./loadgenerator)                 | Python/Locust | Continuously sends requests imitating realistic user shopping flows to the frontend.                                              |\n\n\n## Development Guide \n\nThis doc explains how to build and run the Hipstershop source code locally.  \n  \n\n### Screenshot\n\n [![Screenshot of store homepage](./Dag.png)](./Dag.png)\n\n## You can setup the application in two ways :-\n    1. Docker\n    2. Local Machine.\n\n\n## Steps to run on Docker\n\n1. Clone the project.\n2. If collector is not already setup, setup lmotel collector using following command:\n\n    ```sh\n     \n    docker run -d -e LOGICMONITOR_ACCOUNT=your_account_name -e LOGICMONITOR_BEARER_TOKEN=your_bearer_token -e LOGICMONITOR_OTEL_NAME=\"collector_name\" -p 55680:55680 -p 55681:55681 -p 4317:4317 -p 4318:4318 logicmonitor/lmotel:latest\n     \n      ```\n3. Open the terminal and go to hipster folder. Execute following command.\n  \n     ```sh\n    export OTLP_FORMAT=\"OTLP_FORMAT\" // values can be HTTP or GRPC\n    export SERVICE_NAMESPACE=\"SERVICE_NAMESPACE\"\n    export OTLP_ENDPOINT=\"YOUR_ENDPOINT\" //need to append /v1/traces for OTLP HTTP format\n    export OTEL_EXPORTER_OTLP_HEADERS=\"Authorization=Bearer YOUR_BEARER_TOKEN\" //Required for otlp http format if sending traces directly to LM platform\n    export OTEL_RESOURCE_ATTRIBUTES=\"KEYVALUEPAIR\"  // values to be comma seperated eg:\"key1=value1,key2=value2\"\n    docker-compose up -d\n     \n      ```\n\n    For AdService exporter endpoint need to be set manually in docker-compose.yml file.\n    Opentelemetry java agent appends /v1/traces for OTLP HTTP format.\n    OTLP_PROTOCOL values can be set either grpc of http/protobuf \n\n4.  Access the web frontend through your browser \n  \n  - Once run above all steps you can access frontend service at  http://localhost:8081\n  \nOnce all four steps are completed successfully,you can view the traces on Logicmonitor Traces page.\n\n# When to use OTLP/HTTP or OTLP/gRPC\n\n - **OTLP/gRPC**\n    -  OTLP/gRPC is preferred when sending data via collector.\n    -  This protocol is concerned with reliability of delivery between one pair of client/server nodes and aims to ensure that no data is lost in-transit between the client and the server. Many telemetry collection systems have intermediary nodes that the data must travel across until reaching the final destination (e.g. application -\u003e agent -\u003e collector -\u003e backend)\n    - eg: http://localhost:4317\n - **OTLP/HTTP**\n    -  OTLP/HTTP is preferred while sending data directly to platform using url without sending it to collector.\n    -  OTLP/HTTP uses Protobuf payloads encoded either in binary format or in JSON format.\n    -  OTLP/HTTP uses HTTP POST requests to send telemetry data from clients to servers.\n    -  eg: https://qauattraces01.logicmonitor.com/rest/api/v1/traces\n\nFor more information, visit [OpenTelemetry Protocol Specification.](https://opentelemetry.io/docs/reference/specification/protocol/otlp/)\n\n## Steps to run on Local Machine\n\n\n### Prerequisites \n- [Docker for Desktop](https://www.docker.com/products/docker-desktop).\n- JDK 11\n- Installation of Go\n- Installation of Python\n- Installation of Node\n- Installation of Dotnet core.\n- Visual Studio\n\n\n1. Currency Service (Node.js)\n\n    ```sh\n    cd currencyservice\n    npm i \n    node -r ./tracing server.js \n    \n    ```\n2. Cart Service (C#)\n      \n    ```sh\n    Open and Run the cart service in Visual Studio.\n    OR\n    cd cartservice\n    dotnet run\n    \n    ```\n  \n3. Payment Service (Node.js)\n  \n    ```sh\n    cd paymentservice\n    node -r ./tracing index.js  \n    \n    ```\n    \n4. Recommendation Service (Python)\n  \n    ```sh\n    cd recommendationservice\n    pip3 install -r requirements.txt\n    export PORT=8082\n    export EXPORT_TYPE=\"OTLP\"\n    export SERVICE_NAME=LM-RECOMMENDATIONSERVICE\n    export OTLP_ENDPOINT=http://localhost:55681/v1/traces\n    export SERVICE_NAMESPACE=HIPSTER\n    export PRODUCT_CATALOG_SERVICE_ADDR=localhost:4000\n    opentelemetry-instrument python3 recommendation_server.py\n    \n    ```\n    \n5. Shipping Service (Go)\n  \n    ```sh\n    cd shippingservice\n    go run . .\n    \n    ```\n    \n6. ProductCatlog Service (Go)\n  \n    ```sh\n    cd productcatalogservice\n    go run . .\n    \n    ```\n    \n7. Checkout Service (Go)\n  \n    ```sh\n    cd checkoutservice\n    go run . .\n    \n    ```\n8. Email Service (Python)\n\n    ```sh\n    cd emailservice\n    pip3 install -r requirements.txt\n    export PORT=4009\n    export EXPORT_TYPE=\"OTLP\"\n    export SERVICE_NAME=LM-EMAILSERVICE\n    export OTLP_ENDPOINT=http://localhost:55681/v1/traces\n    export SERVICE_NAMESPACE=HIPSTER\n    opentelemetry-instrument python3 email_server.py\n    \n    ```\n    \n9. Ad Service (Java)\n\n\n        cd adservice\n        gradle build\n        java -javaagent:opentelemetry-javaagent-all.jar \\\n        -Dotel.exporter=otlp \\\n        -Dotel.resource.attributes=$OTEL_RESOURCE_ATTRIBUTES ,service.name=$SERVICE_NAME,host.name=$HOST_NAME \\\n        -Dotel.exporter.$EXPORTER.endpoint=http://localhost:4317 \\\n        -Dotel.exporter.otlp.insecure=true \\\n        -Dotel.exporter.otlp.protocol=$OTLP_PROTOCOL \\\n        -jar hipstershop-0.1.0-SNAPSHOT-fat.jar\n     \n     \n \u003e Note : Download opentelemetry-javaagent-all.jar : https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v1.7.0/opentelemetry-javaagent-all.jar and copy the jar file in folder adservice/tracinglib    \n\n 10.  Access the web frontend through your browser \n  \n  - Once run above all steps you can access frontend service at  http://localhost:8081\n  - Once all four steps are completed successfully,you can view the traces on Logicmonitor Traces page.\n\nAlso, the following env variables are needed to be set explicitly for every service while running locally:\n  - SERVICE_NAME\n  - SERVICE_NAMESPACE\n  - OTLP_ENDPOINT\n  - OTLP_FORMAT\n  - EXPORT_TYPE\n  - OTEL_RESOURCE_ATTRIBUTES\n  - OTEL_EXPORTER_OTLP_HEADERS\n\n    \n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flogicmonitor%2Fhipster","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flogicmonitor%2Fhipster","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flogicmonitor%2Fhipster/lists"}