Skip to content

Commit

Permalink
chore: Use recommended config for renderer
Browse files Browse the repository at this point in the history
* Update go.mod

Signed-off-by: Mahendra Paipuri <[email protected]>
  • Loading branch information
mahendrapaipuri committed Jan 22, 2024
1 parent 621188e commit 43cd9f5
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 36 deletions.
7 changes: 7 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,12 @@ services:
- GF_LOG_FILTERS=rendering:debug
renderer:
image: grafana/grafana-image-renderer:latest
environment:
# Recommendation of grafana-image-renderer for optimal performance
# https://grafana.com/docs/grafana/latest/setup-grafana/image-rendering/#configuration
- RENDERING_MODE=clustered
- RENDERING_CLUSTERING_MODE=browser
- RENDERING_CLUSTERING_MAX_CONCURRENCY=5
- RENDERING_CLUSTERING_TIMEOUT=60
ports:
- 8081
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ toolchain go1.21.3
require (
github.com/google/uuid v1.5.0
github.com/grafana/grafana-plugin-sdk-go v0.199.0
github.com/magefile/mage v1.15.0
github.com/smartystreets/goconvey v1.8.1
)

Expand Down Expand Up @@ -45,7 +46,6 @@ require (
github.com/jtolds/gls v4.20.0+incompatible // indirect
github.com/klauspost/compress v1.15.15 // indirect
github.com/klauspost/cpuid/v2 v2.2.3 // indirect
github.com/magefile/mage v1.15.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattetti/filebuffer v1.0.1 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
Expand Down
84 changes: 49 additions & 35 deletions pkg/plugin/texTemplate.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,49 +5,63 @@ const (
%use square brackets as golang text templating delimiters
\documentclass{article}
\usepackage{graphicx}
\usepackage[margin=1in]{geometry}
[[- if .IsLandscapeOrientation]]
\usepackage[landscape,margin=0.1in]{geometry}
[[- else]]
\usepackage[margin=0.1in]{geometry}
[[- end]]
\graphicspath{ {images/} }
\begin{document}
\title{[[.Title]] [[if .VariableValues]] \\ \large [[.VariableValues]] [[end]] [[if .Description]] \\ \small [[.Description]] [[end]]}
\date{[[.FromFormatted]]\\to\\[[.ToFormatted]]}
\maketitle
\begin{center}
[[range .Panels]][[if .IsSingleStat]]\begin{minipage}{0.3\textwidth}
\includegraphics[width=\textwidth]{image[[.Id]]}
\end{minipage}
[[else]]\par
\vspace{0.5cm}
\includegraphics[width=\textwidth]{image[[.Id]]}
\par
\vspace{0.5cm}
[[end]][[end]]
\end{center}
\end{document}
`
\title{
[[.Title]]
[[- if .VariableValues]]
\\ \large [[.VariableValues]]
[[- end]]
[[- if .Description]]
\\ \small [[.Description]]
[[- end]]
}
defaultGridTemplate = `
%use square brackets as golang text templating delimiters
\documentclass{article}
\usepackage{graphicx}
\usepackage[margin=0.5in]{geometry}
\date{
[[.From]]\\
to\\
[[.To]]
}
\graphicspath{ {images/} }
\begin{document}
\title{[[.Title]] [[if .VariableValues]] \\ \large [[.VariableValues]] [[end]] [[if .Description]] \\ \small [[.Description]] [[end]]}
\date{[[.FromFormatted]]\\to\\[[.ToFormatted]]}
\maketitle
\begin{center}
[[range .Panels]][[if .IsPartialWidth]]\begin{minipage}{[[.Width]]\textwidth}
\includegraphics[width=\textwidth]{image[[.Id]]}
\end{minipage}
[[else]]\par
\vspace{0.5cm}
\includegraphics[width=\textwidth]{image[[.Id]]}
\par
\vspace{0.5cm}
[[end]][[end]]
[[- if .IsGridLayout]]
[[- range .Panels]]
[[- if .IsPartialWidth]]
\begin{minipage}{[[.Width]]\textwidth}
\includegraphics[width=\textwidth]{image[[.Id]]}
\end{minipage}
[[- else]]\par
\vspace{0.5cm}
\includegraphics[width=\textwidth]{image[[.Id]]}
\par
\vspace{0.5cm}
[[- end]]
%
[[- end]]
[[else]]
[[- range .Panels]]
[[- if .IsSingleStat]]
\begin{minipage}{0.3\textwidth}
\includegraphics[width=\textwidth]{image[[.Id]]}
\end{minipage}
[[- else]]\par
\vspace{0.5cm}
\includegraphics[width=\textwidth]{image[[.Id]]}
\par
\vspace{0.5cm}
[[- end]]
[[- end]]
[[- end]]
\end{center}
\end{document}
Expand Down

0 comments on commit 43cd9f5

Please sign in to comment.