Relation scope clarification

John Meinel john at
Tue Oct 17 19:21:10 UTC 2017

Ah, I guess that telegraf is actually gathering extra data from mysql or
postgres about database specific stats, and thus it should have a container
scoped relation because it wants to explicitly sit with postgres and
collect general machine information, as well as collect postgres specific
information. It isn't that telegraf is using postgresql as its data store,
its that it knows how to get extra statistical information about a database.

In that case, telegraf *should* use a container scope for its postgresql
interface. I wonder how that works when you have HA postgres, and each
telegraf connection to postgres is at least logically different. (telegraf
should care very much that it never connect to the postgresql on a
different machine and get its information.)

Is this a case where we actually need postgresql to offer up a
"pgsql-monitoring" relation, rather that use the existing "store my data in
postgres, 'pgsql' relation"


On Tue, Oct 17, 2017 at 11:16 PM, John Meinel <john at>

> Why is the subordinate container scoped? The specific scope of container
> is that you only see the single instance that you share a machine with.
> Typically subordinates will use something like the juju-info relation
> because all they really care about is to be colocated on the same machine.
> I can't claim to have deep knowledge here, but I would guess that if one
> end of a relation is normally scoped, and the other is container scoped,
> then the intent is that the relation itself is container scoped and each
> unit of each application only sees the other unit that shares the same
> machine/container.
> Now in the telegraf case, I would expect telegraf to have 2 types of
> relations. 1 which is container scoped that means "I want to monitor this
> application", and *another* which must be global scoped which means "I want
> to use this application to store my data" (assuming telegraf is trying to
> connect to pgsql because it wants to record stuff in a database, if it just
> wanted to sit in the same machine and monitor postgres than I would have
> expected it to use juju-info for that relation.)
> I can't say that I've paged in all the bug comments yet, so I may be
> speaking from misinformation.
> John
> =:->
> On Tue, Oct 17, 2017 at 3:16 PM, Stuart Bishop <
> stuart.bishop at> wrote:
>> Hi.
>> A server declares a relation with standard scope. Lets use PostgreSQL
>> for example, which declares the following in metadata.yaml:
>> provides:
>>   db:
>>     interface: pgsql
>> A client happens to be a subordinate, and declares its end of the
>> relation as container scoped. So in its metadata.yaml:
>> requires:
>>   postgresql:
>>     interface: pgsql
>>     scope: container
>> My first question is: Is this supported by Juju? Can charms have a
>> relation with a different scope at each end? I know it works in most
>> cases, but is it supported or just an accident of implementation?
>> If the answer to that is yes, my second question is: If the relation
>> fails when the two charms declare a different scope, whose fault is
>> it?
>> The problem I have is that if one end of the relation declares
>> container scope, then the relation is container scoped, and
>> relation-get calls attempting to inspect relation data of peers fail.
>> Is this a Juju bug, or does the PostgreSQL charm need to understand
>> this limitation and use some other mechanism if it wants the pgsql
>> relation to work in either global or container scope?
>> Should relation-get return an error if a charm attempts to access
>> relation info from a peer unit, rather than only working if both ends
>> of the relation agree that the relation scope is global.
>> There are several bugs open on this issue dealing with large scale
>> deployments and I'm not sure how to proceed.
>> is the juju one. I think
>> I can update the PostgreSQL charm to support requirements, but I'm
>> worried I would just be digging a deeper hole.
>> --
>> Stuart Bishop <stuart.bishop at>
>> --
>> Juju mailing list
>> Juju at
>> Modify settings or unsubscribe at:
>> an/listinfo/juju
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Juju mailing list