Repository: evidentlyai/evidently
Issue: HTTPError: 400 Client Error when adding report to workspace
Root cause: Documentation Deficiency

Hey there! Love your stuff.

I am implementing a custom `Metric`, and I believe there are no errors coming from that part. There are no calculation errors. 

It is in the call to `workspace.add_report()` where we get a 400 from the POST request to `add_snapshot`. 

I'm sorry I can't link the stacktrace because it's on my work laptop, but it's not particularly informative (just says `requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: <our-evidently-instance>/api/projects/<some-id>/snapshots`

Any help would be appreciated! Is it something wrong with the content (or `MetricResult`) I'm sending?

Hi @tommysteryy , did you implement the custom metric as a Python function like here: https://github.com/evidentlyai/evidently/blob/main/examples/how_to_questions/how_to_build_metric_over_python_function.ipynb ? 

Hi! No, I used this one: https://github.com/evidentlyai/evidently/blob/main/examples/how_to_questions/how_to_make_custom_metric_and_test.ipynb.


Hi @tommysteryy, 

I am afraid as noted in the [docs](https://docs.evidentlyai.com/user-guide/customization/add-custom-metric-or-test) in this case you cannot simply pass the custom metric to the Monitoring UI since the metric code is not available to the server.

If you want to be able to pass the metric for monitoring easily, you must implement it as a Python function with the default counter render. 

Which metric are you looking to add?

Ahhh I see.. thank you for pointing me to that! I missed that part.

I am looking to plot a table that displays some custom calculations used in our use case. That's also why it doesn't quite fit the default Counter renderer. 

Currently, I've implemented my custom `Metric`, `MetricResult`, and `MetricRenderer` (rendering using the [`table_data` function](https://github.com/evidentlyai/evidently/blob/9f993541a5a147c48e18822f511c89803a5431c2/src/evidently/renderers/html_widgets.py#L255)). 

I see that in the docs it mentions:

> This is suitable for open-source use when you only want to access the new Metric in a Report or Test Suite

What is this referring to? How would I use/access my custom metric as a Report?

If that isn't super relevant, do you have any ideas for how I might be able to plot this table on our self-hosted monitoring UI?

Hi @elenasamuylova ,

I just want to double check: the Evidently monitoring UI currently does not allow us to use any renderer other than the default Counter? So like, we cannot select the built-in Table renderer (https://docs.evidentlyai.com/reference/api-reference/evidently.renderers#table_data-column_names-iterable-str-data-iterable-iterable-title-str-size-widgetsize-widgetsize.ful)?

Would you happen to have any a rough estimate on if/when you plan to implement this?

Thanks in advance!

Hi @SSJDiVaD, 

Yes, I am afraid it is not possible. We do not plan to support rendering absolutely custom renders (due to security risks from code injection): rather add more templated renders (like Counter) to choose from. 

This is not in the immediate roadmap so I cannot provide an estimate. 

Hi @tommysteryy, 

>  What is this referring to? How would I use/access my custom metric as a Report?

This refers to using your custom metric in the Report that you can render in your Python environment or save as HTML - but not inside the UI service. Basically, viewing the custom metric exactly in the same way as it works in the example at the "Use the metric" step https://github.com/evidentlyai/evidently/blob/main/examples/how_to_questions/how_to_make_custom_metric_and_test.ipynb

As mentioned, we want to eventually add support for alternative renders (not just Counter) that you can explicitly choose from when creating custom metrics but we are not currently working on it.