mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-08-08 00:22:14 +01:00
feat(qpdf): record Factur-X and PDF/A attributes on traces
This commit is contained in:
@@ -16,6 +16,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
|
"go.opentelemetry.io/otel/attribute"
|
||||||
"go.opentelemetry.io/otel/codes"
|
"go.opentelemetry.io/otel/codes"
|
||||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||||
"go.opentelemetry.io/otel/trace"
|
"go.opentelemetry.io/otel/trace"
|
||||||
@@ -691,7 +692,11 @@ const facturXNamespaceURI = "urn:factur-x:pdfa:CrossIndustryDocument:invoice:1p0
|
|||||||
func (engine *QPdf) InjectFacturXXMP(ctx context.Context, logger *slog.Logger, facturX gotenberg.FacturX, inputPath string) error {
|
func (engine *QPdf) InjectFacturXXMP(ctx context.Context, logger *slog.Logger, facturX gotenberg.FacturX, inputPath string) error {
|
||||||
ctx, span := gotenberg.Tracer().Start(ctx, "qpdf.InjectFacturXXMP",
|
ctx, span := gotenberg.Tracer().Start(ctx, "qpdf.InjectFacturXXMP",
|
||||||
trace.WithSpanKind(trace.SpanKindClient),
|
trace.WithSpanKind(trace.SpanKindClient),
|
||||||
trace.WithAttributes(semconv.ServerAddress(engine.binPath)),
|
trace.WithAttributes(
|
||||||
|
semconv.ServerAddress(engine.binPath),
|
||||||
|
attribute.String("gotenberg.facturx.conformance_level", facturX.ConformanceLevel),
|
||||||
|
attribute.String("gotenberg.facturx.document_type", facturX.DocumentType),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
defer span.End()
|
defer span.End()
|
||||||
|
|
||||||
@@ -804,6 +809,10 @@ func (engine *QPdf) ReadPdfAConformance(ctx context.Context, logger *slog.Logger
|
|||||||
}
|
}
|
||||||
|
|
||||||
part, conformance := parsePdfAId(xmp)
|
part, conformance := parsePdfAId(xmp)
|
||||||
|
span.SetAttributes(
|
||||||
|
attribute.String("gotenberg.pdfa.part", part),
|
||||||
|
attribute.String("gotenberg.pdfa.conformance", conformance),
|
||||||
|
)
|
||||||
span.SetStatus(codes.Ok, "")
|
span.SetStatus(codes.Ok, "")
|
||||||
return part, conformance, nil
|
return part, conformance, nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user