diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..918de83 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +_site +.sass-cache +.jekyll-cache +.jekyll-metadata +vendor +Gemfile.lock diff --git a/404.html b/404.html new file mode 100644 index 0000000..3a16ab5 --- /dev/null +++ b/404.html @@ -0,0 +1,25 @@ +--- +permalink: /404.html +layout: page +--- + + + +
+

404

+ +

Page not found :(

+

The requested page could not be found.

+
diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..c20eb13 --- /dev/null +++ b/Gemfile @@ -0,0 +1,34 @@ +source "https://rubygems.org" +# Hello! This is where you manage which Jekyll version is used to run. +# When you want to use a different version, change it below, save the +# file and run `bundle install`. Run Jekyll with `bundle exec`, like so: +# +# bundle exec jekyll serve +# +# This will help ensure the proper Jekyll version is running. +# Happy Jekylling! +#gem "jekyll", "~> 4.4.1" +# This is the default theme for new Jekyll sites. You may change this to anything you like. +gem "minima", "~> 2.5" +# If you want to use GitHub Pages, remove the "gem "jekyll"" above and +# uncomment the line below. To upgrade, run `bundle update github-pages`. +# gem "github-pages", group: :jekyll_plugins +gem "github-pages", "~> 232", group: :jekyll_plugins +# If you have any plugins, put them here! +group :jekyll_plugins do + gem "jekyll-feed", "~> 0.12" +end + +# Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem +# and associated library. +platforms :mingw, :x64_mingw, :mswin, :jruby do + gem "tzinfo", ">= 1", "< 3" + gem "tzinfo-data" +end + +# Performance-booster for watching directories on Windows +gem "wdm", "~> 0.1", :platforms => [:mingw, :x64_mingw, :mswin] + +# Lock `http_parser.rb` gem to `v0.6.x` on JRuby builds since newer versions of the gem +# do not have a Java counterpart. +gem "http_parser.rb", "~> 0.6.0", :platforms => [:jruby] diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 261eeb9..0000000 --- a/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/README.md b/README.md deleted file mode 100644 index 67172e2..0000000 --- a/README.md +++ /dev/null @@ -1 +0,0 @@ -Monocle Doc page diff --git a/_config.yml b/_config.yml new file mode 100644 index 0000000..fb257d2 --- /dev/null +++ b/_config.yml @@ -0,0 +1,58 @@ +# Welcome to Jekyll! +# +# This config file is meant for settings that affect your whole blog, values +# which you are expected to set up once and rarely edit after that. If you find +# yourself editing this file very often, consider using Jekyll's data files +# feature for the data you need to update frequently. +# +# For technical reasons, this file is *NOT* reloaded automatically when you use +# 'bundle exec jekyll serve'. If you change this file, please restart the server process. +# +# If you need help with YAML syntax, here are some quick references for you: +# https://learn-the-web.algonquindesign.ca/topics/markdown-yaml-cheat-sheet/#yaml +# https://learnxinyminutes.com/docs/yaml/ +# +# Site settings +# These are used to personalize your new site. If you look in the HTML files, +# you will see them accessed via {{ site.title }}, {{ site.email }}, and so on. +# You can create any custom variable you would like, and they will be accessible +# in the templates via {{ site.myvariable }}. + +title: Project Monocle +logo: /assets/img/Monocle-Logo-Color.png +description: >- # this means to ignore newlines until "baseurl:" + Monocle helps developers and platform engineers building or managing GenAI apps monitor these in prod by + making it easy to instrument their code to capture traces that are compliant with the open-source cloud-native + observability ecosystem. +show_downloads: false +#baseurl: "" # the subpath of your site, e.g. /blog +url: "https://monocle2ai.org" # the base hostname & protocol for your site, e.g. http://example.com +#twitter_username: jekyllrb +#github_username: jekyll + +# Build settings +#theme: minimal +remote_theme: pages-themes/minimal@v0.2.0 +plugins: +- jekyll-remote-theme # add this line to the plugins list if you already have one +# - jekyll-feed + +# Exclude from processing. +# The following items will not be processed, by default. +# Any item listed under the `exclude:` key here will be automatically added to +# the internal "default list". +# +# Excluded items can be processed by explicitly listing the directories or +# their entries' file path in the `include:` list. +# +# exclude: +# - .sass-cache/ +# - .jekyll-cache/ +# - gemfiles/ +# - Gemfile +# - Gemfile.lock +# - node_modules/ +# - vendor/bundle/ +# - vendor/cache/ +# - vendor/gems/ +# - vendor/ruby/ diff --git a/_layouts/default.html b/_layouts/default.html new file mode 100644 index 0000000..eb88ef8 --- /dev/null +++ b/_layouts/default.html @@ -0,0 +1,43 @@ + + + + + + + +{% seo %} + + + {% include head-custom.html %} + + +
+
+

{{ site.title | default: site.github.repository_name }}

+ + {% if site.logo %} + Logo + {% endif %} + +

{{ site.description | default: site.github.project_tagline }}

+ {% if site.github.is_project_page %} +

View on Github

+ {% endif %} + +
+
+ + {{ content }} + +
+ +
+ + + \ No newline at end of file diff --git a/assets/.DS_Store b/assets/.DS_Store new file mode 100644 index 0000000..26319bd Binary files /dev/null and b/assets/.DS_Store differ diff --git a/assets/img/Monocle-Logo-Color.png b/assets/img/Monocle-Logo-Color.png new file mode 100644 index 0000000..312b35c Binary files /dev/null and b/assets/img/Monocle-Logo-Color.png differ diff --git a/assets/img/cncf.png b/assets/img/cncf.png new file mode 100644 index 0000000..b2ed6dc Binary files /dev/null and b/assets/img/cncf.png differ diff --git a/assets/img/lfaidata-horizontal-color.png b/assets/img/lfaidata-horizontal-color.png new file mode 100644 index 0000000..6eebeef Binary files /dev/null and b/assets/img/lfaidata-horizontal-color.png differ diff --git a/assets/img/lfaidata-stacked-color.png b/assets/img/lfaidata-stacked-color.png new file mode 100644 index 0000000..2e8cb47 Binary files /dev/null and b/assets/img/lfaidata-stacked-color.png differ diff --git a/assets/img/monocle_chatbot_aws.png b/assets/img/monocle_chatbot_aws.png new file mode 100644 index 0000000..c519c25 Binary files /dev/null and b/assets/img/monocle_chatbot_aws.png differ diff --git a/demos.md b/demos.md new file mode 100644 index 0000000..bae7f44 --- /dev/null +++ b/demos.md @@ -0,0 +1,5 @@ +--- +layout: default +--- + +# Okahu demo \ No newline at end of file diff --git a/documentation/Monocle_User_Guide.md b/documentation/Monocle_User_Guide.md new file mode 100644 index 0000000..4f67598 --- /dev/null +++ b/documentation/Monocle_User_Guide.md @@ -0,0 +1,193 @@ +# Monocle User Guide + +## Monocle Concepts +### Traces +Traces are the full view of a single end-to-end application KPI, for example Chatbot application to provide a response to end user’s question. Traces consist of various metadata about the application run including status, start time, duration, input/outputs etc. They also include a list of individual steps aka “spans with details about that step. +It’s typically the workflow code components of an application that generate the traces for application runs. +### Spans +Spans are the individual steps executed by the application to perform a GenAI related task”, for example app retrieving vectors from DB, app querying LLM for inference etc. The span includes the type of operation, start time, duration and metadata relevant to that step e.g., Model name, parameters and model endpoint/server for an inference request. +It’s typically the workflow code components of an application that generate the traces for application runs. + +## Setup Monocle +- You can download Monocle library releases from Pypi +``` + > pip install monocle_apptrace +``` + +- For Azure support (to upload traces to Azure), install with the azure extra: +``` + > pip install monocle_apptrace[azure] +``` + +- For AWS support (to upload traces to AWS), install with the aws extra: +``` + > pip install monocle_apptrace[aws] +``` + +- You can locally build and install Monocle library from source +``` + > pip install . +``` +- Install the optional test dependencies listed against dev in pyproject.toml in editable mode +``` + > pip install -e ".[dev]" +``` + + +## Using Monocle with your application to generate traces +### Enable Monocle tracing +You need to import monocle package and invoke the API ``setup_monocle_telemetry(workflow=)`` to enable the tracing. The 'workflow-name' is what you define to identify the give application workflow, for example "customer-chatbot". Monocle trace will include this name in every trace. The trace output will include a list of spans in the traces. You can print the output on the console or send it to an HTTP endpoint. + +### Using Monocle's out of box support of genAI technology components +Monocle community has done the hard work of figuring out what to trace and how to extract relevant details from multiple genAI technology components. For example, if you have a python app coded using LlamaIndex and using models hostsed in OpenAI, Monocle can seamlessly trace your app. All you need to do enable Monocle tracing. + +### Using Monocle's Support for Adding Custom Attributes +Monocle provides users with the ability to add custom attributes to various spans, such as inference and retrieval spans, by utilizing the output processor within its metamodel. This feature allows for dynamic attribute assignment through lambda functions, which operate on an arguments dictionary. +The arguments dictionary contains key-value pairs that can be used to compute custom attributes. The dictionary includes the following components: +```python +arguments = {"instance":instance, "args":args, "kwargs":kwargs, "output":return_value} +``` +By leveraging this dictionary, users can define custom attributes for spans, enabling the integration of additional context and information into the tracing process. The lambda functions used in the attributes field can access and process these values to enrich the span with relevant custom data. + +#### Example - Enable Monocle tracing in your application +```python +from monocle_apptrace.instrumentor import setup_monocle_telemetry +from opentelemetry.sdk.trace.export import BatchSpanProcessor, ConsoleSpanExporter +from langchain.chains import LLMChain +from langchain_openai import OpenAI +from langchain.prompts import PromptTemplate + +# Call the setup Monocle telemetry method +setup_monocle_telemetry(workflow_name = "simple_math_app") + +llm = OpenAI() +prompt = PromptTemplate.from_template("1 + {number} = ") + +chain = LLMChain(llm=llm, prompt=prompt) +chain.invoke({"number":2}) + +# Request callbacks: Finally, let's use the request `callbacks` to achieve the same result +chain = LLMChain(llm=llm, prompt=prompt) +chain.invoke({"number":2}, {"callbacks":[handler]}) + +``` + +### Accessing monocle trace +By default monocle generate traces in a json file created in the local directory where the application is running. The file name by default is monocle_trace_{workflow_name}\_{trace_id}\_{timestamp}.json where the trace_id is a unique number generated by monocle for every trace. Please refere to [Trace span json](Monocle_User_Guide.md#trace-span-json). The file path and format can be changed by setting those properties as argement to ```setup_monocle_telemetry()```. For example, +``` +setup_monocle_telemetry(workflow_name = "simple_math_app", + span_processors=[BatchSpanProcessor(FileSpanExporter( + out_path = "/tmp", + file_prefix = "map_app_prod_trace_", + time_format = "%Y-%m-%d")) + ]) +``` +To print the trace on the console, use ```ConsoleSpanExporter()``` instead of ```FileSpanExporter()``` + +For Azure: + Install the Azure support as shown in the setup section, then use ```AzureBlobSpanExporter()``` to upload the traces to Azure. + +For AWS: + Install the AWS support as shown in the setup section, then use ```S3SpanExporter()``` to upload the traces to an S3 bucket. + +### Leveraging Monocle's extensibility to handle customization +When the out of box features from app frameworks are not sufficent, the app developers have to add custom code. For example, if you are extending a LLM class in LlamaIndex to use a model hosted in NVIDIA Triton. This new class is not know to Monocle. You can specify this new class method part of Monocle enabling API and it will be able to trace it. + +#### Default configuration of instrumented methods in Monocle +The following files comprise of default configuration of instrumented methods and span names corresponding to them, for each framework respectively. +- [src/monocle_apptrace/langchain/__init__.py](src/monocle_apptrace/langchain/__init__.py), +- [src/monocle_apptrace/llamaindex/__init__.py](src/monocle_apptrace/llamaindex/__init__.py), +- [src/monocle_apptrace/haystack/__init__.py](src/monocle_apptrace/haystack/__init__.py) + +Following configuration instruments ```invoke(..)``` of ```RunnableSequence```, aka chain or worflow in Langchain parlance, to emit the span. +``` + { + "package": "langchain.schema.runnable", + "object": "RunnableSequence", + "method": "invoke", + "span_name": "langchain.workflow", + "wrapper": task_wrapper + } +``` +#### Example - Monitoring custom methods with Monocle +```python +from monocle_apptrace.wrapper import WrapperMethod,task_wrapper,atask_wrapper +from opentelemetry.sdk.trace.export import BatchSpanProcessor, ConsoleSpanExporter + +# extend the default wrapped methods list as follows +app_name = "simple_math_app" +setup_monocle_telemetry( + workflow_name=app_name, + span_processors=[BatchSpanProcessor(ConsoleSpanExporter())], + wrapper_methods=[ + WrapperMethod( + package="langchain.schema.runnable", + object_name="RunnableParallel", + method="invoke", + span_name="langchain.workflow", + wrapper=task_wrapper), + WrapperMethod( + package="langchain.schema.runnable", + object_name="RunnableParallel", + method="ainvoke", + span_name="langchain.workflow", + wrapper=atask_wrapper) + ]) + +``` + +### Going beyond supported genAI components +- If you are using an application framework, model hosting service/infra etc. that's not currently supported by Monocle, please submit a github issue to add that support. +- Monocle community is working on adding an SDK to enable applications to generate their own traces. + +## Understanding the trace output + +### Trace span json + +Monocle generates spans which adhere to [Tracing API | OpenTelemetry](https://opentelemetry.io/docs/specs/otel/trace/api/#span) format. The trace output is an array of spans. Each trace has a unique id. Every span has in the trace has this parent ```trace_id```. Please note that ```trace_id``` groups related spans and is auto generated with-in Monocle. + +| Span JSON | Description | +| ------------- | ------------- | +| {|| +| "```name```": "langchain.workflow",|span name and is configurable in [__init.py__](src/monocle_apptrace/langchain/__init__.py) or in ```setup_monocle_telemetry(...)```| +| "```context```": {|this gets autogenerated| +|   "```trace_id```": "0xe5269f0e534efa098b240f974220d6b7",|| +|   "```span_id```": "0x30b13075eca52f44",|| +|   "```trace_state```": "[]"|| +|   },|| +|"```kind```": "SpanKind.INTERNAL",| an enum that describes what this span is about. Default value is SpanKind.INTERNAL, as current enums do not cover ML apps | +|"```parent_id```": null,|if null, this is root span| +|"```start_time```": "2024-07-16T17:05:15.544861Z",|| +|"```end_time```": "2024-07-16T17:05:43.502007Z",|| +|"```status```": {|| +|  "```status_code```": "UNSET"| status of span to OK or ERROR. Default is UNSET| +|  },|| +|"```attributes```": {|| +|  "workflow_name": "ml_rag_app",|defines the name of the service being set in ```setup_monocle_telemetry(...)``` during initialization of instrumentation| +|  "workflow_type": "workflow.langchain"|type of framework that generated this span| +|  },|| +|"```events```": [|captures the log records| +|  {|| +|   "```name```": "input",|name of the event. If the span is about LLM, then this will be 'input'. For vector store retrieval, this would be 'context_input'| +|   "```timestamp```": "2024-07-16T17:05:15.544874Z",|| +|   "```attributes```": {|captures the 'input' attributes. Based on the workflow of the ML framework being used, the attributes change| +|    "question": "What is Task Decomposition?",|represents LLM query| +|    "q_a_pairs": "..." |represents questions and answers for a few shot LLM prompting | +|   }|| +|  },|| +|  {|| +|   "```name```": "output",|represents 'ouput' event of LLM| +|   "```timestamp```": "2024-07-16T17:05:43.501996Z",|| +|  "```attributes```": {|| +|    "response": "Task Decomposition is ..."|response to LLM query. | +|   }|| +|  }|| +|  ],|| +|  "```links```": [],|unused. Ideally this links other causally-related spans,
but as spans are grouped by ```trace_id```, and ```parent_id``` links to parent span, this is unused| +|  "```resource```": {|represents the service name or server or machine or container which generated the span| +|    "```attributes```": {|| +|     "service.name": "ml_rag_app"|only service.name is being populated and defaults to the value of 'workflow_name' | +|    },|| +|  "```schema_url```": ""|unused| +|   }|| +|} | | \ No newline at end of file diff --git a/documentation/Monocle_contributor_guide.md b/documentation/Monocle_contributor_guide.md new file mode 100644 index 0000000..78a0d59 --- /dev/null +++ b/documentation/Monocle_contributor_guide.md @@ -0,0 +1 @@ +Coming soon ... \ No newline at end of file diff --git a/documentation/What-is-monocle.md b/documentation/What-is-monocle.md new file mode 100644 index 0000000..a61657d --- /dev/null +++ b/documentation/What-is-monocle.md @@ -0,0 +1,40 @@ +--- +layout: default +--- + +# Monocle for tracing GenAI app code + +Monocle is built for: +- **app developers** to trace their app code in any environment without lots of custom code decoration +- **platform engineers** to instrument apps in prod through wrapping instead of asking app devs to recode +- **GenAI component providers** to add observability features to their products +- **enterprises** to consume traces from GenAI apps in their existing open-source observability stack + +Benefits: +- Monocle provides an implementation + package, not just a spec + - No expertise in OpenTelemetry spec required + - No bespoke implementation of that spec required + - No last-mile GenAI domain specific code required to instrument your app +- Monocle provides consistency + - Connect traces across app code executions, model inference or data retrievals + - No cleansing of telemetry data across GenAI component providers required + - Works the same in personal lab dev or org cloud prod environments + - Send traces to location that fits your scale, budget and observability stack +- Monocle is fully open source and community driven + - No vendor lock-in + - Implementation is transparent + - You can freely use or customize it to fit your needs + +## What Monocle provides + +- Easy to use code instrumentation. +- OpenTelemetry compatible format for spans and traces. +- Community-curated and extensible metamodel for consisent tracing of GenAI components. +- Export of telemetry to local and cloud storage. + +## Get involved +### Provide feedback +- Submit issues and enhancements requests via Github issues + +### Contribute +- Monocle is community based open source project. We welcome your contributions. diff --git a/documentation/quickstart.md b/documentation/quickstart.md new file mode 100644 index 0000000..2b10e63 --- /dev/null +++ b/documentation/quickstart.md @@ -0,0 +1,31 @@ +--- +layout: default +--- + +# Instrument TypeScript GenAI code +- Get the Monocle package + +``` + npm install --save monacle2ai +``` +- Instrument your app code +```js + const { setupMonocle } = require("monacle2ai") + setup_monocle_telemetry(workflow_name="your-app-name") +``` + +# Instrument Python GenAI code +- Get the Monocle package + +``` + pip install monocle_apptrace +``` +- Instrument your app code + - Import the Monocle package + ``` + from okahu_apptrace.instrumentation.common.instrumentor import setup_monocle_telemetry + ``` + - Setup instrumentation in your ```main()``` function + ``` + setup_monocle_telemetry(workflow_name="your-app-name") + ``` diff --git a/index.markdown b/index.markdown new file mode 100644 index 0000000..3d583b8 --- /dev/null +++ b/index.markdown @@ -0,0 +1,16 @@ +--- +layout: default +--- + +## Demo + +[![Coffee chatbot](assets/img/monocle_chatbot_aws.png)](https://qvtzjqzfun.us-east-1.awsapprunner.com) +Try asking this demo [chatbot](https://qvtzjqzfun.us-east-1.awsapprunner.com) a question about coffee and explore the [traces](https://qvtzjqzfun.us-east-1.awsapprunner.com/s3) extracted by Monocle. Checkout the chatbot code on [Github](https://github.com/okahu-demos/chatbot-coffee-lambda) to see how easy it is to instrument your code with Monocle. + +## Documentation + +- [What is Monocle?](documentation/What-is-monocle.md) +- Use Monocle + - [Quickstart](documentation/quickstart.md) + - [User guide](documentation/Monocle_User_Guide.md) +- [Contribute](documentation/Monocle_contributor_guide.md)