Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different "no such overload" cases #55

Open
pudovd opened this issue Apr 5, 2024 · 0 comments
Open

Different "no such overload" cases #55

pudovd opened this issue Apr 5, 2024 · 0 comments

Comments

@pudovd
Copy link

pudovd commented Apr 5, 2024

I have successfully integrated Elasticsearch with Grafana Loki via CEL, but now I want to refactor within data and I can't do it because "No such overload" errors.

$ mito --version
v1.10.0

test.json - simplified response from loki api

{
	"data": {
		"result": [
			{
				"stream": {
					"cluster": "dev"
				},
				"values": [
					[
						"1712065150402844688",
						"{\"log_level\":\"info\"}"
					]
				]
			}
		],
		"resultType": "streams",
		"stats": {}
	},
	"status": "success"
}
Case 1. collate()

Looks that collate() is executed only after repacking the data.

It's work ok. collate-ok.cel - working demo code
state.data.result.as(res,
    res.map(r, r.values.map(v, zip(["timestamp", "message"], v).with({"stream": r.stream})))
    .flatten().map(r, {"message": r.message, "stream": r.stream, "timestamp": r.timestamp})
).map(r, r.collate("message"))
mito -data test.json collate-ok.cel
[
        [
                "{\"log_level\":\"info\"}"
        ]
]
It's failed. collate-fail.cel - failing demo code
state.data.result.as(res,
    res.map(r, r.values.map(v, zip(["timestamp", "message"], v).with({"stream": r.stream})))
    .flatten()
).map(r, r.collate("message"))
mito -data test.json collate-fail.cel
failed eval: ERROR: <input>:4:19: no such overload: collate
 | ).map(r, r.collate("message"))
 | ..................^
Case 2. decode_json()

Looks that decode_json() is executed only after collate() calling.

It's work ok. decodejson-ok.cel - working demo code
state.data.result.as(res,
    res.map(r, r.values.map(v, zip(["timestamp", "message"], v).with({"stream": r.stream})))
    .flatten()
)
.collate("message")
.map(m, m.decode_json())
mito -data test.json decodejson-ok.cel
[
        {
                "log_level": "info"
        }
]
It's failed. decodejson-fail.cel - failing demo code
state.data.result.as(res,
    res.map(r, r.values.map(v, zip(["timestamp", "message"], v).with({"stream": r.stream})))
    .flatten()
)
.map(r, r.message)
.map(m, m.decode_json())
mito -data test.json decodejson-fail.cel
failed eval: ERROR: <input>:6:22: no such overload
 | .map(m, m.decode_json())
 | .....................^

I have questions about cases:

  1. Why do "no such overload" errors occur?
  2. How to debug such cases?

test.json
collate-fail.cel.txt
collate-ok.cel.txt
decodejson-fail.cel.txt
decodejson-ok.cel.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant